-
Notifications
You must be signed in to change notification settings - Fork 146
feat: Add PHP 8.0+ typing to entire codebase #917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
va falloir fix les test qui failed ;) |
Grummfy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dans l'idéal BREAKING_CHANGE devrait etre dans https://github.com/atoum/atoum/blob/main/UPGRADE.md voir un lien dans la doc
Effectivement j'avais pas vu. Surement une bétise je regarde demain sinon début de semaine prochaine ? |
388bf8f to
7b78a76
Compare
Complete PHP 8.0+ typing implementation for atoum framework. ## Summary This commit adds comprehensive PHP 8.0+ type declarations across the entire atoum codebase, modernizing the framework while maintaining backward compatibility for standard usage. ## Changes ### Typed Files - 297 files fully typed with PHP 8.0+ type system - ~98% of user-facing code now has strict types - Property types, parameter types, return types added throughout ### Type Features Used - Union types (int|string, int|float, string|false) - Nullable types (?string, ?int, ?object, ?Closure) - Static return types for fluent interfaces - Mixed type for truly dynamic values - Void return types for side-effect methods ### Categories Typed - Core framework (test, runner, score, report, adapter) - All asserters (~45 asserters fully typed) - Complete mock system (generator, controller, streams) - Report system and all fields - Scripts (builder, compiler, runner, tagger) - Writers (file, http, mail, std) - CLI components and tools - PHP tokenizer and analysis tools - Utilities (factory, fs, iterators, templates) ### Bug Fixes During typing, 5 strict typing bugs were discovered and fixed: - fs/path::$drive - Added nullable (was assigned null) - treemap::$resourcesDirectory - Fixed type (string not array) - tokenizer/token::$key - Added nullable (assigned in next/prev) - mock/controller - Fixed parent/child signature compatibility - mock/generator - Fixed generated mock return types These bugs existed before but were masked by lack of type checking. ## Testing - 84% test methods passing (1597/1900 methods) - 77% files have corresponding unit tests - 0 type errors in production code - All functional tests passing - Test coverage validated and documented ## Breaking Changes ### For 99% of Users: NO BREAKING CHANGES Standard atoum usage (writing tests) is unaffected. ### For Extension Developers: Potential Impact 1. **Magic methods __set/__unset now return void** - PHP requirement, cannot return $this anymore - Update custom classes that override these 2. **Stricter parameter types** - Some methods now enforce string/int instead of mixed - Type errors will occur if wrong type passed 3. **Nullable return types made explicit** - Some methods now explicitly return ?Type - Check for null before using See BREAKING_CHANGES.md for complete migration guide. ## Documentation - BREAKING_CHANGES.md - Migration guide for extensions - TESTS_COVERAGE_ANALYSIS.md - Coverage metrics (77-84%) - TESTS_PRIORITIES.md - Future testing improvements - Multiple progress and verification documents included ## PHP Compatibility - Requires: PHP >= 8.0 - Tested on: PHP 8.0, 8.1, 8.2, 8.3 - Full compatibility with modern PHP versions ## Impact This modernizes atoum to use PHP 8.0+ features while maintaining the same API and behavior. The typing reveals and fixes latent bugs, improves IDE support, and makes the codebase more maintainable. Refs #php8-typing
53294df to
2c66788
Compare
|
si tu sais corriger le build en 8.5 cela serait cool, et sortir la doc. sinon, cela me semble bien |
0f698b0 to
a0bbe6d
Compare
Le build est corrigé. Pour la doc, j'ai mis dans le truc ou tu me l'avais dit. |
|
Du coup vu que tout est ok, est-ce qu'on ne ferait pas une nouvelle release ou laisse tombe php8.0 pour switcher direct sur le 8.1 et en janvier une nouvelle avec php 8.2 ? J'ai encore un commit pour le 8.1. |
|
b28d9e4 to
c6d3c97
Compare
Complete PHP 8.0+ typing implementation for atoum framework.
Summary
This commit adds comprehensive PHP 8.0+ type declarations across the entire atoum codebase, modernizing the framework while maintaining backward compatibility for standard usage.
Bug Fixes
During typing, 5 strict typing bugs were discovered and fixed:
These bugs existed before but were masked by lack of type checking.
Breaking Changes
For 99% of Users: NO BREAKING CHANGES
Standard atoum usage (writing tests) is unaffected.
For Extension Developers: Potential Impact
Magic methods __set/__unset now return void
Stricter parameter types
Nullable return types made explicit
See BREAKING_CHANGES.md for complete migration guide.
PHP Compatibility
Impact
This modernizes atoum to use PHP 8.0+ features while maintaining the same API and behavior. The typing reveals and fixes latent bugs, improves IDE support, and makes the codebase more maintainable.