I'm trying to test a function in phpspec which calls Laravel's Validator::make
function (http://laravel.com/docs/4.2/validation)
However, I'm trying to call that same function from a namespace where the Validator
class name is already taken. How can I call that function described in the docs?
Failed solutions:
Attempt 1
return \Illuminate\Validation\Validator::make($values,$rules);
gives me
Call to undefined method Illuminate\Validation\Validator::make()
Attempt 2
return \Illuminate\Validation\Factory::make($values,$rules);
gives me
Using $this when not in object context in /vendor/laravel/framework/src/Illuminate/Validation/Factory.php on line 92. Factory
Attempt 3
use \Validator;
gives me
Cannot declare class Isoform\Validator because the name is already in use
Attempt 4
use \Validator as DefaultValidator;
gives me
Class 'DefaultValidator' not found
\Validator::make($values, $rules)
. – NervineClass 'Validator' not found
– WhitefishDefaultValidator
come from? What if you also adduse \DefaultValidator
? – Sylphid