I was just looking into C# attributes at the time since I had used them
in the past.
It was a loose translation to something for php from the example on this
page:
http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.stringlengthattribute.aspx
In essence the example would be something along the lines of "$s must be
a string with length exactly 4 and if not, trigger_error() with the
given error message and error level.
One of the beautiful things about the C# way of attributes is that they
can be user-defined, so long as they are written to the API for C#
Attributes.
A similar type of thing could occur for PHP, the recent use case of
Nullable for Type Hints would be a great use of such attributes, but
there are dozens of other uses for them, especially if implemented in a
way similar to C#.
On 1/9/2013 10:42 AM, Stas Malyshev wrote:
Hi!
class a {
[php:Param($s) = StringLength(4, ErrorMessage='Parameter $s length
cannnot exceed 4.', ErrorLevel=E_USER_ERROR)]
public function foo($s) { ... ]
}
What this is supposed to do?
--
-Clint
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php