Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105971 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 23740 invoked from network); 18 Jun 2019 19:55:44 -0000 Received: from unknown (HELO mail-pg1-f175.google.com) (209.85.215.175) by pb1.pair.com with SMTP; 18 Jun 2019 19:55:44 -0000 Received: by mail-pg1-f175.google.com with SMTP id l19so8013345pgh.9 for ; Tue, 18 Jun 2019 10:10:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=basereality-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=G5Zwk6IkbYdE2NVWQLDq+O8iaM+jaGdGI0vMI5SI0Uk=; b=o/+SI4MgIdPQQadKV145Kx1IyIHRBwGkeVr8uYsVbgs4cS9Vt3IOseJ5leJc73UTFk sVXmyvJmDoBuYB1dH+VFsIhWQ6j6OMJVgWt6pyqFRF/Sge1jSRIIVYcNCJYDXW1uEGZ1 /AboQVVGrTqEEotNG3O3vTA7vTqMCl2kObGJR3LzMCbyM45H+6EU9OfKfwcc3p2yQRWA gtUsVeOqlirHBJ2iT7wrUHP7A0Eh+Xs40NM8oHvOCMA6x2b+3CjBMoqRIx6Oe7pGX/ma KKFsF69+80a6fB0K+W1J/ANI5RC+6cWUjjmxMWBRyUMrDecm+q27HZ6AVHq1UpvueWte 0y7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=G5Zwk6IkbYdE2NVWQLDq+O8iaM+jaGdGI0vMI5SI0Uk=; b=bi8VHsZ3X0K+ogrFrE7/VR4zWc86W2oCPQZl8hOWcGH6uDvYg71i+ZbY4sCfifxI97 W6SpgdN7rN2iqtp5OhyhqKhChGv/ZtxAiVUFx4XuNhbY1WyHm1/EVcEBtFmWOu9IeXk/ 6cuIgcr5p+w4cUf4GW2xEBsWWGxDM9k4ASSPuh3TOKNDkl5phGXmogozaiNy5uIWIn39 pIyxVqPXW2Hvb3/ymyyrJpUii9zDXr5I8JPxuE+ka+ghsbzLRN2Q2Wut36tZgM4ZIVoJ nnI1L2BHdBkTKSPgtv7Cgq3UiIQ8lKMXCwsiUKK0v8c5uKEjHEIq4Sqv866PNa0cCIFl /hGg== X-Gm-Message-State: APjAAAWMYPUhCxe9v7hcgZ671Q6SaGeiOAdczaOMr9k0EBhg/Okex7Nh UDPZNFVMBj0mQUDotuaqxsk6dH6DGCX5+3WKF0Lq0w== X-Google-Smtp-Source: APXvYqw1NfLOK4toQ/2F4yJtJNfXt5dnguhrVI7FyAnzTds1iwfnVKGpeYfHZbhUm2JgkuPn5Cxk4JYMIk07vWndRsk= X-Received: by 2002:a17:90a:b78b:: with SMTP id m11mr6375517pjr.106.1560877810203; Tue, 18 Jun 2019 10:10:10 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 18 Jun 2019 18:09:59 +0100 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Generating arginfo from stub files From: Danack@basereality.com (Dan Ackroyd) On Tue, 18 Jun 2019 at 16:10, Nikita Popov wrote: > Rather than writing this out by hand, I would like arginfo structures to be > generated from PHP stub files that contain definitions like this: > > What do you think about providing this mechanism? Sounds good. But also, it's really a shame we don't have the union types RFC passed yet, as it means that the return type for a significant number of functions will be either incomplete or misleading. strpos(string $haystack, $needle, int $offset = 0) This is incomplete as the return isn't specified. strpos(string $haystack, $needle, int $offset = 0) : int This is misleading as it can return false; strpos(string $haystack, $needle, int $offset = 0): int|false Yay!, tools like PhpStan or Psalm can use this info, and don't need to maintain their own info for internal functions. Having the 'mixed' type would also be useful here, as there will almost always be some things that can't be expressed in a type system, and being able to use mixed shows that the type wasn't forgotten about, it just can be expressed currently. cheers Dan Ack https://wiki.php.net/rfc/union_types https://wiki.php.net/rfc/mixed-typehint