Le 23/04/2013 23:01, Pierrick Charron a écrit :
> Commit:b79e65f268d8f368a1088313735eda3ca485fa53
> Author:Pierrick Charron Tue, 23 Apr 2013
> 17:01:17 -0400
> Parents: 758b666c0ad6edb48274858d2e11c53460787b88
> Branches: PHP-5.5
>
> Link:
> http://git.php.net/?p=php-sr
Hi,
I guess it would work like an inline type-hint.
Something along the lines of:
$circle = ShapeFactory::createShape('circle');
if (!$circle instanceof Circle)
{
throw …;
}
I would like something like this, since it saves quite some code.
Cheers
Jannik
Am Mittwoch, 24. April 2013 um 1
Frankly, a magic method sounds like a much better solution than
auto-magically converting objects to arrays.
The problem with automatic conversion, is that the order of properties is
an implementation detail - the vsprintf() example perfectly illustrates the
problem:
class User
{
public $firs
Well, since I was the one who posted it
(https://twitter.com/ralphschindler/status/327084619507855361), I'll
further explain it. I realized it was doing this when actually running
this kind of snippet:
http://3v4l.org/ZkE6B
I must have left the public in there when I posted it to twitter. I
Hi!
> Are there any plans to add object type casting support in PHP?
>
> For example:
> $circle = (Circle) ShapeFactory::createShape('circle');
> $circle->radius = 10;
> echo $circle->getArea();
What is this supposed to do? I.e. what createShape returns and what
(Circle) operator is doing to it
There are no concrete plans no.
Object casting is typically available to please the static type checker.
This concern does not exist in PHP since types are checked at runtime. So
my first question would be: Why do you need it ?
Other questions include: what would it do for up-casting, down-casti
I suppose your cast is a conversion. Otherwise it is not needed at all
because PHP has no types.
-Ursprüngliche Nachricht-
Von: Raymond Irving [mailto:xwis...@gmail.com]
Gesendet: Mittwoch, 24. April 2013 17:40
An: PHP Internals
Betreff: [PHP-DEV] Object Type Casting
Hello,
Are there a
Hello,
Are there any plans to add object type casting support in PHP?
For example:
$circle = (Circle) ShapeFactory::createShape('circle');
$circle->radius = 10;
echo $circle->getArea();
It would be great if this feature could be added to 5.5 :)
__
Raymond Irving
Richard,
Oh! Another magic method opportunity ...
>
> /**
> * Operates just like __toString(), but returns an array.
> */
> public function __toArray();
>
>
> (ducking)
I know you're joking, but this has been brought up before (and I intend to
bring it up again): https://wiki.php.net/rfc/obje
On 24 April 2013 17:31, Richard Bradley wrote:
> > -Original Message-
> > From: Rasmus Schultz [mailto:ras...@mindplay.dk]
> > Sent: 24 April 2013 16:45
> > To: PHP internals
> > Subject: [PHP-DEV] vsprintf()
> >
> > This is all kinds of wrong:
> >
> > http://3v4l.org/UZFME
> >
> > So the
> -Original Message-
> From: Rasmus Schultz [mailto:ras...@mindplay.dk]
> Sent: 24 April 2013 16:45
> To: PHP internals
> Subject: [PHP-DEV] vsprintf()
>
> This is all kinds of wrong:
>
> http://3v4l.org/UZFME
>
> So the order in which the properties were defined is the magic that makes
>
On Wed, 2013-04-24 at 11:45 -0400, Rasmus Schultz wrote:
> This is all kinds of wrong:
>
> http://3v4l.org/UZFME
>
> So the order in which the properties were defined is the magic that makes
> this work.
>
> Wow. WTF?
>
> Do I need to explain in detail why this is all kinds of effed up?
vsprin
On Wed, Apr 24, 2013 at 9:45 AM, Rasmus Schultz wrote:
>
> Do I need to explain in detail why this is all kinds of effed up?
>
>
Yes, I'd like that explanation.
This is all kinds of wrong:
http://3v4l.org/UZFME
So the order in which the properties were defined is the magic that makes
this work.
Wow. WTF?
Do I need to explain in detail why this is all kinds of effed up?
- Rasmus Schultz
Still seeing this :
.
.
.
checking for bison version... (cached) invalid
configure: WARNING: bison versions supported for regeneration of the Zend/PHP
parsers: 1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3 2.5 2.5.1
2.6 2.6.1 2.6.2 (found: none).
.
.
.
However :
node002 $ which
Hi Sarah,
Hi Ben,
ext/standard/tests/array/array_column_object_cast.phpt is failing on
PHP-5.5. I bisected to:
1a03bd5dee97a0f8b9e74b7f8db5231abd8cc7e4 is the first bad commit
commit 1a03bd5dee97a0f8b9e74b7f8db5231abd8cc7e4
Author: Sara Golemon
Date: Mon Apr 22 14:57:05 2013 -0700
Allow a
Le 24/04/2013 08:15, Martin Keckeis a écrit :
Hello together,
if you got a namespace with more than one functions, why not just create a
container class and make the methods static?
I know it's not exactly the same, but how many times you need this
So you can write:
namespace Abc\Def;
clas
On Wed, Apr 24, 2013 at 10:54 AM, Florian Anderiasch
wrote:
> Additionally, it's either semantically wrong to group unrelated
> functions in "static tool classes", it's even a well-known antipattern.
It also doesn't address a point made by Igor before:
"It's distracting to have my vendor name
On 04/24/2013 08:15 AM, Martin Keckeis wrote:
> class Something{
> public static function blubb();
>
> public static function blubb2();
> }
>
>
> use Abc\Def\Something;
>
> Something::blubb();
> Something::blubb2();
Yes of course you can do that as an ugly workaround - but I wouldn't
c
19 matches
Mail list logo