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

Fatal Error when introducing Union Type in SVC 12.0.0 #71

Open
danmooney2 opened this issue Apr 13, 2023 · 1 comment
Open

Fatal Error when introducing Union Type in SVC 12.0.0 #71

danmooney2 opened this issue Apr 13, 2023 · 1 comment

Comments

@danmooney2
Copy link
Member

danmooney2 commented Apr 13, 2023

Preconditions:

  • SVC 12.0.0
  • Create before/app/code/test.php:
<?php

class Test
{
    public function get(string $value)
    {

    }
}
  • Create after/app/code/test.php:
<?php

class Test
{
    public function get(bool|string $value)
    {

    }
}
  • Run bin/svc compare [absolute path to before directory] [absolute path to after directory]

Expected:
SVC successfully runs to completion

Actual:

Fatal error: Uncaught Error: Call to undefined method PhpParser\Node\UnionType::toString() in /Users/dmooney/Code/magento-semver/vendor/tomzx/php-semver-checker/src/PHPSemVerChecker/Comparator/Type.php:35
Stack trace:
#0 /Users/dmooney/Code/magento-semver/vendor/tomzx/php-semver-checker/src/PHPSemVerChecker/Comparator/Signature.php(42): PHPSemVerChecker\Comparator\Type::get(Object(PhpParser\Node\UnionType))
#1 /Users/dmooney/Code/magento-semver/src/Comparator/Signature.php(77): PHPSemVerChecker\Comparator\Signature::analyze(Array, Array)
#2 /Users/dmooney/Code/magento-semver/src/Analyzer/ClassMethodAnalyzer.php(217): Magento\SemanticVersionChecker\Comparator\Signature::analyze(Array, Array)
#3 /Users/dmooney/Code/magento-semver/src/Analyzer/AbstractCodeAnalyzer.php(74): Magento\SemanticVersionChecker\Analyzer\ClassMethodAnalyzer->reportChanged(Object(PHPSemVerChecker\Report\Report), Object(PhpParser\Node\Stmt\Class_), Object(PhpParser\Node\Stmt\Class_), Array)
#4 /Users/dmooney/Code/magento-semver/src/Analyzer/ClassAnalyzer.php(114): Magento\SemanticVersionChecker\Analyzer\AbstractCodeAnalyzer->analyze(Object(PhpParser\Node\Stmt\Class_), Object(PhpParser\Node\Stmt\Class_))
#5 /Users/dmooney/Code/magento-semver/src/Analyzer/AbstractCodeAnalyzer.php(74): Magento\SemanticVersionChecker\Analyzer\ClassAnalyzer->reportChanged(Object(PHPSemVerChecker\Report\Report), Object(PHPSemVerChecker\Registry\Registry), Object(PHPSemVerChecker\Registry\Registry), Array)
#6 /Users/dmooney/Code/magento-semver/src/Analyzer/Analyzer.php(45): Magento\SemanticVersionChecker\Analyzer\AbstractCodeAnalyzer->analyze(Object(PHPSemVerChecker\Registry\Registry), Object(PHPSemVerChecker\Registry\Registry))
#7 /Users/dmooney/Code/magento-semver/src/Analyzer/NonApiAnalyzer.php(31): Magento\SemanticVersionChecker\Analyzer\Analyzer->analyze(Object(PHPSemVerChecker\Registry\Registry), Object(PHPSemVerChecker\Registry\Registry))
#8 /Users/dmooney/Code/magento-semver/src/ReportBuilder.php(221): Magento\SemanticVersionChecker\Analyzer\NonApiAnalyzer->analyze(Object(PHPSemVerChecker\Registry\Registry), Object(PHPSemVerChecker\Registry\Registry))
#9 /Users/dmooney/Code/magento-semver/src/ReportBuilder.php(146): Magento\SemanticVersionChecker\ReportBuilder->buildReport()
#10 /Users/dmooney/Code/magento-semver/src/ReportBuilder.php(115): Magento\SemanticVersionChecker\ReportBuilder->makeVersionReport()
#11 /Users/dmooney/Code/magento-semver/src/SemanticVersionChecker.php(60): Magento\SemanticVersionChecker\ReportBuilder->makeCompleteVersionReport()
#12 /Users/dmooney/Code/magento-semver/src/SemanticVersionChecker.php(86): Magento\SemanticVersionChecker\SemanticVersionChecker->loadVersionReport()
#13 /Users/dmooney/Code/magento-semver/src/Console/Command/CompareSourceCommand.php(149): Magento\SemanticVersionChecker\SemanticVersionChecker->getVersionIncrease()
#14 /Users/dmooney/Code/magento-semver/vendor/symfony/console/Command/Command.php(298): Magento\SemanticVersionChecker\Console\Command\CompareSourceCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /Users/dmooney/Code/magento-semver/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /Users/dmooney/Code/magento-semver/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand(Object(Magento\SemanticVersionChecker\Console\Command\CompareSourceCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /Users/dmooney/Code/magento-semver/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /Users/dmooney/Code/magento-semver/bin/svc(30): Symfony\Component\Console\Application->run()
#19 {main}
  thrown in /Users/dmooney/Code/magento-semver/vendor/tomzx/php-semver-checker/src/PHPSemVerChecker/Comparator/Type.php on line 35```
@m2-assistant
Copy link

m2-assistant bot commented Apr 13, 2023

Hi @danmooney2. Thank you for your report.
To speed up processing of this issue, make sure that you provided sufficient information.
Add a comment to assign the issue: @magento I am working on this


Join Magento Community Engineering Slack and ask your questions in #github channel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant