Deprecation: #107537 - TYPO3\CMS\Core\Utility\PathUtility::getPublicResourceWebPath 

See forge#107537

Description 

The static method PathUtility::getPublicResourceWebPath($extResource) was marked internal since it was introduced. Since there weren't good alternatives to this API, it is not removed but deprecated first before it will be removed with TYPO3 v15

Impact and affected installations 

TYPO3 installations using PathUtility::getPublicResourceWebPath($extResource) will get a deprecation message for each call of this method.

Migration 

Use the System Resource API instead.

Before:

MyClass
public function renderUrl(string $extResource): string
{
    return PathUtility::getPublicResourceWebPath($extResource);
}
Copied!

After:

MyClass
public function __construct(
    private readonly SystemResourceFactory $systemResourceFactory,
    private readonly SystemResourcePublisherInterface $resourcePublisher,
) {}

public function renderUrl(string $resourceIdentifier, ServerRequestInterface $request): string
{
    $resource = $this->systemResourceFactory->createPublicResource($resourceIdentifier);
    return (string)$this->resourcePublisher->generateUri(
        $resource,
        $request,
        new UriGenerationOptions(absoluteUri: true),
    );
}
Copied!