mcstreetguy / composerparser Goto Github PK
View Code? Open in Web Editor NEWAn oop composer file parser.
License: MIT License
An oop composer file parser.
License: MIT License
The "package"
key in a package
repository may be set to an array to define multiple versions of a package: https://getcomposer.org/doc/05-repositories.md#package-2
Here is a payload for the test:
"repositories": [
{
"type": "package",
"package": [
{
"name": "smarty/smarty",
"version": "2.0.0",
"dist": {
"url": "https://www.smarty.net/files/Smarty-2.0.0.zip",
"type": "zip"
},
"source": {
"url": "http://smarty-php.googlecode.com/svn/",
"type": "svn",
"reference": "tags/Smarty_2_0_0/distribution/"
},
"autoload": {
"classmap": ["libs/"]
}
},
{
"name": "smarty/smarty",
"version": "3.0.0",
"dist": {
"url": "https://www.smarty.net/files/Smarty-3.0.0.zip",
"type": "zip"
},
"source": {
"url": "http://smarty-php.googlecode.com/svn/",
"type": "svn",
"reference": "tags/Smarty_3_0_0/distribution/"
},
"autoload": {
"classmap": ["libs/"]
}
}
]
}
],
As output I assumed to see repository with array of packages.
Personally I have never seen any project which defines repository packages in this way. Just keep in mind that these changes are breaking because getPackage
returns ?ComposerJson
right now, but may start to return an array of ComposerJson instances too. I don't really like it because return type becomes mixed ComposerJson|ComposerJson[]|null
and will require additional checks in user application to determine what we have inside: is it array or one instance only.
As possible solutions to prevent mixed return type I think it could return array even when there is only one package instance defined. To prevent introduction of breaking changes in v1 this feature could be delayed for the v2 version.
Describe the bug
Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, bool given in vendor/mcstreetguy/composer-parser/src/ComposerJson.php:259
To Reproduce
in your composer.json if you have some repositories set to false:
"repositories": { "my-repo": { "type": "composer", "url": "http://my-repo.com" }, "packagist.org": false, "packagist": false },
Is your feature request related to a problem? Please describe.
Add feature of composer 2.2 :
inside the config object we got new sction "allow-plugins"
Describe the solution you'd like
Add new properties to the class vendor/mcstreetguy/composer-parser/src/Json/Config.php also Get method
Describe the bug
Deprecated: Return type of MCStreetguy\ComposerParser\Service\AbstractMap::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /vendor/mcstreetguy/composer-parser/src/Service/AbstractMap.php on line 67
Deprecated: Return type of MCStreetguy\ComposerParser\Service\AbstractMap::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in
/vendor/mcstreetguy/composer-parser/src/Service/AbstractMap.php on line 89
Deprecated: Return type of MCStreetguy\ComposerParser\Service\AbstractMap::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in vendor/mcstreetguy/composer-parser/src/Service/AbstractMap.php on line 78
Deprecated: Return type of MCStreetguy\ComposerParser\Service\AbstractMap::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in vendor/mcstreetguy/composer-parser/src/Service/AbstractMap.php on line 100
Deprecated: Return type of MCStreetguy\ComposerParser\Service\AbstractMap::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in vendor/mcstreetguy/composer-parser/src/Service/AbstractMap.php on line 56
Deprecated: Return type of MCStreetguy\ComposerParser\Service\AbstractMap::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in endor/mcstreetguy/composer-parser/src/Service/AbstractMap.php on line 129
Deprecated: Return type of MCStreetguy\ComposerParser\Service\AbstractMap::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /vendor/mcstreetguy/composer-parser/src/Service/AbstractMap.php on line 153
Deprecated: Return type of MCStreetguy\ComposerParser\Service\AbstractMap::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /vendor/mcstreetguy/composer-parser/src/Service/AbstractMap.php on line 113
Deprecated: Return type of MCStreetguy\ComposerParser\Service\AbstractMap::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /vendor/mcstreetguy/composer-parser/src/Service/AbstractMap.php on line 141
To Reproduce
Use the library with php 8.1
Expected behavior
No warning, can be fix by set the return type of each method.
Accordingly to the specification - there is a way to disable packagist.org.
But if you add it to composer.json - parser will return this value:
{"type":"","url":"","options":[],"package":null}
Maybe it will be better to have by default packagist repository in list:
"packagist.org": {
"type": "composer",
"url": "https?://repo.packagist.org",
"allow_ssl_downgrade": true
},
And remove it if "packagist.org": false
is in place?
Or just not to add this object to the parsed repositories list, but then we need to denote that packagist is disabled somehow.
@MCStreetguy could you publish stable release, please? It's very risky to rely on dev-master
on production.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.