Skip to content

SearchExtension: compatible with trait Nette\StaticClass #292

@h4kuna

Description

@h4kuna

Hello if I use trait Nette\StaticClass the extension Search automatically register the class like a service to container.

There are two ways:

  1. in trait Nette\StaticClass change visibility of constructor from final public to private. The ReflectionClass::isInstantiable will work fine. I prefer

  2. add exception for this trait to Search extension

I know if you have registered static classes, it doesn't matter, because these classes are not in constructors, but this is no reason to register in container.

Example of bad behavior:

namespace Uget;

use Nette\StaticClass;

final class Tools
{
	use StaticClass;
}

In Container i see

	public function createService017(): Uget\Tools
	{
		return new Uget\Tools; // throw exception
	}

I must add to ignore

search:
	exclude:
		classes:
			- Uget\Tools

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions