Re: [PHP-DEV] RFC: Trait expects interface

2022-01-06 Thread Robert Korulczyk
In your use cases, are these traits generally *using* the interface methods, or *implementing* them? It is both. However "implementing" case is more problematic, since "using" can be quite reliably handled by adding `assert($this instanceof LoggerInterface)` or type hints in trait methods -

[PHP-DEV] RFC: Remove support for libmysql from mysqli

2022-01-06 Thread Kamil Tekiela
Hi Internals, Some time ago I wrote to the list asking if there are any objections to removing support for libmysql from mysqli. As I haven't heard any compelling arguments, I prepared a PR and RFC. https://wiki.php.net/rfc/mysqli_support_for_libmysql https://externals.io/message/116730 Regards

Re: [PHP-DEV] RFC: Trait expects interface

2022-01-06 Thread Rowan Tommins
On 6 January 2022 19:51:46 GMT, Robert Korulczyk wrote: >You're talking about classes that use traits, but I'm talking about traits >themselves. If I open a class in editor, there is a straightforward way to >check if specific method is implementation of an interface - check interfaces >impleme

Re: [PHP-DEV] RFC: Trait expects interface

2022-01-06 Thread Robert Korulczyk
Your other points make sense, but I don't think this one does - there are no implicit interfaces in PHP*, so all any tool cares about is: 1) Does the class declaration say that it implements an interface? 2) Does it actually contain the methods needed to do so, through any combination of direct

Re: [PHP-DEV] RFC: Trait expects interface

2022-01-06 Thread Rowan Tommins
On 6 January 2022 18:03:04 GMT, Chase Peeler wrote: >I think most people see the tools as black boxes to make THEIR lives >easier. They aren't concerned about whether it's added complexity to the >tool itself. Just to be clear, my comments were a response to an earlier message that explicitly t

[PHP-DEV] PHP 8.1.2RC1 Available for testing

2022-01-06 Thread Patrick ALLAERT
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 PHP 8.1.2RC1 has just been released and can be downloaded from: https://downloads.php.net/~carusogabriel/ Or use the git tag: php-8.1.2RC1 Windows binaries are available at https://windows.php.net/qa#php-8.1 Please test it carefully, and report a

Re: [PHP-DEV] RFC: Trait expects interface

2022-01-06 Thread Chase Peeler
On Thu, Jan 6, 2022 at 12:37 PM Alexandru Pătrănescu wrote: > On Thu, Jan 6, 2022 at 7:12 PM Rowan Tommins > wrote: > > > > > But some comments seem to be hinting at some *separate* advantage, to do > > with "correct usage" of the trait, which I haven't grasped. It's possible > > that the mentio

Re: [PHP-DEV] RFC: Trait expects interface

2022-01-06 Thread Rowan Tommins
On 6 January 2022 17:36:41 GMT, "Alexandru Pătrănescu" wrote: >Yes, traits are a language construct that has in general more negative >implications than positive so it's good to keep an eye on their usage. >One of the okish usages is to define some implementation for an interface >that classes ca

Re: [PHP-DEV] RFC: Trait expects interface

2022-01-06 Thread Alexandru Pătrănescu
On Thu, Jan 6, 2022 at 7:12 PM Rowan Tommins wrote: > > But some comments seem to be hinting at some *separate* advantage, to do > with "correct usage" of the trait, which I haven't grasped. It's possible > that the mention of static analysis relates to that in some way, and I'm > just completely

Re: [PHP-DEV] RFC: Trait expects interface

2022-01-06 Thread Rowan Tommins
On 6 January 2022 16:25:04 GMT, Chase Peeler wrote: > I think the advantage would come within the trait. If I say the trait >expects an interface with two methods, then the tool can act as if the >interfaces methods exist in the trait even if they aren't explicitly >defined. As others have pointed

Re: [PHP-DEV] RFC: Trait expects interface

2022-01-06 Thread Chase Peeler
On Thu, Jan 6, 2022 at 11:20 AM Rowan Tommins wrote: > On 6 January 2022 15:21:28 GMT, Robert Korulczyk > wrote: > > It should also make it easier for SCA tools to understand > >the code since they no longer need to know the whole project to > understand that method from trait is implementation

Re: [PHP-DEV] RFC: Trait expects interface

2022-01-06 Thread Rowan Tommins
On 6 January 2022 15:21:28 GMT, Robert Korulczyk wrote: > It should also make it easier for SCA tools to understand >the code since they no longer need to know the whole project to understand >that method from trait is implementation of method from interface (which is >really tricky right now s

Re: [PHP-DEV] RFC: Trait expects interface

2022-01-06 Thread Robert Korulczyk
> For point 1, we already have that. It's called abstract methods in traits. This is a solved problem that requires no further resolution. At best it would be a shorthand to copying a few methods from an interface into the trait and sticking "abstract" in front of them. I really don't see a ne

Re: [PHP-DEV] RFC: Trait expects interface

2022-01-06 Thread Chase Peeler
On Wed, Jan 5, 2022 at 6:05 PM Larry Garfield wrote: > On Wed, Jan 5, 2022, at 2:35 PM, Chase Peeler wrote: > > > First, I'm someone that mainly uses traits to implement the functionality > > defined in an interface. I think that's one of the best uses for them. > > However, I'm personally not a

[PHP-DEV] PHP 8.0.15RC1 Available for testing

2022-01-06 Thread Gabriel Caruso
PHP 8.0.15RC1 has just been released and can be downloaded from: https://downloads.php.net/~carusogabriel/ Or use the git tag: php-8.0.15RC1 Windows binaries are available at https://windows.php.net/qa#php-8.0 Please test it carefully, and report any bugs to http://github.com/php/php-src/issues

Re: [PHP-DEV] RFC: Stop to automatically cast numeric-string to int when using them as array-key

2022-01-06 Thread Rowan Tommins
On 6 January 2022 07:29:58 GMT, James Titcumb wrote: >Just thinking out loud, being able to identify an array type might be a way >forward here (using "syntax" already in use by static analysis tools in >docblocks, for familiarity), e.g. > >private array $property; > >This might "turn off" the aut

Re: [PHP-DEV] RFC: Stop to automatically cast numeric-string to int when using them as array-key

2022-01-06 Thread Arvids Godjuks
On Wed, 29 Dec 2021 at 17:42, Vincent Langlet wrote: > Hi, > > I recently discovered that an array was automatically casting > numeric-string keys to int if it was possible. For instance, the following > array: > > $a = ['01' => '01', '10' => '10']; > > Is not an array with the key '01' and '10'