-
-
Notifications
You must be signed in to change notification settings - Fork 27
Add comprehensive PHPStan type tests for all helper functions #971
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
Add comprehensive PHPStan type tests for all helper functions #971
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
Co-authored-by: huangdijia <8337659+huangdijia@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
894922f
into
feat/add-phpstan-type-checking
* feat: add PHPStan type checking configuration and composer script Add PHPStan configuration for type assertion testing and a new composer script for running type checks. This includes: - New phpstan.types.neon.dist configuration file for type checking - New types/ directory with helper function type assertions - New composer script 'check:types' for running type analysis This enhancement allows developers to validate type assertions for helper functions and ensure type safety across the codebase. * Add comprehensive PHPStan type tests for all helper functions (#971) * Initial plan * feat: add comprehensive type tests for all helper functions Co-authored-by: huangdijia <8337659+huangdijia@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: huangdijia <8337659+huangdijia@users.noreply.github.com> * Move call() tests to Functions.php and update type assertions Deleted Command/Functions.php and moved its call() tests to Helpers/Functions.php. Updated type assertions and test cases in Helpers/Functions.php for improved accuracy and consistency with current return types. Co-Authored-By: Deeka Wong <8337659+huangdijia@users.noreply.github.com> * fix: remove unnecessary backslash from Throwable type hint in dispatch job * refactor: rename check:types script to type-testing for clarity * fix: move type-testing script to the correct position in composer.json * fix: remove unnecessary blank line before type-testing script in composer.json * feat: add Support.php with various utility classes and type assertions * fix: add return type hints for __invoke methods in ClientBuilderFactory and HubFactory * feat: add PHPStan type assertion tests for macros component (#973) * Initial plan * feat: add type assertion tests for macros component Co-authored-by: huangdijia <8337659+huangdijia@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: huangdijia <8337659+huangdijia@users.noreply.github.com> * feat: add PHPStan type testing for cache component (#972) * Initial plan * feat: add comprehensive type testing for cache component Co-authored-by: huangdijia <8337659+huangdijia@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: huangdijia <8337659+huangdijia@users.noreply.github.com> * fix: remove unused imports in Cache and Macros components * feat: update PHPStan configuration and enhance type assertions in various components * fix: update parameter type hint for Str::of method * fix: remove unused Factory method tests in Cache Manager * feat: add type testing step in CI workflow * fix: comment out unused setMultiple tests in Repository * fix: comment out unused getMultiple tests in Repository --------- Co-authored-by: Deeka Wong <8337659+huangdijia@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
* feat: add PHPStan type checking configuration and composer script Add PHPStan configuration for type assertion testing and a new composer script for running type checks. This includes: - New phpstan.types.neon.dist configuration file for type checking - New types/ directory with helper function type assertions - New composer script 'check:types' for running type analysis This enhancement allows developers to validate type assertions for helper functions and ensure type safety across the codebase. * Add comprehensive PHPStan type tests for all helper functions (#971) * Initial plan * feat: add comprehensive type tests for all helper functions Co-authored-by: huangdijia <8337659+huangdijia@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: huangdijia <8337659+huangdijia@users.noreply.github.com> * Move call() tests to Functions.php and update type assertions Deleted Command/Functions.php and moved its call() tests to Helpers/Functions.php. Updated type assertions and test cases in Helpers/Functions.php for improved accuracy and consistency with current return types. Co-Authored-By: Deeka Wong <8337659+huangdijia@users.noreply.github.com> * fix: remove unnecessary backslash from Throwable type hint in dispatch job * refactor: rename check:types script to type-testing for clarity * fix: move type-testing script to the correct position in composer.json * fix: remove unnecessary blank line before type-testing script in composer.json * feat: add Support.php with various utility classes and type assertions * fix: add return type hints for __invoke methods in ClientBuilderFactory and HubFactory * feat: add PHPStan type assertion tests for macros component (#973) * Initial plan * feat: add type assertion tests for macros component Co-authored-by: huangdijia <8337659+huangdijia@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: huangdijia <8337659+huangdijia@users.noreply.github.com> * feat: add PHPStan type testing for cache component (#972) * Initial plan * feat: add comprehensive type testing for cache component Co-authored-by: huangdijia <8337659+huangdijia@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: huangdijia <8337659+huangdijia@users.noreply.github.com> * fix: remove unused imports in Cache and Macros components * feat: update PHPStan configuration and enhance type assertions in various components * fix: update parameter type hint for Str::of method * fix: remove unused Factory method tests in Cache Manager * feat: add type testing step in CI workflow * fix: comment out unused setMultiple tests in Repository * fix: comment out unused getMultiple tests in Repository --------- Co-Authored-By: Deeka Wong <8337659+huangdijia@users.noreply.github.com> Co-Authored-By: Copilot <198982749+Copilot@users.noreply.github.com>
Extends type assertion coverage to validate return types for all 32 helper functions in
src/helpers/.Changes
types/Helpers/Functions.php - Added type assertions for all helper functions:
app(),di(),resolve()base_path(),environment()blank(),filled(),validator()request(),response(),cookie(),session(),get_client_ip()logger(),logs(),info()cache(),session()fluent(),literal(),transform(),when(),rescue(),event(),dispatch()now(),today()class_namespace(),object_get(),preg_replace_array()throw_if(),throw_unless()enum_value()types/Helpers/Command/Functions.php - Added type assertions for command helper:
call()- validatesintreturn type for command executionAll tests use PHPStan's
assertType()to verify function return types match their declared signatures, including conditional return types based on parameters.💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.