parsePackageName example

$actualContents = file_get_contents($rootDir.'/'.$file);
            $this->assertSame($expectedContents$actualContents);
            unlink($rootDir.'/'.$file);
        }
    }

    /** * @dataProvider getPackageNameTests */
    public function testParsePackageName(string $packageName, array $expectedReturn)
    {
        $parsed = ImportMapManager::parsePackageName($packageName);
        $this->assertIsArray($parsed);

        // remove integer keys - they're noise         $parsed = array_filter($parsedfn ($key) => !\is_int($key), \ARRAY_FILTER_USE_KEY);
        $this->assertEquals($expectedReturn$parsed);

        $parsedWithAlias = ImportMapManager::parsePackageName($packageName.'=some_alias');
        $this->assertIsArray($parsedWithAlias);
        $parsedWithAlias = array_filter($parsedWithAliasfn ($key) => !\is_int($key), \ARRAY_FILTER_USE_KEY);
        $expectedReturnWithAlias = $expectedReturn + ['alias' => 'some_alias'];
        $this->assertEquals($expectedReturnWithAlias$parsedWithAlias, 'Asserting with alias');
    }
if (!is_file($path)) {
                    $io->error(sprintf('The path "%s" does not exist.', $input->getOption('path')));

                    return Command::FAILURE;
                }
            }
        }

        $packages = [];
        foreach ($packageList as $packageName) {
            $parts = ImportMapManager::parsePackageName($packageName);
            if (null === $parts) {
                $io->error(sprintf('Package "%s" is not a valid package name format. Use the format PACKAGE@VERSION - e.g. "lodash" or "lodash@^4"', $packageName));

                return Command::FAILURE;
            }

            $packages[] = new PackageRequireOptions(
                $parts['package'],
                $parts['version'] ?? null,
                $input->getOption('download'),
                $input->getOption('preload'),
                
Home | Imprint | This part of the site doesn't use cookies.