Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[AssetMapper] Deprecate unused method splitPackageNameAndFilePath #54125

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions UPGRADE-7.1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
UPGRADE FROM 7.0 to 7.1
=======================

AssetMapper
-----------

* Deprecate `ImportMapConfigReader::splitPackageNameAndFilePath()`, use `ImportMapEntry::splitPackageNameAndFilePath()` instead

Cache
-----

Expand Down
5 changes: 5 additions & 0 deletions src/Symfony/Component/AssetMapper/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

7.1
---

* Deprecate `ImportMapConfigReader::splitPackageNameAndFilePath()`, use `ImportMapEntry::splitPackageNameAndFilePath()` instead

6.4
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,13 @@ private function getRootDirectory(): string
return \dirname($this->importMapConfigPath);
}

/**
* @deprecated since Symfony 7.1, use ImportMapEntry::splitPackageNameAndFilePath() instead
*/
public static function splitPackageNameAndFilePath(string $packageName): array
{
trigger_deprecation('symfony/asset-mapper', '7.1', 'The method "%s()" is deprecated and will be removed in 8.0. Use ImportMapEntry::splitPackageNameAndFilePath() instead.', __METHOD__);

$filePath = '';
$i = strpos($packageName, '/');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Symfony\Component\AssetMapper\Tests\ImportMap;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
use Symfony\Component\AssetMapper\ImportMap\ImportMapConfigReader;
use Symfony\Component\AssetMapper\ImportMap\ImportMapEntries;
use Symfony\Component\AssetMapper\ImportMap\ImportMapEntry;
Expand All @@ -21,6 +22,8 @@

class ImportMapConfigReaderTest extends TestCase
{
use ExpectDeprecationTrait;

private Filesystem $filesystem;

protected function setUp(): void
Expand Down Expand Up @@ -162,4 +165,13 @@ public function testFindRootImportMapEntry()
$this->assertSame('file2', $entry->importName);
$this->assertSame('file2.js', $entry->path);
}

/**
* @group legacy
*/
public function testDeprecatedMethodTriggerDeprecation()
{
$this->expectDeprecation('Since symfony/asset-mapper 7.1: The method "Symfony\Component\AssetMapper\ImportMap\ImportMapConfigReader::splitPackageNameAndFilePath()" is deprecated and will be removed in 8.0. Use ImportMapEntry::splitPackageNameAndFilePath() instead.');
ImportMapConfigReader::splitPackageNameAndFilePath('foo');
}
}
1 change: 1 addition & 0 deletions src/Symfony/Component/AssetMapper/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"require": {
"php": ">=8.2",
"composer/semver": "^3.0",
"symfony/deprecation-contracts": "^2.1|^3",
"symfony/filesystem": "^6.4|^7.0",
"symfony/http-client": "^6.4|^7.0"
},
Expand Down