DataTables / Editor-PHP

PHP server-side libraries for Editor
Other
35 stars 22 forks source link

Improve callable phpdocs #29

Closed mvorisek closed 11 months ago

AllanJard commented 11 months ago

Thank you - are you happy for this to be pulled in under the MIT license?

Also, I'm not sure if you saw, but the phoDocumentor issue with spread operators has been fixed, so I'll get the docs updated for that soon. I'm fully focused on the work for DataTables 2 at the moment, but when that drops I'll circle back to the phpstan issues highlighted before.

mvorisek commented 11 months ago

Thank you - are you happy for this to be pulled in under the MIT license?

yes, for all controbutions to this repo

Also, I'm not sure if you saw, but the phoDocumentor issue with spread operators has been fixed, so I'll get the docs updated for that soon. I'm fully focused on the work for DataTables 2 at the moment, but when that drops I'll circle back to the phpstan issues highlighted before.

Great, feel free to ping me on this PR once the CI is green, I will then make it green too. I don't need to hurry with these changes.

AllanJard commented 11 months ago

Thank you.

Note to self - before merge, I need to check the instanceof Closure. I've got a feeling I tried that originally and it caused some backwards compatibility issues. I can't recall exactly what, but I'll take a closer look before merging in.

mvorisek commented 11 months ago

Note to self - before merge, I need to check the instanceof Closure. I've got a feeling I tried that originally and it caused some backwards compatibility issues. I can't recall exactly what, but I'll take a closer look before merging in.

def:

Closure = native callable

callable = Closure type unioned with "callable like string" (ex: strlen) and "callable like array" (ex: ['DateTime', 'createFromFormat'])


This is documented in the 1st commit message to be equivalent, later, I replaced the checks in a few more places as the callbacks ends in Query::where, where ïs_callable && is_object was originally, ie. the behaviour is unchanged, or better said, the behaviour is fixed.

In general, accepting/checking for callable is dangerous, as if regular string or array type is accepted as well, it is impossible to tell if the "callable like string/array" is really a callable or string/array value.

mvorisek commented 11 months ago

@AllanJard can this PR be merged?

AllanJard commented 11 months ago

Yes, sorry - things very busy at the moment :). Thank you for this!