make class closure consist with PHP

See #3431