Skip to content

Conversation

@Greg0
Copy link
Contributor

@Greg0 Greg0 commented Aug 17, 2025

Based on #5

Overview

This PR introduces PHPStan static analysis to the project and resolves compatibility issues to ensure proper support for PHP 7.4+. The changes improve code quality, type safety, and maintain backward compatibility with older PHP versions.

Changes

🔧 Static Analysis Setup

  • Added PHPStan as a development dependency (version ^2.1)
  • Configured PHPStan with level 3 analysis covering src and tests directories. Level 3 is very low but only this level can be achieved with minimal effort.
  • Added ext-json requirement to ensure JSON extension is available

📦 Dependency Management

  • Downgraded dependencies to support PHP 7.4:
    • PHPUnit: ^10^9
    • psr/log: ^2.0^1.1
  • Updated platform requirements to explicitly support PHP 7.4 and 8.0+

PHPStan Configuration

The current PHPStan configuration uses level 3, which is intentionally conservative to establish a baseline for static analysis. This low level was chosen because:

  • The current codebase uses array-based configuration patterns that don't provide strong type hints
  • Many constructor parameters are passed as array $options without specific type definitions
  • Higher PHPStan levels would require significant architectural changes (Discussion: Library architecture and dependency injection #6)

@fahad19
Copy link
Member

fahad19 commented Aug 18, 2025

thanks @Greg0!

will merge and release if I have your approval.

Copy link
Contributor Author

@Greg0 Greg0 left a comment

Choose a reason for hiding this comment

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

Yes, it can be merged

@fahad19 fahad19 merged commit 3b38e43 into featurevisor:main Aug 18, 2025
1 check passed
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