Text_Password static or non-static?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Text_Password static or non-static?

Michael Gauthier
I'm making a PR to update the Text_Password package to explicitly state
static methods so it works properly in PHP 7. While updating, I noticed
the documentation and internal code seems to be written assuming the API
is entirely static but the unit tests are written assuming the API uses
class instances.

For example, the docs say to use:

Text_Password::create();

but the unit tests use:

$subject = new Text_Password();
$subject->create();

My question to the list is does anyone besides the unit tests use the
non-static API for Text_Password?

Cheers,
Mike

--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply | Threaded
Open this post in threaded view
|

Re: Text_Password static or non-static?

Christian Weiske
Hello Michael,


> I'm making a PR to update the Text_Password package to explicitly
> state static methods so it works properly in PHP 7. While updating, I
> noticed the documentation and internal code seems to be written
> assuming the API is entirely static but the unit tests are written
> assuming the API uses class instances.
>
> For example, the docs say to use:
>
> Text_Password::create();
>
> but the unit tests use:
>
> $subject = new Text_Password();
> $subject->create();
>
> My question to the list is does anyone besides the unit tests use the
> non-static API for Text_Password?
If $this is not used within Text_Password it's ok to make the methods
static.

--
Regards/Mit freundlichen Grüßen
Christian Weiske

-=≡ Geeking around in the name of science since 1982 ≡=-

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Text_Password static or non-static?

Martin Jansen
In reply to this post by Michael Gauthier
On 30.01.16 23:28, Michael Gauthier wrote:

> I'm making a PR to update the Text_Password package to explicitly state
> static methods so it works properly in PHP 7. While updating, I noticed
> the documentation and internal code seems to be written assuming the API
> is entirely static but the unit tests are written assuming the API uses
> class instances.
>
> For example, the docs say to use:
>
> Text_Password::create();
>
> but the unit tests use:
>
> $subject = new Text_Password();
> $subject->create();
>
> My question to the list is does anyone besides the unit tests use the
> non-static API for Text_Password?

Back when I wrote that code my intention was for the methods to be
called statically at all times. I'm not sure why the unit tests differ.
but I'd say that this is a bug.

That being said I'm extremely happy that you are working on Text_Password.

- Martin


--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php