Skip to content

Use generics to simplify extension #26

@b1rdex

Description

@b1rdex

This file can be included in phpstan config using stubFiles directive.

namespace yii\db {
    class ActiveRecord {
        /**
         * @phpstan-return ActiveQuery<static>
         */
        public static function find();
    }

    /**
     * @template T of ActiveRecord
     */
    class ActiveQuery {
        /**
         * @phpstan-return T[]
         */
        public function all($db = null);

        /**
         * @phpstan-return T|null
         */
        public function one($db = null);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions