Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116106 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 45930 invoked from network); 20 Sep 2021 09:27:30 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 20 Sep 2021 09:27:30 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B344E1804C0 for ; Mon, 20 Sep 2021 03:08:09 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-oi1-f177.google.com (mail-oi1-f177.google.com [209.85.167.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 20 Sep 2021 03:08:09 -0700 (PDT) Received: by mail-oi1-f177.google.com with SMTP id n78so10739462oig.6 for ; Mon, 20 Sep 2021 03:08:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xaiVezPV32+X7hLYcb6u7FwoK1f9jELpkprFjilM1oY=; b=aLxHIQ8LX3Uu6JVgK0Zylo8DShRgX3E8ltPZ2+ts6UnMcF7PxWtxhFGVJ51kvTmW83 IBraPYNa7w7tZdqdrXkwoPKl21v4fSHcfo+unVpwjTIFP8M/K7pZLIiz6E92HV/+oJhw D6mzXkeYa/m2fvZzKfqT5ZskkRZewD0DIy3TiOqFG9nAEuPT4ct1Z7AI7LBbi7CsOOtg 8rJFO5h4pInN6Gyph3IiT3tsifrTyVnTPmsG2gKEwsVowGhJ0L3h8juaFyVGOD+q0AkZ 9/tTn0JBDL49xuzQ7udKn0ZVSxcdGKd+xZmn2zbN47tG6YA3GWwLGFj3wxBP3xoV5KC1 wxKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xaiVezPV32+X7hLYcb6u7FwoK1f9jELpkprFjilM1oY=; b=e+HJ3zhfXGley9gfESJpNN0lkxQeAfrKhJg+Hhu+TGMQ/TnDlY9tUDB+DKCQYmDQEu j3OufDkF+3NnZphUOVpYXVSDGPHJMHnW75h+61ofBwI6jxpJ+gNFvUn0aA9jpeE1bQuc aI1crG7n+SNcnvcaUS+FrkVqbEZYEEJrbl3/aAoBfQARljT/uzXD4bvUE5IPFONyhrhr P0+VoaX4QYtHrr9wZnMcaGCEcQgzC+O/f22XOl4YYvTCK2JSSszq89ifGoWk0QCirg2U KWRZJpxBQ8zBFD1e34mxCsx/TJvTLk7JC05WVBgsI2FVs5UkNoncglJmfxUbgqKuZhRO BTUQ== X-Gm-Message-State: AOAM531frTMbduYYQW+9fdTgqChQbyos4DchVvZ+HP2QNWwGYhX3gqjJ OGHMLwR6F7Yes8fUPwm0lYjTbLB6Z+knWXhKzAM= X-Google-Smtp-Source: ABdhPJwg87p0EHcqWIMEPXKJFd6N8EToI0CbyegkK/xMt3mbE1DujaOzkyqvTLpM63zy449rDtNcv+jQSJ5sDhsjiJ8= X-Received: by 2002:aca:318b:: with SMTP id x133mr3196918oix.143.1632132488386; Mon, 20 Sep 2021 03:08:08 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 20 Sep 2021 12:07:57 +0200 Message-ID: To: Eugene Sidelnyk Cc: tyson andre , PHP Internals Content-Type: multipart/alternative; boundary="000000000000325e7705cc6a759b" Subject: Re: [PHP-DEV] Proposal: Adding an ARRAY_FILTER_REINDEX flag to array_values From: ocramius@gmail.com (Marco Pivetta) --000000000000325e7705cc6a759b Content-Type: text/plain; charset="UTF-8" On Mon, Sep 20, 2021 at 12:02 PM Eugene Sidelnyk wrote: > From my experience it is not that easy to locate bug like this. > Heyo, just a tip for you (and others in this thread), but if you use `vimeo/psalm` and declare a `list` for a type, then `array_filter()` that are missing an `array_values()` around it will be caught :) ```php /** @return list */ function foo(array $input): array { return array_filter($input); } ``` Will produce: ``` INFO: MixedReturnTypeCoercion - 5:12 - The type 'array' is more general than the declared return type 'list' for foo ``` See https://psalm.dev/r/f9c51f72c2 Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ --000000000000325e7705cc6a759b--