Feature/1.1.4#13
Merged
Merged
Conversation
- Introduced `quick-quality-check.sh` for rapid validation of PivotPHP Core v1.1.4, including PHPStan analysis, PSR-12 compliance checks, syntax validation for examples, performance testing, and basic loading checks. - Added `simple_pre_release.sh` to streamline the pre-release validation process, ensuring essential files exist, validating example syntax, checking autoloader, and running basic benchmarks. - Created `validate_all_v114.sh` to execute all validation scripts sequentially, providing a comprehensive overview of the project's health and readiness for release. - Enhanced error handling with `ContextualException` for better debugging and context in error messages. - Implemented `CallableResolver` utility to handle various callable types, improving route handler validation in the router. - Updated core application logic to utilize the new `CallableResolver` for improved error handling and route management. - Added intelligent JSON pooling logic in `JsonBufferPool` to optimize JSON encoding based on data characteristics. - Refactored cache classes to improve code readability and maintainability.
…e garantir codificação JSON segura
- Deleted comprehensive, executive, final performance analysis, performance charts, and summary reports to streamline documentation. - Updated `Response` class to utilize centralized pooling logic from `JsonBufferPool` for consistency in JSON data handling. - Added a public method in `JsonBufferPool` to check if data should use pooling, ensuring consistent behavior across components. - Modified tests to ensure proper pooling thresholds and consistency between direct and response pooling. - Enhanced test cases to validate JSON encoding with pooling, ensuring efficient memory usage and buffer reuse.
- Added `Environment` class for consistent environment detection across the framework. - Introduced methods for checking development, production, and testing modes. - Implemented caching for performance optimization. - Integrated environment detection with the enhanced exception system. - Created comprehensive tests for the `Environment` class to ensure reliability. chore: Update test-all-php-versions.sh to support quality metrics - Added option to run quality checks in parallel during PHP version tests. - Improved logging for quality metrics results. fix: Refactor ContextualException to utilize Environment class - Replaced scattered development mode checks with centralized `Environment::isDevelopment()` calls. - Enhanced debug information handling based on the environment. refactor: Improve JsonBufferPool with consistent constants - Introduced constants for pooling thresholds and limits for better maintainability. - Updated tests to utilize new constants for consistency in behavior.
- Implement comprehensive tests for CallableResolver to validate various callable types, including closures, string functions, and array callables with static and instance methods. - Ensure proper exception handling for non-existent functions and invalid callables. - Test edge cases for callable resolution, including private and protected methods, and invalid types. - Add tests for SerializationCache to verify serialization size calculations, cache hits/misses, and cache eviction behavior. - Include tests for scalar data and object caching, ensuring accurate memory usage calculations and cache statistics.
- Deleted quick-quality-check.sh, setup-precommit.sh, simple_pre_release.sh, test-php-versions-quick.sh, and validate_all_v114.sh scripts to streamline the project. - Enhanced version management by ensuring the VERSION file is mandatory and validated across various scripts. - Updated validate-documentation.php and validate_openapi.sh to retrieve and validate the current version from the VERSION file. - Improved error handling in version-bump.sh for better user feedback on version management. - Refactored static file registration methods in StaticFileManager and StaticRouteManager for improved readability and maintainability. - Adjusted tests to accommodate changes in version management and ensure compatibility across PHP versions.
… gerenciamento de arquivos estáticos
…n script - Introduced `validate_openapi.sh` to check OpenAPI/Swagger resources, ensuring proper functionality and documentation. - Added `validate_project.php` to perform comprehensive validation of the project structure, dependencies, and documentation. - Enhanced error handling in middleware classes by throwing `HttpException` for better response management. - Updated tests for authentication middleware to expect `HttpException` on failure.
🚀 Release Readiness Report - PivotPHP Core v1.1.4✅ All Checks Passed!
📦 Ready for PublicationThe project is ready to be tagged and released! Next Steps:
|
…ção sobre rotas pré-compiladas
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR updates the framework to version 1.1.4 by introducing a unified callable resolver, enhancing error handling with rich context exceptions, and refining JSON pooling behavior across the codebase.
- Add
CallableResolverto centralize and validate all callable types in routing and application. - Replace inline JSON error responses with
HttpExceptionandContextualExceptionfor consistent, contextual error handling. - Extend
JsonBufferPoolwith adaptive pooling thresholds and unify pooling logic inResponse.
Reviewed Changes
Copilot reviewed 108 out of 113 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Utils/CallableResolver.php | New utility to resolve and validate different callable types. |
| src/Routing/Router.php | Integrated CallableResolver for handler registration and resolution. |
| src/Routing/StaticRouteManager.php | Refactored static route handlers to throw HttpException. |
| src/Routing/StaticFileManager.php | Updated to use HttpException and PSR-7 streams for file responses. |
| src/Routing/SimpleStaticFileManager.php | Refactored to throw HttpException and use PSR-7 body streams. |
| src/Middleware/Security/CsrfMiddleware.php | Switched to throwing HttpException on CSRF failure. |
| src/Middleware/Security/AuthMiddleware.php | Refactored to throw HttpException instead of building inline responses. |
| src/Middleware/Core/BaseMiddleware.php | Centralized error responses by throwing HttpException. |
| src/Middleware/CircuitBreaker.php | Unified failure responses with HttpException and standardized headers. |
| src/Json/Pool/JsonBufferPool.php | Added adaptive pooling thresholds and public API for pooling decisions. |
| src/Http/Response.php | Delegated JSON pooling decision to JsonBufferPool.shouldUsePoolingForData. |
| src/Exceptions/Enhanced/ContextualException.php | New exception class with contextual data and factory methods. |
| src/Core/Environment.php | Added cached environment detection and debug info retrieval. |
| src/Core/Application.php | Integrated ContextualException for route lookup and handler errors. |
| scripts/validation/* | Centralized version detection via VERSION file in validation scripts. |
| tests/... | Updated tests to expect new exceptions, skip in coverage mode, and align with refactored behavior. |
Comments suppressed due to low confidence (2)
src/Routing/StaticRouteManager.php:172
- Variable
$contentis undefined in this closure; you likely intended to use the captured string parameter (currently named$response). Consider renaming the parameter to$body(or similar) and using that value instead of$contentwhen creating the PSR-7 stream.
$res = $res->withBody(\PivotPHP\Core\Http\Pool\Psr7Pool::getStream($content));
src/Http/Response.php:835
- The
JsonBufferPoolclass is not imported in this file, which will cause an undefined class error. Please adduse PivotPHP\Core\Json\Pool\JsonBufferPool;at the top of the file.
return JsonBufferPool::shouldUsePoolingForData($data);
🚀 Release Readiness Report - PivotPHP Core v1.1.4✅ All Checks Passed!
📦 Ready for PublicationThe project is ready to be tagged and released! Next Steps:
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
🚀 Release Readiness Report - PivotPHP Core v1.1.4✅ All Checks Passed!
📦 Ready for PublicationThe project is ready to be tagged and released! Next Steps:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Template
📋 Descrição
Descreva resumidamente as mudanças feitas neste PR.
🎯 Tipo de Mudança
🧪 Como foi testado?
Descreva os testes que você executou para verificar suas mudanças.