# request priviledges to create an RFC or at least submit a suggestion

- Thread: https://externals.io/message/85883
- Original archive: https://news-web.php.net/php.internals/85883
- Started by Dmitri Goosens on 2015-04-22T08:41:59+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #85883 — Dmitri Goosens — 2015-04-22T08:41:59+00:00

URL: https://externals.io/message/85883#85883

Hi PHP-fellows
or whoever reads this…

I’m a Belgian PHP addict and feel I’ve got a suggestion that might be of
interest for PHP7.
I’d more than glad to write it down completely in an RFC if you grant me
access, otherwise, maybe someone can do it.
My username is *dgoosens*.

I feel, a natural evolution of the scalar type hinting would be the
possibility to type hint arrays as well…
That means, not the array itself, obviously, but the items that are in the
array.

Right now we have

array $foo = array();

What I’d like to see is something like this:

string[] $foo = array(); // an array that can only contain
stringsarray[string[]] $foo = array(); // an array that can only
contain arrays that contain stringsBar[] $foo = array(); // an array
that can only contain instances of Bar

There probably are some side effects to this and maybe I’m not aware enough
about PHP’s internals, but I think this implementation would have a series
of benefits…

*1. function attributes type hinting*

public function bar(string[] $foo = array()){
    /*    No need to validate the data in $foo as we already know that
it will only contain strings    */}

*2. class attributes*

class foo
{
    public $foo = string[];
}
$bar = new foo();$bar->foo[] = 'only strings are allowed here';

etc. etc.

I feel this would be a very nice improvement in PHP…

Thanks

dgoosens

---

## #85897 — Christoph Becker — 2015-04-22T11:51:52+00:00

URL: https://externals.io/message/85883#85897 · In reply to: #85883

Dmitri Goosens wrote:

> I’m a Belgian PHP addict and feel I’ve got a suggestion that might be of
> interest for PHP7.
> I’d more than glad to write it down completely in an RFC if you grant me
> access, otherwise, maybe someone can do it.

Information about creating an RFC can be found on

  <https://wiki.php.net/rfc/howto>

> My username is *dgoosens*.

If you already have registered with that name for a Wiki account, one of
the admins would have to approve it.  Otherwise you'd have to register
yourself at first.

> I feel, a natural evolution of the scalar type hinting would be the
> possibility to type hint arrays as well…
> That means, not the array itself, obviously, but the items that are in the
> array.

Note that there has been a related RFC a while ago, which has been
declined: <https://wiki.php.net/rfc/arrayof>.  It might be a good idea
to read the respective mailing list discussion:


<http://grokbase.com/t/php/php-internals/141f1kzdm8/introducing-array-of-rfc>

-- 
Christoph M. Becker

---

## #85898 — Dmitri Goosens — 2015-04-22T11:57:48+00:00

URL: https://externals.io/message/85883#85898 · In reply to: #85897

Thanks a lot Christoph
Vielen Dank !




> Dmitri Goosens wrote:
>
> > […]
>
> Information about creating an RFC can be found on
>
>   <https://wiki.php.net/rfc/howto>
>
> > […]
>
> If you already have registered with that name for a Wiki account, one of
> the admins would have to approve it.  Otherwise you'd have to register
> yourself at first.
>
> > […]
> the
> > […]
>
> Note that there has been a related RFC a while ago, which has been
> declined: <https://wiki.php.net/rfc/arrayof>.  It might be a good idea
> to read the respective mailing list discussion:
>
>
> <
> http://grokbase.com/t/php/php-internals/141f1kzdm8/introducing-array-of-rfc
> > […]
>
> --
> Christoph M. Becker
