You cannot use “use” where you are using it.
The “use” keyword is either in front of a class definition to import other classes/interfaces/traits into it’s own namespace, or it is inside the class (but not inside a method) to add traits to the class.
<?php
namespace Foo;
use Different\Class; // use can go here
class Bar {
use TraitCode; // use can go here
public function baz() {
$this->traitFunction('etc');
// use CANNOT go here
}
}