Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

No Floaters Laravel Package

roave/no-floaters

PHPStan plugin that bans floats: no float properties, parameters, return types, or assigning float values. Optional strict mode disallows any float-producing expression. Helps prevent rounding errors in domains like money, grading, or scientific calculations.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Static Analysis Integration: The roave/no-floaters package remains a static analysis tool (PHPStan extension) for detecting IEEE-754 floating-point precision errors. Its architectural fit in Laravel/PHP ecosystems is unchanged, particularly for applications requiring strict type safety, financial/scientific calculations, or adherence to coding standards.
  • Non-Intrusive: Operates at the analysis layer with zero runtime impact, maintaining low risk for existing applications.
  • Complementary to Laravel’s Ecosystem: Aligns with Laravel’s dependency injection, CI/CD pipelines (e.g., Laravel Forge/Sail), and testing-first culture. No changes to this alignment.

Integration Feasibility

  • PHPStan Dependency: Requires PHPStan 1.0+ (Laravel 8+ compatible; older versions need manual setup). Unchanged.
  • Configuration Overhead: Minimal and unchanged—extend phpstan.neon with the package’s extension.
  • False Positives/Negatives: Risk remains; customization via level or ignoreErrors is still required.
  • Performance Impact: Negligible at runtime; CI/CD may see slight slowdowns (~5–15%).

Technical Risk

Risk Area Severity Mitigation Strategy
False Positives Medium Test with a subset of math-heavy logic first. Use ignoreErrors.
PHPStan Version Lock Low Pin PHPStan version (e.g., ^1.8 or higher).
Legacy Codebase High Incremental adoption; start with non-critical modules.
Custom Math Libraries Medium Exclude vendor paths in phpstan.neon.
CI/CD Pipeline Breaks Low Run in pre-commit hooks before CI.
Conditional Return Types Low New: Improved handling of floating-point expressions in generics/conditionals may reduce false positives. Monitor for edge cases.
PHP 8.3 Incompatibility High New: Drop of PHP 8.3 support requires explicit version pinning to 8.0–8.2.

Key Questions

  1. Precision Requirements: Unchanged—critical for financial/scientific apps.
  2. Current Static Analysis Maturity: Unchanged—assess PHPStan/Psalm usage.
  3. Team Adoption: Unchanged—educate on static analysis warnings.
  4. Performance-Critical Paths: Unchanged—identify hot paths with floating-point ops.
  5. Alternative Solutions: Unchanged—consider decimal libraries (e.g., brianium/paradoxx).
  6. PHP Version Compatibility: Updated—Confirm PHP 8.0–8.2 usage (PHP 8.3 no longer supported).
  7. Conditional Type Handling: New—Evaluate if improved generic/conditional return type detection reduces false positives in your codebase.
  8. Dependency Updates: New—Assess impact of PHPUnit v13 dependency update (if applicable to your stack).

Integration Approach

Stack Fit

  • Laravel 8+: Native PHPStan support; minimal friction.
  • Laravel 7 or Below: Requires manual PHPStan installation (higher effort).
  • Monolithic vs. Microservices: Unchanged—apply globally or per-service.
  • Toolchain Synergy: Works with PHP-CS-Fixer, PestPHP/PhpUnit, and CI/CD tools.

Migration Path

  1. Assessment Phase: Audit floating-point usage (unchanged).
  2. Pilot Integration: Start with non-critical modules (unchanged).
  3. Full Rollout: Gradually increase level (unchanged).
  4. PHP Version Check: Updated—Ensure PHP 8.0–8.2 compatibility (PHP 8.3 dropped).
  5. Dependency Review: New—Verify compatibility with PHPUnit v13 if your stack uses it.

Compatibility

  • PHP Version: Updated—PHP 8.0–8.2 (PHP 8.3 no longer supported).
  • Laravel-Specific Considerations: Unchanged—check Eloquent models, Carbon, and third-party libs.
  • Third-Party Conflicts: Unchanged—exclude paths in phpstan.neon.
  • Conditional Return Types: New—Test with complex generic/conditional logic to validate improvements.
  • PHPUnit v13: New—Assess if your test suite requires adjustments for PHPUnit v13 compatibility.

Sequencing

  1. Pre-requisite: Ensure PHPStan is installed and PHP version is compatible (8.0–8.2).
  2. Step 1: Add roave/no-floaters to composer.json:
    composer require --dev roave/no-floaters
    
  3. Step 2: Extend phpstan.neon (unchanged).
  4. Step 3: Run analysis (unchanged).
  5. Step 4: Fix violations iteratively (unchanged).
    • New: Pay special attention to generic/conditional return types for potential false positives.
  6. Step 5: Automate in CI/CD (unchanged).
  7. Step 6: New—Verify PHPUnit v13 compatibility if applicable.

Operational Impact

Maintenance

  • Low Ongoing Effort: Unchanged—no runtime maintenance.
  • Configuration Drift: Risk of overly strict rules remains; document exceptions.
  • PHP Version Lock: Updated—Pin PHP version to 8.2 or lower (PHP 8.3 dropped).
  • Dependency Updates: New—Monitor for PHPUnit v13-related issues in your test suite.

Support

  • Developer Onboarding: Unchanged—educate on floating-point precision and PHPStan errors.
  • Support Burden: Unchanged—initial tickets may rise; provide FAQs.
  • Conditional Type Handling: New—Clarify improved detection may reduce noise but validate edge cases.
  • PHP 8.3 Users: New—Provide clear guidance to downgrade or migrate to PHP 8.0–8.2.

Scaling

  • Performance: Unchanged—no runtime impact; CI/CD may need parallelization for large codebases.
  • Team Size: Unchanged—centralized configuration for large teams.
  • Multi-Repo Workflows: Unchanged—use composer scripts for consistency.

Failure Modes

Failure Mode Impact Detection/Recovery
PHP 8.3 Incompatibility High Downgrade to PHP 8.0–8.2 or update package if PHP 8.3 is used.
False Positives Medium Test subsets; use ignoreErrors.
CI/CD Pipeline Breaks Low Run pre-commit hooks.
Configuration Drift Medium Document and review phpstan.neon regularly.
Conditional Type Errors Low New: Monitor for false positives in complex generics/conditionals.
PHPUnit v13 Issues Medium New: Test suite compatibility checks; update tests if needed.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource