Weave Code
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

Doctrine Custom Types Bundle Laravel Package

ekapusta/doctrine-custom-types-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Install the package via Composer:

composer require vendor/package-name:^1.4.5

For first-time use, focus on:

  1. PHPUnit Bridge Integration: Leverage Symfony’s PHPUnit bridge (now included) for streamlined testing workflows. Check composer.json for the new dependency.
  2. Class Aliases: Ensure compatibility with PHP 8.x+ by verifying case-sensitive class names (e.g., App\Services\MyService vs. app\Services\MyService). The package now handles this automatically.
  3. PHP Version Support: Confirm your project uses PHP 8.0+ (or downgrade to PHP 7.4+ if needed). Test with phpunit to validate the upgrade.

Key files to inspect:

  • composer.json (for Symfony bridge and PHP version constraints).
  • phpunit.xml (if customizing test suites post-upgrade).

Implementation Patterns

1. Testing Workflows

  • Symfony PHPUnit Bridge: Use the bridge to share test utilities (e.g., symfony/phpunit-bridge) between Laravel and Symfony projects. Example:
    use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; // Now available via the bridge
    
  • Test Upgrades: If using PHPUnit 9.x+, update test classes to use the new assertSameSize() or assertStringContainsString() methods. For older PHP versions (e.g., 7.4), the package downgrades dependencies automatically.

2. Class Aliases & Autoloading

  • PHP 8.x Case Sensitivity: Ensure autoloaded classes match filesystem casing. Use:
    composer dump-autoload
    
    after renaming files (e.g., myService.phpMyService.php).

3. Dependency Management

  • Composer Constraints: Add this to composer.json to enforce the Symfony bridge version:
    "require": {
      "symfony/phpunit-bridge": "^5.2.12"
    }
    
    Run composer update to resolve dependencies.

4. Migration from Older Versions

  • If upgrading from <1.4.0, verify:
    • No breaking changes in PHPUnit assertions (e.g., assertContains() syntax).
    • Class aliases are case-sensitive in PHP 8.x (test with class_alias() if needed).

Gotchas and Tips

Breaking Changes

  1. PHPUnit 9.x+: Methods like assertEquals() now throw exceptions on failure by default. Update tests to use:

    $this->assertEquals($expected, $actual, 'Custom message');
    

    or configure phpunit.xml:

    <phpunit ...>
      <php>
        <ini name="error_reporting" value="-1" />
      </php>
    </phpunit>
    
  2. Symfony Bridge Dependency: The package now requires symfony/phpunit-bridge. If your project doesn’t use Symfony, this is a soft dependency—remove it via:

    composer remove symfony/phpunit-bridge
    

Debugging Tips

  • Class Not Found Errors: In PHP 8.x, verify:
    • Filesystem casing matches the class name (e.g., Namespace\ClassName vs. namespace\classname).
    • Run composer dump-autoload --optimize to regenerate autoload files.
  • PHPUnit Failures: Use phpunit --debug to isolate issues with the Symfony bridge or test upgrades.

Extension Points

  • Custom PHPUnit Config: Override the Symfony bridge’s behavior by extending phpunit.xml:
    <extensions>
      <extension class="Symfony\Bridge\PhpUnit\SymfonyTestsExtension" />
    </extensions>
    
  • PHP Version Polyfills: For mixed PHP 7.4/8.x projects, use prefer-stable in composer.json:
    "config": {
      "preferred-install": "dist",
      "platform-check": false
    }
    

Performance

  • The Symfony bridge adds ~50ms to test suite initialization. For large projects, consider:
    phpunit --exclude-group integration
    
    to skip Symfony-specific tests if unused.
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.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle