Improve return type of Query::raw() method called without argument

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Critical - P2
    • laravel-5.5.0
    • Affects Version/s: None
    • Component/s: Laravel
    • None
    • PHP Drivers
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      Developers of Laravel application writing raw aggregations, may expect the unaltered result, but the method {{Model::raw(callback) }}method applies transformations to the results.

      Developers should know that calling Model::raw() method will return a MongoDB\Collection instance.

      It's possible to use conditional return type feature of phpstan to indicate the return type depending on the input parameter.

      • MongoDB\Laravel\Eloquent\Builder::raw()
      • MongoDB\Laravel\Query\Builder::raw()

              Assignee:
              Pauline Vos
              Reporter:
              Jérôme Tamarelle
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: