Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95642 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34151 invoked from network); 5 Sep 2016 12:45:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Sep 2016 12:45:23 -0000 Authentication-Results: pb1.pair.com smtp.mail=nicolas.grekas@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nicolas.grekas@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.41 as permitted sender) X-PHP-List-Original-Sender: nicolas.grekas@gmail.com X-Host-Fingerprint: 74.125.82.41 mail-wm0-f41.google.com Received: from [74.125.82.41] ([74.125.82.41:38567] helo=mail-wm0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 17/0E-45301-0E86DC75 for ; Mon, 05 Sep 2016 08:45:23 -0400 Received: by mail-wm0-f41.google.com with SMTP id 1so137362685wmz.1 for ; Mon, 05 Sep 2016 05:45:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=L4+0Xd39cYywDafmyc1eJN8BRuqyThrT4nXyOIMg1aY=; b=rMJmZLVCuxMGmhehuG4zfyT8mn0ceYqdl978UtSFqRMJwaXriaowcGkIDWYUZqvupR vTYr59VYIDjUpDaRwBsIo4EXp80JeDWAGHz62qdgFzNWxe5IQMGM7pQkU0cSWv9Q3gQk avANOrVsFFEpwSRXyYYYITTirNERquOuMSV3Nq/cIdp4jHOdqXDOMUWrvmzpyIFI0MQw LMPU4GxUF4ubhGBD1MKi/8RmQBPJci28tebG03CHgMikOxXPj6/0vKy6FRQvPgIw9lyK hvO+aAuWVoLUSYhAiRmGJ10EoraYOZEIu5JCNAarUZUymNw2q8sKuh/F+WYM0VhLosf5 U9VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=L4+0Xd39cYywDafmyc1eJN8BRuqyThrT4nXyOIMg1aY=; b=K+ivKy7l7hUAuSvBc9n9Qw9fX5FQBt63e6ZnA6FqkhqFLuNfuFR+Bjcaxo0Cenp4Ik rj71+FX+bnWtAHk2u7+TCfcU6ssORFZ9JS4kj6M/+OiNyCzTnnEx8oni7qi/3cABnnh1 dPFLsmWBse4tbZ1R7/V2EzGYi/xs7K7IgLHrj7NUroIdKcTWfWAvYoXRsWXgY1XkKcBl AFaDaupUyi3QPvGxmvvFfZALkHQB/5zkaiZqc5f9j/MFFO/FZH27RQIxm62a8jXt1wJ+ qgtohm6pN4KBDjRwnIjBTNBM8gUNGGMO+th7snVNwJ4zNEMDis5wSSpmggoC5OkCEBKa nsbA== X-Gm-Message-State: AE9vXwMiftj0s1AMDjjG74/ZVfP230sVxE566obqUkkkrwbPsoDMgeD0aoVRI5aQS6BeWZftjii9uN2Bk54h9w== X-Received: by 10.194.175.170 with SMTP id cb10mr34355631wjc.17.1473079517371; Mon, 05 Sep 2016 05:45:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.234.105 with HTTP; Mon, 5 Sep 2016 05:44:56 -0700 (PDT) In-Reply-To: References: Date: Mon, 5 Sep 2016 14:44:56 +0200 Message-ID: To: Julien Pauli Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=089e013d18a85be54e053bc20d73 Subject: Re: [PHP-DEV] Missing reflection info about strict types? From: nicolas.grekas@gmail.com (Nicolas Grekas) --089e013d18a85be54e053bc20d73 Content-Type: text/plain; charset=UTF-8 Thanks for trying Julien I guess what you miss for what you want to do, is to detect if strict > types are activated into the current scope, at runtime. > From the inside, the author of the code knows if they added the declare or not. I'd need to know from the outside, before concatenating it, if some file has strict types. This could be exposed on the reflection, since a function/method/class could have a flag that tells if it has been compiled with strict types enabled or not. The current alternative is to parse the source to check if it starts with the declare directive (but not trivial because of non semantic tokens). Here is my current regex to do so: > $c = '(?:\s*+(?:(?:#|//)[^\n]*+\n|/\*(?:(? $strictTypesRegex = str_replace('.', $c, "'^<\?php\s.declare.\(.strict_ types.=.1.\).;'is"); Nicolas --089e013d18a85be54e053bc20d73--