Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module PS4 : $namespace of constructor must be a string #12

Open
jerrywham opened this issue Feb 25, 2023 · 1 comment
Open

Module PS4 : $namespace of constructor must be a string #12

jerrywham opened this issue Feb 25, 2023 · 1 comment

Comments

@jerrywham
Copy link

Actually, by default it is null :

	public function __construct($baseDir, $namespace = null) {

but it must be a string because of trim function :

		$this->namespace = trim($namespace, '\\');

So constructor must be defined by :

	public function __construct($baseDir, $namespace = '') {
@garrettw
Copy link

garrettw commented Mar 1, 2023

Have you tried adding a string typehint to the constructor param? Or replacing the whole param with just ?string $namespace?
Also you probably shouldn't be trimming $namespace without first checking that it's not null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants