website/errors/new.internalClass.md
<?php declare(strict_types = 1);
namespace Vendor {
/** @internal */
class InternalHelper {}
}
namespace App {
$helper = new \Vendor\InternalHelper(); // error: Instantiation of internal class Vendor\InternalHelper.
}
The class being instantiated is marked as @internal, meaning it is not part of the package's public API. Internal classes may change or be removed in any release without following semantic versioning. Using them from outside the package creates fragile dependencies that can break without warning during updates.
Use the public API provided by the package instead of instantiating its internal classes directly.
namespace App {
- $helper = new \Vendor\InternalHelper();
+ $helper = \Vendor\HelperFactory::create();
}
If no public alternative exists, consider opening a feature request with the package maintainer.