Opened 13 years ago

Closed 13 years ago

#577 closed enhancement (fixed)

Use type hinting in PHP bindings

Reported by: Olly Betts Owned by:
Priority: normal Milestone: 1.3.0
Component: Xapian-bindings (PHP) Version:
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Operating System: All

Description

PHP 5 supports "type hinting", which we could use in a number of places in the PHP bindings:

http://php.net/manual/en/language.oop5.typehinting.php

This would allow us to annotate the PHP method definitions to specify the type of object parameters (since 5.0) or that a parameter must be an array (since 5.1). There aren't many places where we accept arrays, so the latter isn't so useful, though for Xapian 1.3 we're only supporting PHP 5.2 and later anyway.

5.4 will add a "callable" type hint, which isn't so useful to us either.

Cases which are overloaded to take different object types would probably only get an Object hint, as it looks like only a single class can be specified. I'm not sure we have many of those.

If the argument has a default value of NULL, then NULL can be passed too. This would be needed in a few places, though I think most if not all already have a default value of NULL.

Change History (1)

comment:1 by Olly Betts, 13 years ago

Resolution: fixed
Status: newclosed

Added these (via a script to post-process the wrapper script which SWIG produces) in r16203.

Note: See TracTickets for help on using tickets.