Skip to content
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

PublicVisibility mutator failing due to missing reflection #501

Closed
theofidry opened this issue Oct 11, 2018 · 0 comments
Closed

PublicVisibility mutator failing due to missing reflection #501

theofidry opened this issue Oct 11, 2018 · 0 comments
Labels

Comments

@theofidry
Copy link
Member

Question Answer
Infection version 0.10.5 (as a Composer package)
Test Framework version PHPUnit 7.4.0
PHP version PHP 7.2.2 (cli)
Platform OSX Sierra
Github Repo humbug/php-scoper#265
Complete output
$ php fixtures/set020-infection/vendor/infection/infection/bin/infection --coverage=dist/infection-coverage
You are running Infection with xdebug enabled.
    ____      ____          __  _
   /  _/___  / __/__  _____/ /_(_)___  ____
   / // __ \/ /_/ _ \/ ___/ __/ / __ \/ __ \
 _/ // / / / __/  __/ /__/ /_/ / /_/ / / / /
/___/_/ /_/_/  \___/\___/\__/_/\____/_/ /_/

Running initial test suite...

PHPUnit version: 7.4.0

  723 [============================] 4 secsProcessing source code files:  0/44

Generate mutants...

Processing source code files:  8/44
In InvalidMutatorException.php line 21:

  Encountered an error with the "PublicVisibility" mutator in the "/Users/tfidry/Project/Humbug/php-scoper/src/functions.php" file. This is most likely a bug in Infection, so please report this in our
  issue tracker.


In PublicVisibility.php line 103:

  Call to a member function getInterfaces() on null


run [--test-framework TEST-FRAMEWORK] [--test-framework-options TEST-FRAMEWORK-OPTIONS] [-j|--threads THREADS] [--only-covered] [-s|--show-mutations] [-c|--configuration CONFIGURATION] [--coverage COVERAGE] [--mutators MUTATORS] [--filter FILTER] [--formatter FORMATTER] [--min-msi MIN-MSI] [--min-covered-msi MIN-COVERED-MSI] [--log-verbosity LOG-VERBOSITY] [--initial-tests-php-options INITIAL-TESTS-PHP-OPTIONS] [--ignore-msi-with-no-mutations] [--debug]

The issue seems to be caused by that following piece of code:

// src/functions.php from humbug/php-scoper

function create_scoper(): Scoper
{
    return (new class() extends ApplicationFactory {
        public static function createScoper(): Scoper
        {
            return parent::createScoper();
        }
    })::createScoper();
}
sanmai added a commit to sanmai/infection that referenced this issue Oct 12, 2018
…reflection

It seems that PHP-Parser can't provide reflection for anonymous classes yet.

Fixes infection#501 for time being until nikic/PHP-Parser#543 gets fixed.
@helpr helpr bot added the Has PR label Oct 12, 2018
@sanmai sanmai added the Bug label Oct 12, 2018
maks-rafalko pushed a commit that referenced this issue Oct 13, 2018
…reflection (#502)

* Update ProtectedVisibility/PublicVisibility to guard against missing reflection

It seems that PHP-Parser can't provide reflection for anonymous classes yet.

Fixes #501 for time being until nikic/PHP-Parser#543 gets fixed.

* PublicVisibility: test for presence of reflection in one place

* Update type hint to include null
@helpr helpr bot added PR merged and removed Has PR labels Oct 13, 2018
BackEndTea pushed a commit to BackEndTea/infection that referenced this issue Oct 22, 2018
…reflection (infection#502)

* Update ProtectedVisibility/PublicVisibility to guard against missing reflection

It seems that PHP-Parser can't provide reflection for anonymous classes yet.

Fixes infection#501 for time being until nikic/PHP-Parser#543 gets fixed.

* PublicVisibility: test for presence of reflection in one place

* Update type hint to include null
raphaelstolt pushed a commit to raphaelstolt/infection that referenced this issue Nov 2, 2018
…reflection (infection#502)

* Update ProtectedVisibility/PublicVisibility to guard against missing reflection

It seems that PHP-Parser can't provide reflection for anonymous classes yet.

Fixes infection#501 for time being until nikic/PHP-Parser#543 gets fixed.

* PublicVisibility: test for presence of reflection in one place

* Update type hint to include null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants