laravel-mongodb - Issue #3477: Builder::timeout() conflicts with newly added Eloquent function

XMLWordPrintableJSON

    • None
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      fish3046 has created Issue #3477: Builder::timeout() conflicts with newly added Eloquent function in laravel-mongodb. This Jira ticket was filed by GromNaN

      Issue Text:

      • Laravel-mongodb Version: 5.5.0
      • PHP Version: 8.3.30
      • Database Driver & Version:

      Description:

      [In Laravel 12.51.0 they added a timeout() function to the Query\Builder class](https://github.com/laravel/framework/pull/58644). The signature conflicts with `MongoDB\Laravel\Query\Builder::timeout()`

      Laravel:

      ```php

      public function timeout(?int $seconds): static
      {
          if ($seconds !== null && $seconds <= 0) {
              throw new InvalidArgumentException('Timeout must be greater than zero.');
          }
      
          $this->timeout = $seconds;
      
          return $this;
      }
      

      Mongo:

      public function timeout($seconds)
      {
          $this->timeout = $seconds;
      
          return $this;
      }
      

      Steps to reproduce

      1. `composer update` with `"laravel/framework": "^12.51",`
      2. Error should produce
      3. `composer update` with `"laravel/framework": "12.50",`
      3. Error goes away with downgrade

      Expected behaviour

      No conflict

      Actual behaviour

      The following error is received:

      [2026-02-10 19:15:47] local.ERROR: Declaration of MongoDB\Laravel\Query\Builder::timeout($seconds) must be compatible with Illuminate\Database\Query\Builder::timeout(?int $seconds): static
      

            Assignee:
            Jérôme Tamarelle
            Reporter:
            TPM Jira Automations Bot
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: