Code Monkey home page Code Monkey logo

version's People

Contributors

addshore avatar ayesh avatar dnaber-de avatar exussum12 avatar guillaumeseren avatar j-d avatar llaville avatar localheinz avatar sebastianbergmann avatar sebastianheuer avatar theseer avatar tomasvotruba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

version's Issues

Ambiguous class resolution on composer dump-autoload

Generating optimized autoload filesWarning: Ambiguous class resolution, "PharIo\Version\InvalidVersionException" was found in both "/home/winardiaris/git/project/vendor/phar-io/version/src/exceptions/InvalidVersionException.php" and "/home/winardiaris/git/project/vendor/phar-io/version/src/InvalidVersionException.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\UnsupportedVersionConstraintException" was found in both "/home/winardiaris/git/project/vendor/phar-io/version/src/exceptions/UnsupportedVersionConstraintException.php" and "/home/winardiaris/git/project/vendor/phar-io/version/src/UnsupportedVersionConstraintException.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\AndVersionConstraintGroup" was found in both "/home/winardiaris/git/project/vendor/phar-io/version/src/AndVersionConstraintGroup.php" and "/home/winardiaris/git/project/vendor/phar-io/version/src/constraints/AndVersionConstraintGroup.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\VersionConstraint" was found in both "/home/winardiaris/git/project/vendor/phar-io/version/src/VersionConstraint.php" and "/home/winardiaris/git/project/vendor/phar-io/version/src/constraints/VersionConstraint.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\SpecificMajorAndMinorVersionConstraint" was found in both "/home/winardiaris/git/project/vendor/phar-io/version/src/SpecificMajorAndMinorVersionConstraint.php" and "/home/winardiaris/git/project/vendor/phar-io/version/src/constraints/SpecificMajorAndMinorVersionConstraint.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\SpecificMajorVersionConstraint" was found in both "/home/winardiaris/git/project/vendor/phar-io/version/src/SpecificMajorVersionConstraint.php" and "/home/winardiaris/git/project/vendor/phar-io/version/src/constraints/SpecificMajorVersionConstraint.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\GreaterThanOrEqualToVersionConstraint" was found in both "/home/winardiaris/git/project/vendor/phar-io/version/src/GreaterThanOrEqualToVersionConstraint.php" and "/home/winardiaris/git/project/vendor/phar-io/version/src/constraints/GreaterThanOrEqualToVersionConstraint.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\ExactVersionConstraint" was found in both "/home/winardiaris/git/project/vendor/phar-io/version/src/ExactVersionConstraint.php" and "/home/winardiaris/git/project/vendor/phar-io/version/src/constraints/ExactVersionConstraint.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\OrVersionConstraintGroup" was found in both "/home/winardiaris/git/project/vendor/phar-io/version/src/OrVersionConstraintGroup.php" and "/home/winardiaris/git/project/vendor/phar-io/version/src/constraints/OrVersionConstraintGroup.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\AbstractVersionConstraint" was found in both "/home/winardiaris/git/project/vendor/phar-io/version/src/AbstractVersionConstraint.php" and "/home/winardiaris/git/project/vendor/phar-io/version/src/constraints/AbstractVersionConstraint.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\AnyVersionConstraint" was found in both "/home/winardiaris/git/project/vendor/phar-io/version/src/AnyVersionConstraint.php" and "/home/winardiaris/git/project/vendor/phar-io/version/src/constraints/AnyVersionConstraint.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\Exception" was found in both "/home/winardiaris/git/project/vendor/phar-io/version/src/exceptions/Exception.php" and "/home/winardiaris/git/project/vendor/phar-io/version/src/Exception.php", the first will be used.

Warning during installation

Hi,
i receive this warning during the installation.

Warning: Ambiguous class resolution, "PharIo\Version\AnyVersionConstraint" was found in both "/home/dev/mySoft/vendor/phar-io/version/src/AnyVersionConstraint.php" and "/home/dev/mySoft/vendor/phar-io/version/src/constraints/AnyVersionConstraint.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\VersionConstraint" was found in both "/home/dev/mySoft/vendor/phar-io/version/src/VersionConstraint.php" and "/home/dev/mySoft/vendor/phar-io/version/src/constraints/VersionConstraint.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\SpecificMajorAndMinorVersionConstraint" was found in both "/home/dev/mySoft/vendor/phar-io/version/src/SpecificMajorAndMinorVersionConstraint.php" and "/home/dev/mySoft/vendor/phar-io/version/src/constraints/SpecificMajorAndMinorVersionConstraint.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\OrVersionConstraintGroup" was found in both "/home/dev/mySoft/vendor/phar-io/version/src/OrVersionConstraintGroup.php" and "/home/dev/mySoft/vendor/phar-io/version/src/constraints/OrVersionConstraintGroup.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\GreaterThanOrEqualToVersionConstraint" was found in both "/home/dev/mySoft/vendor/phar-io/version/src/constraints/GreaterThanOrEqualToVersionConstraint.php" and "/home/dev/mySoft/vendor/phar-io/version/src/GreaterThanOrEqualToVersionConstraint.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\ExactVersionConstraint" was found in both "/home/dev/mySoft/vendor/phar-io/version/src/constraints/ExactVersionConstraint.php" and "/home/dev/mySoft/vendor/phar-io/version/src/ExactVersionConstraint.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\AbstractVersionConstraint" was found in both "/home/dev/mySoft/vendor/phar-io/version/src/constraints/AbstractVersionConstraint.php" and "/home/dev/mySoft/vendor/phar-io/version/src/AbstractVersionConstraint.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\SpecificMajorVersionConstraint" was found in both "/home/dev/mySoft/vendor/phar-io/version/src/constraints/SpecificMajorVersionConstraint.php" and "/home/dev/mySoft/vendor/phar-io/version/src/SpecificMajorVersionConstraint.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\UnsupportedVersionConstraintException" was found in both "/home/dev/mySoft/vendor/phar-io/version/src/UnsupportedVersionConstraintException.php" and "/home/dev/mySoft/vendor/phar-io/version/src/exceptions/UnsupportedVersionConstraintException.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\Exception" was found in both "/home/dev/mySoft/vendor/phar-io/version/src/Exception.php" and "/home/dev/mySoft/vendor/phar-io/version/src/exceptions/Exception.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\InvalidVersionException" was found in both "/home/dev/mySoft/vendor/phar-io/version/src/InvalidVersionException.php" and "/home/dev/mySoft/vendor/phar-io/version/src/exceptions/InvalidVersionException.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\AndVersionConstraintGroup" was found in both "/home/dev/mySoft/vendor/phar-io/version/src/constraints/AndVersionConstraintGroup.php" and "/home/dev/mySoft/vendor/phar-io/version/src/AndVersionConstraintGroup.php", the first will be used.

Can you fix it ?
Can i help you to fix it?

Thanks in advance
Alex

VersionConstraintParser does not support logical OR represented by single pipe

Hello,

Context
I've wrote a solution that may be integrated in phar-io/manifest that is able to write a manifest.xml from parsing any composer.json file.

Issue
I've noticed that the VersionConstraintParser does not support logicial OR syntax represented by a single pipe.
This syntax is still used by lot of vendor / package.
See https://getcomposer.org/doc/articles/versions.md#version-range

Recommandation
I propose to add support of single pipe support for logical OR.
See https://github.com/phar-io/version/blob/3.1.0/src/VersionConstraintParser.php#L17
And https://github.com/phar-io/version/blob/3.1.0/src/VersionConstraintParser.php#L61

Expected behaviour
Prints "Phar.io version constraint: ^7.4|^8.0"

Actual behiavour
Raises Fatal error: Uncaught PharIo\Version\UnsupportedVersionConstraintException: Version constraint ^7.4|^8.0 is not supported.

Script to reproduce issue

<?php
use PharIo\Version\VersionConstraintParser;

$parser = new VersionConstraintParser();

$constraint = '^7.4|^8.0';
$versionConstraint = $parser->parse( $constraint );
var_dump('Phar.io version constraint: ' . $versionConstraint->asString());

Exception marker interfaces shsould extend `Throwable`

Following code is generally not valid from a static perspective (note: still works at runtime)

interface MyMarker
{
}

try {
} catch (MyMarker $e) {
}

The rationale is that the contract to be followed for a symbol to be used in a catch () is that it should implement Throwable.

In practice, the idea is that the interface should be extending Throwable:

interface MyMarker extends Throwable
{
}

This currently affects following:

namespace PharIo\Version;
interface Exception {
}

Branch version strings like dev-master are not supported

Hello @theseer

Following our recent discussion, I would like here to remember the use case I found about version string not yet supported.

Context
When we want to create a manifest for a package under development. From master branch or another one, and with latest commit not the same as the one corresponding to the latest git tag. Picking info from VCS like PHPUnit did with https://github.com/sebastianbergmann/phpunit/blob/master/build/scripts/phar-manifest.php#L3-L15

Current behaviour
Prints workaround version 0.0.0-dev

Expected behaviour
Prints version dev-master@045047b37d1dd99bf7e97487e2dc10820439f29b

Script to reproduce issue

<?php 

use PharIo\Version\InvalidVersionException;
use PharIo\Version\Version;

// branch@commit_hash
$rootPackageVersion = 'dev-master@045047b37d1dd99bf7e97487e2dc10820439f29b'

$default = '0.0.0-dev';
$version = $rootPackageVersion ?? $default;
try {
    new Version($version);
} catch (InvalidVersionException $e) {
    $version = $default;
}
var_dump($version);

Warning during test, The attribute 'name' is required but missing.

Hey,
I am working on this package today and I got this warning while running the test.

└─> phpunit --bootstrap /usr/share/php/PharIo/Version/autoload.php
PHPUnit 8.5.2 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.4.4
Configuration: /home/gseren/tmp/version/phpunit.xml

  Warning - The configuration file did not pass validation!
  The following problems have been detected:

  Line 10:
  - Element 'testsuite': The attribute 'name' is required but missing.

  Test results may not be as expected.


................................................................. 65 / 86 ( 75%)
.....................                                             86 / 86 (100%)

Time: 56 ms, Memory: 6.00 MB

OK (86 tests, 110 assertions)

The fix is pretty trivial, but I opened a PR with it.

Thank you for this project.

Tilde operator without patch level

We are currently using the 2.x version and wanted to update to the new 3.x version. In the process, however, our unit tests failed.
The original statement no longer works:

Tilde operator: ~1.0.0 can be written as >=1.0.0 <1.1.0 and read as »every version within minor version 1.1. The behavior of tilde operator depends on whether a patch level version is provided or not. If no patch level is provided, tilde operator behaves like the caret operator: ~1.0 is identical to ^1.0.

When parsing a version number, "0" is now always set instead of "null" for the patch default value, so that the "getPatch()->isAny()" method returns true every time. It then assumes, for example, "~7.0.0" even if you pass "~7.0" and a comparison with 7.1 then fails.

$this->patch = isset($matches['Patch']) ? new VersionNumber((int)$matches['Patch']) : new VersionNumber(0);

major version only not supported, e.g. ^6

https://packagist.org/packages/braunstetter/choosy-type

not sure why symfony/form: ^6 is different than the rest, but composer thinks it's valid, can you change the library to support this format as well?

symfony/form ^6
https://packagist.org/packages/braunstetter/choosy-type
Version string '6' does not follow SemVer semantics

The code I'm using for this is

$version = '^6';
                                try {
                                    $constraint = $parser->parse($version);
                                } catch (\Exception $exception) {
                                    $this->logger->error(sprintf("%s %s\n%s\n%s",
                                        $dependency, $version,
                                        $this->getPackagistUrl($name),
                                        $exception->getMessage()));
                                    break;
                                }

Make testing autoload building more obvious

After performing the typical »on boarding« steps (cloning, run composer install) I would assume that I can run the PHPUnit tests, but it gives me the following error:

$ phpunit 
PHPUnit 6.0.6 by Sebastian Bergmann and contributors.

Cannot open file "/var/www/projects/php/phpunit/vendor/phar-io/version/src/autoload.php".

In order to run the PHPUnit tests of this package I need to do the following steps:

  • Installing phpab: $ composer global require theseer/autoload
  • Run phpab and save the result in src/autoload.php: $ phpab src/ > src/autoload.php

This is not really obvious, however. In order to automate this process, one could add phpab as dev dependency and run the autoload building as post-install composer script. Alternatively one could use the composer autoload file vendor/autoload.php.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.