Re: [PHP-DEV] [RFC] class_name:namespace

2021-02-26 Thread Manuel Canga
En vie, 26 feb 2021 14:40:03 +0100 Guilliam Xavier escribió > Hi, > > For that example (and most others), you're manipulating file paths anyway, > and assume that the FQCN is at least one level deep (i.e. not top-level), > so you may as well start with `$p = str_replace('\\',

Re: [PHP-DEV] RFC: PDO MySQL get warning count

2021-02-26 Thread Claude Pache
> Le 26 févr. 2021 à 17:45, Daniel Beardsley a écrit : > > Hi, > > I've gotten very little feedback on the "should I make an RFC about this?" > question, so I went ahead and made an RFC: > https://wiki.php.net/rfc/pdo-mysql-get-warning-count > > This is about a feature in an open pull request

[PHP-DEV] RFC: PDO MySQL get warning count

2021-02-26 Thread Daniel Beardsley
Hi, I've gotten very little feedback on the "should I make an RFC about this?" question, so I went ahead and made an RFC: https://wiki.php.net/rfc/pdo-mysql-get-warning-count This is about a feature in an open pull request: https://github.com/php/php-src/pull/6677 which addresses an open issue in

Re: [PHP-DEV] [RFC] class_name:namespace

2021-02-26 Thread Guilliam Xavier
On Fri, Feb 26, 2021 at 12:36 PM Manuel Canga wrote: > > > > Hi, > > > > Note that (typos aside) this example cannot work as-is, because > `static::namespace` (like `static::class`) cannot be resolved at > compile-time, and therefore cannot be assigned to a constant. > > > > More generally,

Re: [PHP-DEV] [RFC] Namespaced in bundled extensions

2021-02-26 Thread Pierre
Le 25/02/2021 à 21:26, Nikita Popov a écrit : Hi internals, The question of namespaces in the stdlib has been coming up a lot recently, so I'd like to present my own stab at resolving this question: https://wiki.php.net/rfc/namespaces_in_bundled_extensions Relative to a number of previous (dec

Re: [PHP-DEV] [RFC] class_name:namespace

2021-02-26 Thread Manuel Canga
En vie, 26 feb 2021 13:25:30 +0100 Michał Marcin Brzuchalski escribió > Personally, none of the above examples is convincing bc I'd implement them > using a fixed class names map to avoid loading untrusted classes. > Any kind of helper class is something I'd personally not use to a

Re: [PHP-DEV] [RFC] Namespaced in bundled extensions

2021-02-26 Thread Benjamin Morel
> > Maybe off-topic, but I don't think you could "fix" them: > for array_map, the array is variadic-like, so must be last; > for array_filter, the callback is optional, so must be after the array. > (Correct me if I'm wrong.) > > -- > Guilliam Xavier > Good point. Then that would be an opportunity

Re: [PHP-DEV] [RFC] class_name:namespace

2021-02-26 Thread Michał Marcin Brzuchalski
Hi Manuel, pt., 26 lut 2021 o 09:17 Manuel Canga napisał(a): > Hello, another example with "factories method"[1]: > > ```php > use MyProject\Framework; > > abstract class AbstractController { > private const HELPER_PATH = static::namespace.'/Helpers'; > private const SERVICE_PATH = stati

Re: [PHP-DEV] [RFC] class_name:namespace

2021-02-26 Thread Manuel Canga
> > Hi, > > Note that (typos aside) this example cannot work as-is, because > `static::namespace` (like `static::class`) cannot be resolved at > compile-time, and therefore cannot be assigned to a constant. > > More generally, in the various examples you provided, the namespace is not

Re: [PHP-DEV] [RFC] class_name:namespace

2021-02-26 Thread Claude Pache
> Le 26 févr. 2021 à 09:16, Manuel Canga a écrit : > > Hello, another example with "factories method"[1]: > > ```php > use MyProject\Framework; > > abstract class AbstractController { > private const HELPER_PATH = static::namespace.'/Helpers'; > private const SERVICE_PATH = static::namespa

Re: [PHP-DEV] [RFC] Namespaced in bundled extensions

2021-02-26 Thread Guilliam Xavier
On Fri, Feb 26, 2021 at 12:18 PM Benjamin Morel wrote: > Thank you for this RFC, Nikita. This is a necessary first step in the right > direction. > > Even though this is out of scope for this RFC, I hope that moving standard > functions to namespaces will be an opportunity to fix inconsistencies

Re: [PHP-DEV] [RFC] class_name:namespace

2021-02-26 Thread Manuel Canga
En vie, 26 feb 2021 11:08:33 +0100 Glash Gnome escribió > Hola Manuel, > "Don't you think the same ?" > I was thinking of something more generi, maybe : > ``` > namespace Foo\Bar; > > class A { > static function getNamespace() { > static $ns = __NAMESPACE__;//

Re: [PHP-DEV] [RFC] Namespaced in bundled extensions

2021-02-26 Thread Benjamin Morel
Thank you for this RFC, Nikita. This is a necessary first step in the right direction. Even though this is out of scope for this RFC, I hope that moving standard functions to namespaces will be an opportunity to fix inconsistencies in parameter order, like: array_map($callback, array) array_filte

Re: [PHP-DEV] [RFC] class_name:namespace

2021-02-26 Thread Glash Gnome
Hola Manuel, "Don't you think the same ?" I was thinking of something more generi, maybe : ``` namespace Foo\Bar; class A { static function getNamespace() { static $ns = __NAMESPACE__;// https://wiki.php.net/rfc/static_variable_inheritance return $ns; } } namespace My\

Re: [PHP-DEV] [RFC] class_name:namespace

2021-02-26 Thread Manuel Canga
I'm Sorry, I feel a little nervous by writing here again after long time. Replace '/' by '\' and PATH( HELPER_PATH | SERVICE_PATH ) by NAMESPACE( HELPER_NAMESPACE | SERVICE_NAMESPACE ). Sorry En vie, 26 feb 2021 09:16:18 +0100 Manuel Canga escribió > Hello, another example

Re: [PHP-DEV] [RFC] class_name:namespace

2021-02-26 Thread Manuel Canga
Hello, another example with "factories method"[1]: ```php use MyProject\Framework; abstract class AbstractController { private const HELPER_PATH = static::namespace.'/Helpers'; private const SERVICE_PATH = static::namespace.'/Services'; public function instanceHelper( string $helper

Re: [PHP-DEV] [RFC] class_name:namespace

2021-02-26 Thread Pierre
Le 25/02/2021 à 21:41, Nikita Popov a écrit : Could you please share the use case(s) you have in mind for this? Regards, Nikita Hello, I don't have a concrete example in mind right now, it happens I do need this sometime. It's mitigated by the fact I need it in most case when accessing cla