logs archiveIRC Archive / Freenode / #php / 2015 / September / 3 / 3
__adrian
it doesn't really help you learn either
Blacklite
+1
bwoebi
I love abusing the php-src implementation :-D
carpii
true but some clients just want something basic, and if you quoted a professional price theyd end up not getting a site
gotta start somewhere
__adrian
if you can do something basic, and you're not undervaluing yourself with your affordable pricing, then it's cool
carpii
yeah true
Blacklite
ideally you'd be building something basic and charging less than usual, simply because it has less features/pages etc
__adrian
but if you can't do it, or you're devaluing yourself, then there's no point
TML
carpii: No
         

carpii
you dont agree?
ecart
tml
__adrian
it teaches you to work harder and be undervalued
ecart
http://viper-7.com/DixBEg
__adrian
and it teaches your client to abuse their next web guy
Pathfinder
__adrian: I didn't say I can't do it.... but I am sure you also have stuff that you don't know that you ask on forums and google...
TML
carpii: I am answering your question about 5.5 and asymmetric encryption
carpii
im not saying work for peanuts
oh TML, got it, thanks
Blacklite
lol
bwoebi
So& I just had that issue&
class ParentWithConstructor extends ParentWithConstructor { function __construct() {} }
class ChildWithoutConstructor extends ParentWithConstructor {}
And now I have a $refl = new ReflectionMethod('ChildWithoutConstructor', '__construct'); & how do I extract the string "ChildWithoutConstructor" back from $refl?
Pathfinder
And I know I am not undervaluing myself coz the main reason I am doing this is because I just want the experience .... hehe..I am still young and get money from my folks.. this would be a small bonus
TML
bwoebi: You have at least one typo in that example
__adrian
Pathfinder stuff i have to learn? all the time. but i don't take jobs if i don't know how i'm going to do things and am entirely confident i can learn timely and do properly.
ecart
i back, license!
carpii
pathfinder, i think valuing yourself is just a skill you have to learn in time. I undervalued myself for maybe 2 years with 2 diff clients, before i learnt to say no, and to stop being an idiot :)
bwoebi
TML: hm?
oh
one extends too much
carpii
ut its ok to give a discount for a job if you think it will benefit you
TML
you have a class extending itself
Pathfinder
__adrian: Meanwhile lemme work on this solution then hopefully I can get back to you when everything works .. hehe
TML
ecart: So what's the question?
         

Blacklite
IMO you should charge a decent rate + the number of hours you think it *should* take you to do the job. Then if you go over time, it's on you to improve. That way you portray yourself as a professional with a professional's rate, plus you get your opportunity to learn.
bwoebi
should be: class ParentWithConstructor { function __construct() {} }
Blacklite
but be realistic with deadlines to your client of course
and ofc only bill for what you quoted
bwoebi
TML: but that just was bad C&P ^^
TML
bwoebi: it obscured the intent of the question enough that I wasn't sure what you meant.
bwoebi
you get it now?
__adrian
ecart, let's clean that example up a bit... fake the form submission... http://viper-7.com/ngXG3b
now, explain what you *want* to happen
bwoebi
and the difficulty here obviously is that getDeclaringClass() and "class" property point all to ParentWithConstructor, but how do I now get ChildWithoutConstructor?
TML
bwoebi: I don't believe you can from Reflection
bwoebi
right& and hence it's fun to abuse it&
try {
$refl->getPrototype();
} catch (\ReflectionException $e) {
var_dump(substr(strstr($e->getMessage(), "::__construct", 1), 7));
}
I'm just wondering if I'm relying on a bug here or not&
TML
I certainly would not recommend you rely on that behaviour
at best it's undocumented and so liable to change without notice
__adrian
speaking as someone who spent the last two days tyring to implement a feature based on which exceptions were thrown, because there didn't seem to be a legit way to do it...
no
TML
bwoebi: at the end of the day, there is no such beast as ChildWithoutConstructor::__construct, so I'm not sure why you'd want to fake it existing
bwoebi
TML: actually, that a ReflectionException is thrown, is documented. But the text isn't&
TML
bwoebi: Right
I wasn't suggesting that the exception being thrown is undocumented
bwoebi
Though, that's never the case for an exception&
*exception message
But actually these things also never are changed without reason, in my experience.
__adrian
bwoebi because the messages are for humans reading logs.
the CODES are for programs
but good luck finding one that isn't just "1"
or "0", in this case
bwoebi
don't know& but how much are the codes actually used? ;-D
yes
__adrian
actually seems most of them are "0"
they all just extend Exception, which is code 0
bwoebi
exactly & and sometimes the value is also a bit random in case $previous is passed too.
__adrian
but i don't think your situation is a "bug" anyway. as TML points out, this is something that doesn't exist, so of course there's not a method for finding it.
TML
ecart: Did you figure out what your question is, yet?
bwoebi
The use case basically is printing in an exception that that class couldn't be instantiated
so, isn't too bad when it breaks& as it actually is the only way it works :s
but I'm sure I'll shake my head when reading that particular line of code again in a few months&
TML
bwoebi: Except the class most definitely CAN be instantiated: http://viper-7.com/iOB9uD
just quit going around the horn through ReflectionMethod to do so
bwoebi
ReflectionMethod is necessary to instantiate classes with private ctor :-/
at least for a generic use case
TML
Don't make private constructors
your way of using PHP just boggles my mind
__adrian
two pet peeves: private constructors, and abbreviating "constructor" as "ctor"
bwoebi
I don't use private ctors & but users of the lib do.
TML
you're writing code that has private constructors (which are specifically designed to STOP YOU from instantiating the class), and then violating that work by using RelfectionMethod to make an end-run around your own silly restriction?
__adrian
no! enabling others who want to do that
bwoebi
TML: use case: Dependency injector.
__adrian: yeah, constructor/destructor is abbreviated ctor/dtor in the whole php-src codebase. Hence&
__adrian
if you can't instantiate a class, it more-or-less shouldn't HAVE dependencies
bwoebi
also calling function class just "fcall"
__adrian
yes, i know about ctor/dtor
bwoebi
why's that a pet peeve of you then?
carpii
how much do you guys think people should obsess about adhering to PSR-*? Maybe for new projects, but are there any real benefits to shoehorning it into a legacy codebase?
__adrian
because i don't like it
carpii, php-fig is just people who have opininons and like writing them down. some ideas are good, some aren't necessarily useful at all
"opinions" above has too many "n"s but i'm too sleepy to figure out which one gets to boot
carpii
yeah i kinda agree, but more and more were seeing them being adopted anyway. which makes me wonder whether for longevity i should be too, regardless of whether i agree with them
« prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 next »