Roave/BackwardCompatibilityCheck

Internal namespaces

weirdan opened this issue · 1 comments

In Psalm, we're using the Psalm\Internal namespace to designate all symbols under it as internal, instead of marking them with @internal. My understanding is that it's not something supported by this package.

I'd love some pointers on where I could start implementing this.

Endorsement: don't do it

IMO they should be marked as @internal (single pass over everything in your codebase - easy enough, and recognized by IDEs).

The fact that Psalm\Internal is for "internal" stuff is your own convention, which IMO shouldn't be generalized, as it endorses hiding stuff under the carpet, while it should live nearby public symbols sometimes (similar to the "Util" namespace in some projects :D ).

By marking them @internal, you also automatically get them to be picked up by vimeo/psalm itself, should somebody use them downstream (like terrible individuals do, i.e. @Ocramius).

Potential implementation (if you still want to do it)

It is still possible for you to customize this by introducing your own implementation of:

interface ClassBased
{
public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass): Changes;
}

And to add it to your own configuration (copy roave-backward-compatibility-check.php and adjust as needed) here:

new CompareClasses(
new ClassBased\SkipClassBasedErrors(new ClassBased\ExcludeAnonymousClasses(new ClassBased\ExcludeInternalClass(

Note that configuration is indeed done by overriding the .php file with your own (see discussion in #377).