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('\\',
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,
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
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
>
> 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
> 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
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__;//
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\
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
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
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
--
Manuel Canga
Zend Certified PHP Engineer
Websites: https://manuelcanga.dev | https://trasweb.net
Linkedin: https://es.linkedin.com/in/manuelcanga
En jue, 25 feb 2021 23:12:23 +0100 David Gebler
escribió
> You can achieve what you're trying to do already with a combination of
You can achieve what you're trying to do already with a combination of
get_class() on a namespaced class and a simple regex (or other method of
processing a string to your liking):
$foo = "My\\Namespace\\Name\\Class";
var_dump(preg_match('/^(.*)\\\([^\\\]*)$/m',$foo,$matches),$matches);
array(3)
En jue, 25 feb 2021 21:41:40 +0100 Nikita Popov
escribió
> On Thu, Feb 25, 2021 at 8:11 PM Manuel Canga wrote:
>
> > Hi internals,
> >
> > I would like to present a possible new RFC( "class_name:namespace" ) for
> > your consideration.
> >
> > As you know, namespaces are very
On Thu, Feb 25, 2021 at 8:11 PM Manuel Canga wrote:
> Hi internals,
>
> I would like to present a possible new RFC( "class_name:namespace" ) for
> your consideration.
>
> As you know, namespaces are very important nowdays. They are used in
> autoloaders, Frameworks, CMS, ...
>
> Maybe, you are us
Hi internals,
I would like to present a possible new RFC( "class_name:namespace" ) for your
consideration.
As you know, namespaces are very important nowdays. They are used in
autoloaders, Frameworks, CMS, ...
Maybe, you are used to code something similar to this:
```
use MyProject\MyHelpers
16 matches
Mail list logo