A tool that can be used to verify BC breaks between two versions of a PHP library.

Overview

Roave Backward Compatibility Check

Mutation testing badge Type Coverage Latest Stable Version License

A tool that can be used to verify BC breaks between two versions of a PHP library.

Pre-requisites/assumptions

  • Your project uses git
  • Your project uses composer.json to define its dependencies
  • All source paths are covered by an "autoload" section in composer.json
  • Changes need to be committed to git to be covered. You can implement your own logic to extract sources and dependencies from a project though.

Installation

composer require --dev roave/backward-compatibility-check

Install with Docker

You can also use Docker to run roave-backward-compatibility-check:

docker run --rm -v `pwd`:/app nyholm/roave-bc-check

Usage

Adding to a continuous integration pipeline

The typical intended usage is to just add roave-backward-compatibility-check to your CI build:

vendor/bin/roave-backward-compatibility-check

This will automatically detect the last minor version tagged, and compare the API against the current HEAD. If any BC breaks are found, the tool returns a non-zero status, which on most CI systems will cause the build to fail.

NOTE: detecting the base version only works if you have git tags in the SemVer-compliant x.y.z format, such as 1.2.3.

NOTE: since this tool relies on tags, you need to make sure tags are fetched as part of your CI pipeline. For example in a GitHub action, note the use of fetch-depth: 0:

jobs:
  roave-backwards-compatibility-check:
    name: Roave Backwards Compatibility Check
      runs-on: ubuntu-latest
      steps:
        - uses: actions/checkout@v2
          with:
            fetch-depth: 0
        - name: "Install PHP"
          uses: shivammathur/setup-php@v2
          with:
            php-version: "8.0"
        - name: "Install dependencies"
          run: "composer install"
        - name: "Check for BC breaks"
          run: "vendor/bin/roave-backward-compatibility-check"

Nyholm Github Action

Tobias Nyholm also offers a simple GitHub action that you can use in your Github pipeline. We recommend this for most cases as it is simple to set up:

.github/workflows/main.yml

on: [push]
name: Test
jobs:
  roave-backwards-compatibility-check:
    name: Roave Backwards Compatibility Check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: "Check for BC breaks"
        uses: docker://nyholm/roave-bc-check-ga

Running manually

To generate additional documentation for changelogs:

vendor/bin/roave-backward-compatibility-check --format=markdown > results.md

GitHub Actions

When running in GitHub Actions, it is endorsed to use the --format=github-actions output format:

vendor/bin/roave-backward-compatibility-check --format=github-actions

Documentation

If you need further guidance:

vendor/bin/roave-backward-compatibility-check --help

Configuration

There are currently no configuration options available.

Comments
  • Picking last minor release vs. the last release

    Picking last minor release vs. the last release

    Hi, I just noticed an oddity in the logic - the tool compares current HEAD against the last minor release, meaning even if there's 2.2.5, it will compare HEAD against 2.2.0.

    I think this will lead to not noticing BC breaks between patch versions.

    Let's say I add a new method in 2.2.1. Because the method does not exist in 2.2.0, the tool will consider it as a new method in the current HEAD when getting ready to release 2.2.5. Which means that if I add a new required argument between 2.2.4 and 2.2.5, I just caused a BC break for users that started relying on the method meanwhile (between 2.2.1 and 2.2.4).

    I know that patch versions are for bugfixes only, but I can imagine a scenario where adding a new method can be interpreted as part of a bugfix...

    Is there something I'm not seeing? Thanks!

    enhancement bc break 
    opened by ondrejmirtes 18
  • PHP8: Named parameters support & opt-out attribute

    PHP8: Named parameters support & opt-out attribute

    Since it looks like named parameters will pass, with no proposal of having a way to opt out of this feature, I'd like to propose introducing an attribute to have parameter names excluded from BCC rules, by way of annotation.

    The main comment I've seen in support of named parameters is that "you can just say you're not supporting named parameters". Unfortunately, just saying that (e.g. by writing in your README.md) doesn't make tools understand that fact, so we need to recognise this some other way. The RFC even goes as far as to mention an "opt-out" possibility, but it never expands on it beyond suggesting an annotation such as <<NoNamedArgs>>. Therefore, unless another RFC is proposed to add this, we can be fairly sure that there will be no runtime checks to prevent calling a method with named-parameter syntax.

    So: onto the proposal: Add an annotation to method definition that says "you must not call this method using named parameter syntax". Static analysers such as Psalm/PHPStan could check this at call-time: I believe Psalm "may" support this if there is demand, and PHPStan are actively looking to support this kind of annotation.

    Because there is chance for BC break by renaming parameters with the named param RFC (even if a rename is rare), we will need to add this as a rule now from any PHP 8 code. However, we can use the above annotation to exclude any parameter renames from being marked as BC breaks within this tool.

    Before API:

    function supportsNamedParams($a, $b, $c);
    
    @@NoNamedParams
    function doesNotSupportNamedParams($a, $b, $c);
    

    After API

    function supportsNamedParams($d, $e, $f); // would be marked as a BC break due to named params in PHP 8
    
    @@NoNamedParams
    function doesNotSupportNamedParams($d, $e, $f); // param renames are ignored due to annotation, not classed as a BC break
    
    enhancement bc break 
    opened by asgrim 16
  • --version does not show version

    --version does not show version

    $ wget https://github.com/Roave/BackwardCompatibilityCheck/releases/download/4.0.0/roave-backward-compatibility-check.phar
    
    $ php roave-backward-compatibility-check.phar --version
    Console Tool
    
    enhancement good first issue 
    opened by sebastianbergmann 15
  • Error: tmp/api-compare ... was expected to exist.

    Error: tmp/api-compare ... was expected to exist.

    Due to https://github.com/Roave/BackwardCompatibilityCheck/issues/114, I tried to run the check command with --from and --to, but I got an error:

    root@415101e15410:/repo# vendor/bin/roave-backward-compatibility-check --from=2.4.0 --to=2.6.1
    Comparing from 06194f705c3e967fb8665060f0afb482495a88f9 to 613821a6b0b805aa8fddc0d47b0ab6bb3a3e0456...
    Loading composer repositories with package information
    Installing dependencies from lock file
    Your requirements could not be resolved to an installable set of packages.
    
      Problem 1
        - Installation request for yiisoft/yii2-composer 2.0.3 -> satisfiable by yiisoft/yii2-composer[2.0.3].
        - yiisoft/yii2-composer 2.0.3 requires composer-plugin-api 1.0.0 -> no matching package found.
      Problem 2
        - yiisoft/yii2-composer 2.0.3 requires composer-plugin-api 1.0.0 -> no matching package found.
        - yiisoft/yii2 2.0.6 requires yiisoft/yii2-composer * -> satisfiable by yiisoft/yii2-composer[2.0.3].
        - Installation request for yiisoft/yii2 2.0.6 -> satisfiable by yiisoft/yii2[2.0.6].
    
    Potential causes:
     - A typo in the package name
     - The package is not available in a stable-enough version according to your minimum-stability setting
       see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
     - It's a private package and you forgot to add a custom repository to find it
    
    Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
    
    In Assertion.php line 288:
                                                                                                                                          
      File "/tmp/api-compare-06194f705c3e967fb8665060f0afb482495a88f9_5c4f17f2f12c4/vendor/composer/autoload_..." was expected to exist.  
                                                                                                                                          
    
    roave-backwards-compatibility-check:assert-backwards-compatible [--from [FROM]] [--to TO] [--format [FORMAT]]
    

    Note: I am running this in a Docker container, but the whole repo is available in the container.

    bug invalid 
    opened by schmunk42 15
  • Compare with last tag on the same branch as the target branch

    Compare with last tag on the same branch as the target branch

    Given `doctrine/migrations` has tags 3.0.0, 3.0.1 and 2.3.0
     When I open a PR against 2.3.x (for instance)
     Then the tool should detect that the last minor version is 2.3.0
    

    Right now it detects that the last version is… 3.0.0, which is confusing.

    I believe this could be done by detected what branch the commit being tested is based on. On most CI systems, the commit being tested is the result of a merge between the target branch and the last commit on PR. This means that the detection can be performed easily by looking at the parent commits, provided they are fetched, which implies doing stuff like this (example with Github Actions):

    
          - name: "Checkout"
            uses: "actions/checkout@v2"
            with:
              fetch-depth: 2
    
    question 
    opened by greg0ire 14
  • Added docs how to use Github actions and docker

    Added docs how to use Github actions and docker

    I really like this tool. With some inspiration from PHPStan, I created this repo: https://github.com/Nyholm/roave-bc-check-docker

    It builds docker images and support for Github actions.

    This PR contains installation instructions that might be easier to use... however, I also understand if you only want to have a link saying: "If you use docker or github actions, go here ->"

    screenshot 2019-02-03 at 09 47 36 enhancement 
    opened by Nyholm 13
  • Verify method, function, property, constant and interface changes and report BC breaks

    Verify method, function, property, constant and interface changes and report BC breaks

    Fixes #7 Fixes #8 Fixes #9 Fixes #10 Fixes #11 Fixes #12 Fixes #41 Fixes #43 Fixes #46

    • [x] requires https://github.com/Roave/BetterReflection/pull/415
    • [x] class became interface
    • [x] class became abstract
    • [x] interface became final/regular class
    • [x] interface became abstract class
    • [x] method became final
    • [x] method became abstract
    enhancement 
    opened by Ocramius 13
  • Crash on non-standard scalar type names

    Crash on non-standard scalar type names

    $ vendor/bin/roave-backward-compatibility-check roa:ass --to=HEAD --from=eb73ac50b890bf8 lib
    Comparing from eb73ac50b890bf8c26115ff5975fc6adf093dd0b to 02538d3f95e88eb397a5f86274deb2c6175c2ab6...
    Loading composer repositories with package information
    Installing dependencies from lock file
    Nothing to install or update
    Generating optimized autoload files
    Loading composer repositories with package information
    Installing dependencies from lock file
    Package operations: 2 installs, 0 updates, 0 removals
      - Installing doctrine/lexer (v1.0.1): Loading from cache
      - Installing doctrine/annotations (v1.6.0): Loading from cache
    Generating optimized autoload files
    
    In Fqsen.php line 48:
    
      "\Doctrine\Common\Reflection\boolean." is not a valid Fqsen.
    

    Reproducible with the command above in doctrine/reflection repo (HEAD=02538d3f95e88eb397a5f86274deb2c6175c2ab6, but issue comes from --from commit).

    $ git grep boolean
    lib/Doctrine/Common/Reflection/StaticReflectionParser.php:     * @var boolean.
    lib/Doctrine/Common/Reflection/StaticReflectionParser.php:     * @var boolean
    lib/Doctrine/Common/Reflection/StaticReflectionParser.php:     * @param boolean              $classAnnotationOptimize Only retrieve the class docComment.
    
    bug 
    opened by Majkl578 12
  • Build PHAR using BOX and use Travis to publish PHAR releases

    Build PHAR using BOX and use Travis to publish PHAR releases

    The PHAR builds fine, but running it throws really weird errors. Maybe @theofidry can help? :/

    $ dist/roave-backward-compatibility-check.phar r:a --from 1.0.0
    Comparing from 81b1ab0128e72ee8e2666b28abcedadff84fcc23 to 95b5c0d5ac37ff7cfeac8368ec7f0b3009d6fd09...
    Loading composer repositories with package information
    Installing dependencies from lock file
    Package operations: 24 installs, 0 updates, 0 removals
      - Installing beberlei/assert (v2.9.5): Loading from cache
      - Installing symfony/process (v4.0.11): Loading from cache
      - Installing symfony/finder (v4.0.11): Loading from cache
      - Installing symfony/polyfill-ctype (v1.8.0): Loading from cache
      - Installing symfony/filesystem (v4.0.11): Loading from cache
      - Installing symfony/polyfill-mbstring (v1.8.0): Loading from cache
      - Installing symfony/console (v4.0.11): Loading from cache
      - Installing seld/phar-utils (1.0.1): Loading from cache
      - Installing seld/jsonlint (1.7.1): Loading from cache
      - Installing seld/cli-prompt (1.0.3): Loading from cache
      - Installing psr/log (1.0.2): Loading from cache
      - Installing justinrainbow/json-schema (5.2.7): Loading from cache
      - Installing composer/spdx-licenses (1.4.0): Loading from cache
      - Installing composer/semver (1.4.2): Loading from cache
      - Installing composer/ca-bundle (1.1.1): Loading from cache
      - Installing composer/composer (1.6.5): Loading from cache
      - Installing nikolaposa/version (3.0.1): Loading from cache
      - Installing phpdocumentor/reflection-common (1.0.1): Loading from cache
      - Installing roave/signature (1.0.0): Loading from cache
      - Installing phpdocumentor/type-resolver (0.4.0): Loading from cache
      - Installing webmozart/assert (1.3.0): Loading from cache
      - Installing phpdocumentor/reflection-docblock (4.3.0): Loading from cache
      - Installing nikic/php-parser (v4.0.1): Loading from cache
      - Installing roave/better-reflection (3.0.0): Loading from cache
    Generating optimized autoload files
    PHP Warning:  fopen(phar:///www/roave/BackwardCompatibilityCheck/dist/roave-backward-compatibility-check.phar/vendor/composer/composer/src/Composer/Autoload/../../../LICENSE): failed to open stream: phar error: "vendor/composer/composer/LICENSE" is not a file in phar "/www/roave/BackwardCompatibilityCheck/dist/roave-backward-compatibility-check.phar" in phar:///www/roave/BackwardCompatibilityCheck/dist/roave-backward-compatibility-check.phar/vendor/composer/composer/src/Composer/Autoload/AutoloadGenerator.php on line 1002
    
    Warning: fopen(phar:///www/roave/BackwardCompatibilityCheck/dist/roave-backward-compatibility-check.phar/vendor/composer/composer/src/Composer/Autoload/../../../LICENSE): failed to open stream: phar error: "vendor/composer/composer/LICENSE" is not a file in phar "/www/roave/BackwardCompatibilityCheck/dist/roave-backward-compatibility-check.phar" in phar:///www/roave/BackwardCompatibilityCheck/dist/roave-backward-compatibility-check.phar/vendor/composer/composer/src/Composer/Autoload/AutoloadGenerator.php on line 1002
    PHP Warning:  stream_copy_to_stream() expects parameter 1 to be resource, boolean given in phar:///www/roave/BackwardCompatibilityCheck/dist/roave-backward-compatibility-check.phar/vendor/composer/composer/src/Composer/Autoload/AutoloadGenerator.php on line 1005
    
    Warning: stream_copy_to_stream() expects parameter 1 to be resource, boolean given in phar:///www/roave/BackwardCompatibilityCheck/dist/roave-backward-compatibility-check.phar/vendor/composer/composer/src/Composer/Autoload/AutoloadGenerator.php on line 1005
    PHP Warning:  fclose() expects parameter 1 to be resource, boolean given in phar:///www/roave/BackwardCompatibilityCheck/dist/roave-backward-compatibility-check.phar/vendor/composer/composer/src/Composer/Autoload/AutoloadGenerator.php on line 1006
    
    Warning: fclose() expects parameter 1 to be resource, boolean given in phar:///www/roave/BackwardCompatibilityCheck/dist/roave-backward-compatibility-check.phar/vendor/composer/composer/src/Composer/Autoload/AutoloadGenerator.php on line 1006
    Loading composer repositories with package information
    Installing dependencies from lock file
    Package operations: 24 installs, 0 updates, 0 removals
      - Installing beberlei/assert (v2.9.5): Loading from cache
      - Installing symfony/process (v4.0.11): Loading from cache
      - Installing symfony/finder (v4.0.11): Loading from cache
      - Installing symfony/polyfill-ctype (v1.8.0): Loading from cache
      - Installing symfony/filesystem (v4.0.11): Loading from cache
      - Installing symfony/polyfill-mbstring (v1.8.0): Loading from cache
      - Installing symfony/console (v4.0.11): Loading from cache
      - Installing seld/phar-utils (1.0.1): Loading from cache
      - Installing seld/jsonlint (1.7.1): Loading from cache
      - Installing seld/cli-prompt (1.0.3): Loading from cache
      - Installing psr/log (1.0.2): Loading from cache
      - Installing justinrainbow/json-schema (5.2.7): Loading from cache
      - Installing composer/spdx-licenses (1.4.0): Loading from cache
      - Installing composer/semver (1.4.2): Loading from cache
      - Installing composer/ca-bundle (1.1.1): Loading from cache
      - Installing composer/composer (1.6.5): Loading from cache
      - Installing nikolaposa/version (3.0.1): Loading from cache
      - Installing phpdocumentor/reflection-common (1.0.1): Loading from cache
      - Installing roave/signature (1.0.0): Loading from cache
      - Installing phpdocumentor/type-resolver (0.4.0): Loading from cache
      - Installing webmozart/assert (1.3.0): Loading from cache
      - Installing phpdocumentor/reflection-docblock (4.3.0): Loading from cache
      - Installing nikic/php-parser (v4.0.1): Loading from cache
      - Installing roave/better-reflection (3.0.0): Loading from cache
    Generating optimized autoload files
    PHP Warning:  fopen(phar:///www/roave/BackwardCompatibilityCheck/dist/roave-backward-compatibility-check.phar/vendor/composer/composer/src/Composer/Autoload/../../../LICENSE): failed to open stream: phar error: "vendor/composer/composer/LICENSE" is not a file in phar "/www/roave/BackwardCompatibilityCheck/dist/roave-backward-compatibility-check.phar" in phar:///www/roave/BackwardCompatibilityCheck/dist/roave-backward-compatibility-check.phar/vendor/composer/composer/src/Composer/Autoload/AutoloadGenerator.php on line 1002
    
    Warning: fopen(phar:///www/roave/BackwardCompatibilityCheck/dist/roave-backward-compatibility-check.phar/vendor/composer/composer/src/Composer/Autoload/../../../LICENSE): failed to open stream: phar error: "vendor/composer/composer/LICENSE" is not a file in phar "/www/roave/BackwardCompatibilityCheck/dist/roave-backward-compatibility-check.phar" in phar:///www/roave/BackwardCompatibilityCheck/dist/roave-backward-compatibility-check.phar/vendor/composer/composer/src/Composer/Autoload/AutoloadGenerator.php on line 1002
    PHP Warning:  stream_copy_to_stream() expects parameter 1 to be resource, boolean given in phar:///www/roave/BackwardCompatibilityCheck/dist/roave-backward-compatibility-check.phar/vendor/composer/composer/src/Composer/Autoload/AutoloadGenerator.php on line 1005
    
    Warning: stream_copy_to_stream() expects parameter 1 to be resource, boolean given in phar:///www/roave/BackwardCompatibilityCheck/dist/roave-backward-compatibility-check.phar/vendor/composer/composer/src/Composer/Autoload/AutoloadGenerator.php on line 1005
    PHP Warning:  fclose() expects parameter 1 to be resource, boolean given in phar:///www/roave/BackwardCompatibilityCheck/dist/roave-backward-compatibility-check.phar/vendor/composer/composer/src/Composer/Autoload/AutoloadGenerator.php on line 1006
    
    Warning: fclose() expects parameter 1 to be resource, boolean given in phar:///www/roave/BackwardCompatibilityCheck/dist/roave-backward-compatibility-check.phar/vendor/composer/composer/src/Composer/Autoload/AutoloadGenerator.php on line 1006
    No backwards-incompatible changes detected
    

    closes #23

    enhancement 
    opened by Majkl578 11
  • Adding `Stringable` polyfill causes false positive (`Stringable ancestor removed`)

    Adding `Stringable` polyfill causes false positive (`Stringable ancestor removed`)

    Live example: https://github.com/vimeo/psalm/runs/5059860222?check_suite_focus=true

    Steps to reproduce:

    1. Add roave/backward-compatibility-check:6.1 to a project that didn't use symfony/polyfill-php80 and that also has some classes with __toString() method.
    2. Commit composer.json (and composer.lock if it's versioned),
    3. Run vendor/bin/roave-backward-compatibility-check --from="HEAD^".

    Expected

    No backward compatibility breaks should be reported as no project files have changed.

    Actual

    ....
    [BC] REMOVED: These ancestors of Psalm\Storage\Assertion\InArray have been removed: ["Stringable"]
    [BC] REMOVED: These ancestors of Psalm\Storage\FunctionLikeStorage have been removed: ["Stringable"]
    [BC] REMOVED: These ancestors of Psalm\Storage\Assertion have been removed: ["Stringable"]
    [BC] REMOVED: These ancestors of Psalm\Node\VirtualIdentifier have been removed: ["Stringable"]
    [BC] REMOVED: These ancestors of Psalm\Node\VirtualName have been removed: ["Stringable"]
    [BC] REMOVED: These ancestors of Psalm\Node\VirtualVarLikeIdentifier have been removed: ["Stringable"]
    [BC] REMOVED: These ancestors of Psalm\Node\Name\VirtualRelative have been removed: ["Stringable"]
    [BC] REMOVED: These ancestors of Psalm\Node\Name\VirtualFullyQualified have been removed: ["Stringable"]
    125 backwards-incompatible changes detected
    

    I also confirmed that it's triggered by symfony/polyfill-php80 by installing BCC into a separate environment and running vendor/bin/roave-backward-compatibility-check --from="HEAD^" with the HEAD commit having just this:

    commit 4cc0571866e8405658117613a8106f880116decb (HEAD -> add-bcc-2)
    Author: Bruce Weirdan <[email protected]>
    Date:   Fri Feb 4 03:39:44 2022 +0200
    
        Add polyfill
    
    diff --git a/composer.json b/composer.json
    index f06872480..567e5d275 100644
    --- a/composer.json
    +++ b/composer.json
    @@ -35,7 +35,8 @@
             "openlss/lib-array2xml": "^1.0",
             "sebastian/diff": "^4.0",
             "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0 || ^6.0",
    -        "symfony/filesystem": "^5.4 || ^6.0"
    +        "symfony/filesystem": "^5.4 || ^6.0",
    +        "symfony/polyfill-php80": "^1.24"
         },
         "provide": {
             "psalm/psalm": "self.version"
    
    bug 
    opened by weirdan 10
  • PHP 8.0 and PHP 8.1 support, BetterReflection 5.x upgrade

    PHP 8.0 and PHP 8.1 support, BetterReflection 5.x upgrade

    This patch brings in PHP 8.0 and 8.1 support through the massive work done by @kukulich on roave/better-reflection over the past few months.

    The upgrade is mostly smooth, but we have some rough edges with:

    • [x] TypeIsCovariant, which needs ReflectionTypes as well as Reflectors
    • [x] TypeIsContravariant, which needs ReflectionTypes as well as Reflectors
    • [x] ReturnTypeCovarianceChanged uses hacky reflection to get a Reflector from a ReflectionFunctionAbstract (internal state!) - needs https://github.com/Roave/BetterReflection/pull/836
    • [x] ParameterTypeContravarianceChanged uses hacky reflection to get a Reflector from a ReflectionFunctionAbstract (internal state!) - needs https://github.com/Roave/BetterReflection/pull/836
    • [x] we miss tests for covariance/contravariance with ReflectionUnionType and ReflectionIntersectionType (infection/infection will highlight that)
    • [x] https://github.com/Roave/BetterReflection/pull/902
    • [x] tests for covariance/contravariance of nullable ReflectionIntersectionType (needs https://github.com/Roave/BetterReflection/pull/902 )

    Fixes #283

    enhancement bc break 
    opened by Ocramius 10
  • Update dependency roave/infection-static-analysis-plugin to ^1.28.0

    Update dependency roave/infection-static-analysis-plugin to ^1.28.0

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | roave/infection-static-analysis-plugin | require-dev | minor | ^1.27.0 -> ^1.28.0 |


    Release Notes

    Roave/infection-static-analysis-plugin

    v1.28.0

    Compare Source

    Release Notes for 1.28.0

    Feature release (minor)

    1.28.0
    • Total issues resolved: 0
    • Total pull requests resolved: 1
    • Total contributors: 1
    enhancement

    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Enabled.

    Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    Read more about the use of Renovate Bot within ocramius/* projects.

    renovate 
    opened by renovate[bot] 1
  • Add contravariant test which fails due to missing in the from part

    Add contravariant test which fails due to missing in the from part

    We have a situation right now where we want to enable the use to use the psr-20 clock interface. Beforehand we already introduced our own ClockInterface with the exact api the psr-20 one would have. And now, since it was released, we wanted to get rid of our own interface from our internal code but still providing it. So our interface now extends from the psr-20 one and we changed a signature which required our interface to the new psr-20 interface. In my opinion this should be ok, since the old interface is still allowed.

    I provided a TestCase here to reproduce this. Also here as ref the PR where we want to achieve this: https://github.com/patchlevel/event-sourcing/pull/334

    opened by DanielBadura 7
  • Handle reflection error in retrieving default values

    Handle reflection error in retrieving default values

    fix #698

    This is the first PoC of handling the two errors mentioned in the linked issue. I added a TestCase for both errors. I'm not sure what exactly we should compare from the AST of the two parameters so for now only checking if the type is the same which already resolved the error case.

    opened by DanielBadura 1
  • Handle new initializer and enum intiliazing as default value more gracefully

    Handle new initializer and enum intiliazing as default value more gracefully

    Right now as soon as you initialize an object as default value.

    public function foo(Bar $bar = new Bar()): void {}
    

    you get an error like this

    Error: Unable to compile initializer in method Patchlevel\EventSourcing\Projection\Projectionist::boot() in file /src/Projection/Projectionist.php (line 11)
    

    Or using an enum value as default

    public function foo(Bar $bar = Bar::Baz): void {}
    

    you will receive this:

    Error: Could not locate constant Patchlevel\EventSourcing\Projection\ProjectorStatus::New while trying to evaluate constant expression in method Patchlevel\EventSourcing\Projection\ProjectorStore\ProjectorState::__construct() in file /src/Projection/ProjectorStore/ProjectorState.php (line 14)
    

    This is because of roave/better-reflection is throwing an exception in these cases which is expected see https://github.com/Roave/BetterReflection/issues/1311 for more information.

    In the linked issue we discussed to handle it here and catch the exception. My question here would be where should this happen? I looked into the code and couldnt really determine where the best place would be. Also, the thrown exception is marked internal at roave/better-reflection which lead me to the assumption to not catch it directly but instead LogicException or even Throwable.

    opened by DanielBadura 6
  • Dependency Dashboard

    Dependency Dashboard

    This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

    Awaiting Schedule

    These updates are awaiting their schedule. Click on a checkbox to get an update now.

    • [ ] Lock file maintenance

    Open

    These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

    Detected dependencies

    composer
    composer.json
    • php ~8.1.0 || ~8.2.0
    • azjezz/psl ^2.3.1
    • composer/composer ^2.5.1
    • nikolaposa/version ^4.1.0
    • ocramius/package-versions ^2.7.0
    • roave/better-reflection ^6.5.0
    • symfony/console ^6.2.3
    • doctrine/coding-standard ^11.0.0
    • php-standard-library/psalm-plugin ^2.2.1
    • phpunit/phpunit ^9.5.27
    • psalm/plugin-phpunit ^0.18.4
    • roave/infection-static-analysis-plugin ^1.27.0
    • squizlabs/php_codesniffer ^3.7.1
    • vimeo/psalm ^5.4.0
    github-actions
    .github/workflows/continuous-integration.yml
    • laminas/laminas-ci-matrix-action 1.22.1
    • laminas/laminas-continuous-integration-action 1.32.0
    • actions/checkout v3
    • shivammathur/setup-php v2
    • actions/cache v3
    • actions/checkout v3
    • shivammathur/setup-php v2
    • actions/cache v3
    .github/workflows/release-on-milestone-closed.yml
    • actions/checkout v3
    • laminas/automatic-releases v1
    • laminas/automatic-releases v1
    • laminas/automatic-releases v1
    • laminas/automatic-releases v1
    • laminas/automatic-releases v1
    .github/workflows/release-phar.yml
    • actions/checkout v3
    • shivammathur/setup-php v2
    • actions/cache v3
    • fnkr/github-action-ghr v1.3

    • [ ] Check this box to trigger a request for Renovate to run again on this repository
    opened by renovate[bot] 0
  • [WIP] - Inform when there is no minor version

    [WIP] - Inform when there is no minor version

    I had probably the edge-case when my library had no minor versions. Only preleases. I was getting information that there are no versions at all. Which is false. There are versions. I would like just to improve the DX and show the proper message :)

    In CollectionIsEmpty.php line 13:
                                                             
      Cannot get the first Version from an empty collection  
                                                             
    
    enhancement WIP 
    opened by Ferror 0
Releases(8.2.1)
Owner
Roave, LLC
Roave, LLC
This package is used to validate the telephone numbers of the countries taken into account. It also makes it possible to verify that a number is indeed a number of an operator X

phone-number-checker This package is used to validate the telephone numbers of the countries taken into account. It also makes it possible to verify t

faso-dev 4 Feb 7, 2022
A PocketMine-MP plugin that replaces a block to another block when breaks, then back to the original block after a certain time

BlockReplacer A PocketMine-MP plugin that replaces a block to another block when breaks, then back to the original block after a certain time How to I

AIPTU 11 Sep 2, 2022
Plugin Notify OP Or Staff Has Permission antixraype.check when someone breaks ore

General Plugin Notify OP Or Staff Has Permission antixraype.check when someone breaks ore If the message repeats many times, check if the player is us

Nguyễn Đạt 3 Mar 15, 2022
A PHP library that can be used manually as well as a CLI script that you can just run on your file

Run phpcs on files and only report new warnings/errors compared to the previous version. This is both a PHP library that can be used manually as well

Payton Swick 20 Aug 4, 2022
Verify purchase codes right on your WordPress dashboard.

envato-purchase-code-widget Verify purchase codes right on your WordPress dashboard. Install the plugin Go to Settings->EPCW and enter your "Envato AP

null 6 Oct 28, 2021
This library implements a fuzzer for PHP, which can be used to find bugs in libraries

PHP Fuzzer This library implements a fuzzer for PHP, which can be used to find bugs in libraries (particularly parsing libraries) by feeding them "ran

Nikita Popov 341 Dec 25, 2022
KLua is a FFI-based Lua5 library that can be used in both PHP and KPHP

KLua KLua is a FFI-based Lua5 library that can be used in both PHP and KPHP. Installation Since this is a FFI library, it needs a dynamic library avai

Iskander (Alex) Sharipov 7 Nov 4, 2022
This library can be used, among other things, to retrieve the classes, interfaces, traits, enums, functions and constants declared in a file

marijnvanwezel/reflection-file Library that allows reflection of files. This library can be used, among other things, to retrieve the classes, interfa

Marijn van Wezel 5 Apr 17, 2022
A WordPress package to nudge users to upgrade their software versions (starting with PHP)

whip A WordPress package to nudge users to upgrade their software versions (starting with PHP) Requirements The following versions of PHP are supporte

Yoast 71 Oct 18, 2022
Analyzer of PHP code to search issues with deprecated functionality in newer interpreter versions.

PhpDeprecationDetector PhpDeprecationDetector - analyzer of PHP code to search usages of deprecated functionality in newer interpreter versions - depr

Sergey 312 Dec 26, 2022
This project backports features found in the latest PHP versions and provides compatibility layers for some extensions and functions

This project backports features found in the latest PHP versions and provides compatibility layers for some extensions and functions. It is intended to be used when portability across PHP versions and extensions is desired.

Symfony 2.2k Dec 29, 2022
Analyzer of PHP code to search issues with deprecated functionality in newer interpreter versions.

PhpDeprecationDetector PhpDeprecationDetector - analyzer of PHP code to search usages of deprecated functionality in newer interpreter versions - depr

Sergey 312 Dec 26, 2022
JSONFinder - a library that can find json values in a mixed text or html documents, can filter and search the json tree, and converts php objects to json without 'ext-json' extension.

JSONFinder - a library that can find json values in a mixed text or html documents, can filter and search the json tree, and converts php objects to json without 'ext-json' extension.

Eboubaker Eboubaker 2 Jul 31, 2022
Checks prefer-lowest installation for actually defined min versions in composer.json

Composer Prefer Lowest Validator This validator will strictly compare the specified minimum versions of your composer.json with the ones actually used

Mark Scherer 17 Aug 7, 2022
Automatically delete old SiteTree page versions from Silverstripe

Version truncator for Silverstripe An extension for Silverstripe to automatically delete old versioned DataObject records from your database when a re

Ralph Slooten 35 Dec 7, 2022
Algolia Search integration for Magento 1 - compatible with versions from 1.6.x to 1.9.x

Algolia Search for Magento 1.6+ End of Support ?? The Algolia Magento 1 extension has reached End of Life regarding support and maintenance. We do not

Algolia 163 Dec 20, 2022
Algolia Search integration for Magento 2 - compatible with versions from 2.3.x to 2.4.x

Algolia Search for Magento 2 ?? Need help? Check out our Technical Troubleshooting Guide. For feedback, bug reporting, or unresolved issues with the e

Algolia 147 Dec 20, 2022
A MCPE server software that backporting new Minecraft: Bedrock Edition to older PocketMine versions with better stability and performance.

CoarseMC is a server software that backports new Minecraft: Bedrock Edition versions to older PocketMine versions with better stability and performance, while retaining as many features from the new PocketMine-MP versions as possible.

null 5 May 21, 2022
A high-performance license server system service for creating and managing products, major versions, and software licenses for the purpose of selling installable software products.

A high-performance license server system service for creating and managing products, major versions, and software licenses for the purpose of selling installable software products. Comes with a SDK and command-line tool. Works anywhere that PHP runs.

CubicleSoft 32 Dec 5, 2022