note 116275 added to language.namespaces.fallback

From: Date: Thu, 04 Dec 2014 20:22:46 +0000
Subject: note 116275 added to language.namespaces.fallback
Groups: php.notes 
Request: Send a blank email to php-notes+get-201067@lists.php.net to get a copy of this message
You can use the fallback policy to provide mocks for built-in functions like time(). You therefore have to call those functions unqualified: <?php namespace foo; function time() { return 1234; } assert (1234 == time()); ?> However there's a restriction that you have to define the mock function before the first usage in the tested class method. This is documented in Bug #68541. You can find the mock library php-mock at GitHub. ---- Server IP: 72.52.91.14 Probable Submitter: 188.98.192.38 ---- Manual Page -- http://php.net/manual/en/language.namespaces.fallback.php Edit -- https://master.php.net/note/edit/116275 Del: integrated -- https://master.php.net/note/delete/116275/integrated Del: useless -- https://master.php.net/note/delete/116275/useless Del: bad code -- https://master.php.net/note/delete/116275/bad+code Del: spam -- https://master.php.net/note/delete/116275/spam Del: non-english -- https://master.php.net/note/delete/116275/non-english Del: in docs -- https://master.php.net/note/delete/116275/in+docs Del: other reasons-- https://master.php.net/note/delete/116275 Reject -- https://master.php.net/note/reject/116275 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#201067) next »