Re: [PHP-DEV] RFC: Add `println(string $data = ''): int`

2021-03-14 Thread Sara Golemon
On Sat, Mar 13, 2021 at 1:54 PM tyson andre wrote: > > I've created a new RFC https://wiki.php.net/rfc/println > This proposes adding a global function to PHP to > print a string followed by a unix newline (`\n`). > > This isn't solving any problem that anyone is actually having. Yes, that

Re: [PHP-DEV] RFC: Add `println(string $data = ''): int`

2021-03-14 Thread Hamza Ahmad
Hi, I have two questions regarding the RFC. 1. Why not provide an another optional attribute that allows to specify the end of line eliminator? 2. Why don't you configure Unix end of line in INI file? These additional steps will help users choose their favorite end of line for their projects. The

Re: [PHP-DEV] Built-in decorator attribute?

2021-03-14 Thread Peter Stalman
On Sun, Mar 14, 2021 at 6:34 PM Peter Stalman wrote: > Would it make sense to have both options? > 6) Multiple decorators on the same function? One problem with the wrapper pattern is that if you have multiple decorators then wouldn't that end up calling the function multiple times? Not so with

Re: [PHP-DEV] Built-in decorator attribute?

2021-03-14 Thread Peter Stalman
On Sun, Mar 14, 2021 at 5:34 AM David Gebler wrote: > Before and after hooks are a similar but slightly different implementation, > semantically, to what I was originally suggesting but may be the preferred > option. I think to be useful, you probably still need some way to choose > not to call

Re: [PHP-DEV] PDO::PARAM_INT and pgsql driver

2021-03-14 Thread David Gebler
The information you were given on StackOverflow is somewhat misleading, since it is referring to the behaviour of PDO::quote(), not anything to do with binding parameters. The referenced bug report is indeed not a bug. Still, I don't really use Postgres but a quick smoke test indicates you're not

Re: [PHP-DEV] Inconsistency in enumerations RFC

2021-03-14 Thread Ilija Tovilo
Hi Marc Thanks for testing the enum feature. > Hi I'm trying out the new enumeration support for PHP 8.1 using > https://github.com/php/php-src/pull/6489 thought to implement a polyfill > based on class constants and reflection. Doing so I come across the > newly defined interfaces: > ```

Re: [PHP-DEV] [RFC Proposal] Allow methods to 'become' static

2021-03-14 Thread Rowan Tommins
On 14/03/2021 19:40, Matthew Brown wrote: It's maybe possible in the special case of implementing interfaces, but it's unsound for general inheritance: someInt; } } class B extends A { public static function getSomeInt() : int { return parent::getSomeInt(); } } Can

Re: [PHP-DEV] Built-in decorator attribute?

2021-03-14 Thread Marc
On 14.03.21 12:52, Benjamin Eberlei wrote: On Sat, Mar 13, 2021 at 5:51 PM David Gebler wrote: With the introduction of attributes in PHP 8, this new behaviour is still quite sparsely documented. Some of the articles I've seen out there, though, liken PHP's attributes to similar constructs

[PHP-DEV] Inconsistency in enumerations RFC

2021-03-14 Thread Marc
Hi I'm trying out the new enumeration support for PHP 8.1 using https://github.com/php/php-src/pull/6489 thought to implement a polyfill based on class constants and reflection. Doing so I come across the newly defined interfaces: ``` interface UnitEnum{ public string$name; public

[PHP-DEV] PDO::PARAM_INT and pgsql driver

2021-03-14 Thread Benjamin Morel
Hi internals, I just stumbled upon what I consider to be a bug with the PDO pgsql driver. *TL;DR: the driver treats parameters bound with PARAM_INT the same as PARAM_STR.* Take the following example: ``` $pdo = new PDO('pgsql:host=localhost;port=5432', 'postgres', 'postgres'); $statement =

Re: [PHP-DEV] [RFC Proposal] Allow methods to 'become' static

2021-03-14 Thread Matthew Brown
On Sun, 14 Mar 2021 at 12:02, Gert de Pagter wrote: > Hey Internals, > > Recently i've been working on an older code base, where we have a lot > of classes with all > static methods. We've been moving to injecting the classes, and > calling the methods as if they > were not static. > > I wanted

Re: [PHP-DEV] Built-in decorator attribute?

2021-03-14 Thread David Gebler
Python's implementation of decorators is great for these kinds of reasons. You get direct access to the function being called, the arguments which were passed to it and any return value after (and if) you execute it. Python's magic here, of course, is that functions and class methods are first

Re: [PHP-DEV] Built-in decorator attribute?

2021-03-14 Thread Larry Garfield
On Sun, Mar 14, 2021, at 7:33 AM, David Gebler wrote: > Hi Ben, > I have been looking at your #[Deprecated] PR to get an idea of where to > start with implementing this, I think Peter's suggestion of how it might > look syntactically is also interesting - it's exactly that sort of question > of

Re: [PHP-DEV] RFC: Add `println(string $data = ''): int`

2021-03-14 Thread Rowan Tommins
On 14/03/2021 15:52, tyson andre wrote: There's also the alias fputs ofhttps://www.php.net/manual/en/function.fwrite.php which also returns the byte count. Notably, like printf(), that is borrowed directly from C, and probably dates from a time when most PHP programmers were also C

[PHP-DEV] [RFC Proposal] Allow methods to 'become' static

2021-03-14 Thread Gert de Pagter
Hey Internals, Recently i've been working on an older code base, where we have a lot of classes with all static methods. We've been moving to injecting the classes, and calling the methods as if they were not static. I wanted to add interfaces to these classes, with non static methods, so we can

Re: [PHP-DEV] RFC: Add `println(string $data = ''): int`

2021-03-14 Thread tyson andre
Hi Rowan, > Hi Tyson, > > I'm on the fence on this one: I've certainly had occasions when it would > be useful, but mostly in quick prototypes and demo code, and just as > often in HTML context (where I'd want it to add '') as plain text > context. > > I am not keen, however, on the proposed

Re: [PHP-DEV] RFC: Add `println(string $data = ''): int`

2021-03-14 Thread Rowan Tommins
On 13/03/2021 19:54, tyson andre wrote: I've created a new RFC https://wiki.php.net/rfc/println This proposes adding a global function to PHP to print a string followed by a unix newline (`\n`). Hi Tyson, I'm on the fence on this one: I've certainly had occasions when it would be useful,

Re: [PHP-DEV] Built-in decorator attribute?

2021-03-14 Thread David Gebler
Hi Ben, I have been looking at your #[Deprecated] PR to get an idea of where to start with implementing this, I think Peter's suggestion of how it might look syntactically is also interesting - it's exactly that sort of question of how would you imagine devs implementing and using decorators in

Re: [PHP-DEV] Built-in decorator attribute?

2021-03-14 Thread Benjamin Eberlei
On Sat, Mar 13, 2021 at 5:51 PM David Gebler wrote: > With the introduction of attributes in PHP 8, this new behaviour is still > quite sparsely documented. Some of the articles I've seen out there, > though, liken PHP's attributes to similar constructs in other languages > including decorators

Re: [PHP-DEV] Built-in decorator attribute?

2021-03-14 Thread Peter Stalman
Hi again David, I've been thinking about this some more, it could be quite useful. I'd like to propose a bit more of a Attributes-y syntax: ``` start = microtime(true); // these could be made available $foo = $this->getObject(); $args = $this->getArguments(); // [$a,