Skip to content

Lumen 9.0.2 - Declaration of DummyKernel must be compatible with HttpKernelInterface #22

Open

Description

@blacksheep122

What are you trying to achieve?

Run tests in general (using make).

What do you get instead?

Fatal error: Declaration of Codeception\Lib\Connector\Lumen\DummyKernel::handle(Symfony\Component\HttpFoundation\Request $request, $type = self::MASTER_REQUEST, $catch = true): void must be compatible with Symfony\Component\HttpKernel\HttpKernelInterface::handle(Symfony\Component\HttpFoundation\Request $request, int $type = self::MAIN_REQUEST, bool $catch = true): Symfony\Component\HttpFoundation\Response in /var/www/vendor/codeception/module-lumen/src/Codeception/Lib/Connector/Lumen/DummyKernel.php on line 15

FATAL ERROR. TESTS NOT FINISHED.
Declaration of Codeception\Lib\Connector\Lumen\DummyKernel::handle(Symfony\Component\HttpFoundation\Request $request, $type = self::MASTER_REQUEST, $catch = true): void must be compatible with Symfony\Component\HttpKernel\HttpKernelInterface::handle(Symfony\Component\HttpFoundation\Request $request, int $type = self::MAIN_REQUEST, bool $catch = true): Symfony\Component\HttpFoundation\Response 
in /var/www/vendor/codeception/module-lumen/src/Codeception/Lib/Connector/Lumen/DummyKernel.php:15

Details

  • Codeception version: 5.0.0-RC5
  • PHP Version: 8.1
  • Operating System: Ubuntu with Docker
  • Installation type: Composer
  • List of installed packages (composer show):
behat/gherkin                      v4.9.0    Gherkin DSL parser for PHP
brick/math                         0.9.3     Arbitrary-precision arithmetic library
codeception/codeception            5.0.0-RC5 BDD-style testing framework
codeception/lib-asserts            2.0.0     Assertion methods used by Codeception core and Asserts module
codeception/lib-innerbrowser       3.1.2     Parent library for all Codeception framework modules and PhpBrowser
codeception/lib-web                1.0.1     Library containing files used by module-webdriver and lib-innerbrowser or module-phpbrowser
codeception/lib-xml                1.0.0     Files used by module-rest and module-soap
codeception/module-asserts         3.0.0     Codeception module containing various assertions
codeception/module-db              3.0.1     DB module for Codeception
codeception/module-lumen           3.0.0     Codeception module for Lumen framework
codeception/module-rest            3.1.0     REST module for Codeception
codeception/stub                   4.0.2     Flexible Stub wrapper for PHPUnit's Mock Builder
doctrine/cache                     2.2.0     PHP Doctrine Cache library is a popular cache implementation that supports many different dr...
doctrine/dbal                      3.3.7     Powerful PHP database abstraction layer (DBAL) with many features for database schema intros...
doctrine/deprecations              v1.0.0    A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to di...
doctrine/event-manager             1.1.1     The Doctrine Event Manager is a simple PHP event system that was built to be used with the v...
doctrine/inflector                 2.0.4     PHP Doctrine Inflector is a small library that can perform string manipulations with regard ...
doctrine/instantiator              1.4.1     A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                     1.2.3     PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
dragonmantank/cron-expression      v3.3.1    CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due
egulias/email-validator            3.2.1     A library for validating emails against several RFCs
fruitcake/php-cors                 v1.2.0    Cross-origin resource sharing library for the Symfony HttpFoundation
graham-campbell/result-type        v1.0.4    An Implementation Of The Result Type
guzzlehttp/guzzle                  7.4.5     Guzzle is a PHP HTTP client library
guzzlehttp/promises                1.5.1     Guzzle promises library
guzzlehttp/psr7                    2.4.0     PSR-7 message implementation that also provides common utility methods
illuminate/auth                    v9.18.0   The Illuminate Auth package.
illuminate/broadcasting            v9.18.0   The Illuminate Broadcasting package.
illuminate/bus                     v9.18.0   The Illuminate Bus package.
illuminate/cache                   v9.18.0   The Illuminate Cache package.
illuminate/collections             v9.18.0   The Illuminate Collections package.
illuminate/conditionable           v9.18.0   The Illuminate Conditionable package.
illuminate/config                  v9.18.0   The Illuminate Config package.
illuminate/console                 v9.18.0   The Illuminate Console package.
illuminate/container               v9.18.0   The Illuminate Container package.
illuminate/contracts               v9.18.0   The Illuminate Contracts package.
illuminate/database                v9.18.0   The Illuminate Database package.
illuminate/encryption              v9.18.0   The Illuminate Encryption package.
illuminate/events                  v9.18.0   The Illuminate Events package.
illuminate/filesystem              v9.18.0   The Illuminate Filesystem package.
illuminate/hashing                 v9.18.0   The Illuminate Hashing package.
illuminate/http                    v9.18.0   The Illuminate Http package.
illuminate/log                     v9.18.0   The Illuminate Log package.
illuminate/macroable               v9.18.0   The Illuminate Macroable package.
illuminate/pagination              v9.18.0   The Illuminate Pagination package.
illuminate/pipeline                v9.18.0   The Illuminate Pipeline package.
illuminate/queue                   v9.18.0   The Illuminate Queue package.
illuminate/session                 v9.18.0   The Illuminate Session package.
illuminate/support                 v9.18.0   The Illuminate Support package.
illuminate/testing                 v9.18.0   The Illuminate Testing package.
illuminate/translation             v9.18.0   The Illuminate Translation package.
illuminate/validation              v9.18.0   The Illuminate Validation package.
illuminate/view                    v9.18.0   The Illuminate View package.
justinrainbow/json-schema          5.2.12    A library to validate a json schema.
kraken-io/kraken-php               1.6       Official Kraken.io SDK
laravel/lumen-framework            v9.0.2    The Laravel Lumen Framework.
laravel/serializable-closure       v1.2.0    Laravel Serializable Closure provides an easy and secure way to serialize closures in PHP.
masterminds/html5                  2.7.5     An HTML5 parser and serializer.
monolog/monolog                    2.7.0     Sends your logs to files, sockets, inboxes, databases and various web services
myclabs/deep-copy                  1.11.0    Create deep copies (clones) of your objects
nesbot/carbon                      2.58.0    An API extension for DateTime that supports 281 different languages.
nikic/fast-route                   v1.3.0    Fast request router for PHP
nikic/php-parser                   v4.14.0   A PHP parser written in PHP
paragonie/constant_time_encoding   v2.6.3    Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)
paragonie/random_compat            v9.99.100 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
phar-io/manifest                   2.0.3     Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version                    3.2.1     Library for handling version information and constraints
php-amqplib/php-amqplib            v3.1.2    Formerly videlalvaro/php-amqplib.  This library is a pure PHP implementation of the AMQP pro...
phpdocumentor/reflection-common    2.2.0     Common reflection classes used by phpdocumentor to reflect the code structure
phpdocumentor/reflection-docblock  5.3.0     With this component, a library can provide support for annotations via DocBlocks or otherwis...
phpdocumentor/type-resolver        1.6.1     A PSR-5 based resolver of Class names, Types and Structural Element Names
phpoption/phpoption                1.8.1     Option Type for PHP
phpseclib/phpseclib                3.0.14    PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 ...
phpspec/prophecy                   v1.15.0   Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage          9.2.15    Library that provides collection, processing, and rendering functionality for PHP code cover...
phpunit/php-file-iterator          3.0.6     FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-invoker                3.1.1     Invoke callables with a timeout
phpunit/php-text-template          2.0.4     Simple template engine.
phpunit/php-timer                  5.0.3     Utility class for timing
phpunit/phpunit                    9.5.21    The PHP Unit Testing framework.
predis/predis                      v1.1.10   Flexible and feature-complete Redis client for PHP and HHVM
psr/cache                          3.0.0     Common interface for caching libraries
psr/container                      2.0.2     Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher               1.0.0     Standard interfaces for event handling.
psr/http-client                    1.0.1     Common interface for HTTP clients
psr/http-factory                   1.0.1     Common interfaces for PSR-7 HTTP message factories
psr/http-message                   1.0.1     Common interface for HTTP messages
psr/log                            3.0.0     Common interface for logging libraries
psr/simple-cache                   3.0.0     Common interfaces for simple caching
psy/psysh                          v0.11.5   An interactive shell for modern PHP.
ralouphie/getallheaders            3.0.3     A polyfill for getallheaders.
ramsey/collection                  1.2.2     A PHP library for representing and manipulating collections.
ramsey/uuid                        4.3.1     A PHP library for generating and working with universally unique identifiers (UUIDs).
rinvex/countries                   v8.1.1    Rinvex Countries is a simple and lightweight package for retrieving country details with fle...
sebastian/cli-parser               1.0.1     Library for parsing CLI options
sebastian/code-unit                1.0.8     Collection of value objects that represent the PHP code units
sebastian/code-unit-reverse-lookup 2.0.3     Looks up which function or method a line of code belongs to
sebastian/comparator               4.0.6     Provides the functionality to compare PHP values for equality
sebastian/complexity               2.0.2     Library for calculating the complexity of PHP code units
sebastian/diff                     4.0.4     Diff implementation
sebastian/environment              5.1.4     Provides functionality to handle HHVM/PHP environments
sebastian/exporter                 4.0.4     Provides the functionality to export PHP variables for visualization
sebastian/global-state             5.0.5     Snapshotting of global state
sebastian/lines-of-code            1.0.3     Library for counting the lines of code in PHP source code
sebastian/object-enumerator        4.0.4     Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector         2.0.4     Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context        4.0.4     Provides functionality to recursively process PHP variables
sebastian/resource-operations      3.0.3     Provides a list of PHP built-in functions that operate on resources
sebastian/type                     3.0.0     Collection of value objects that represent the types of the PHP type system
sebastian/version                  3.0.2     Library that helps with managing the version number of Git-hosted PHP projects
sendgrid/php-http-client           3.14.4    HTTP REST client, simplified for PHP
sendgrid/sendgrid                  7.11.5    This library allows you to quickly and easily send emails through Twilio SendGrid using PHP.
softcreatr/jsonpath                0.8.0     JSONPath implementation for parsing, searching and flattening arrays
starkbank/ecdsa                    0.0.5     fast openSSL-compatible implementation of the Elliptic Curve Digital Signature Algorithm (EC...
stripe/stripe-php                  v7.128.0  Stripe PHP Library
symfony/browser-kit                v6.1.0    Simulates the behavior of a web browser, allowing you to make requests, click on links and s...
symfony/console                    v6.1.2    Eases the creation of beautiful and testable command line interfaces
symfony/css-selector               v6.1.0    Converts CSS selectors to XPath expressions
symfony/deprecation-contracts      v3.1.1    A generic function and convention to trigger deprecation notices
symfony/dom-crawler                v6.1.0    Eases DOM navigation for HTML and XML documents
symfony/error-handler              v6.1.0    Provides tools to manage errors and ease debugging PHP code
symfony/event-dispatcher           v6.1.0    Provides tools that allow your application components to communicate with each other by disp...
symfony/event-dispatcher-contracts v3.1.1    Generic abstractions related to dispatching event
symfony/finder                     v6.1.0    Finds files and directories via an intuitive fluent interface
symfony/http-foundation            v6.1.2    Defines an object-oriented layer for the HTTP specification
symfony/http-kernel                v6.1.2    Provides a structured process for converting a Request into a Response
symfony/mime                       v6.1.1    Allows manipulating MIME messages
symfony/polyfill-ctype             v1.26.0   Symfony polyfill for ctype functions
symfony/polyfill-intl-grapheme     v1.26.0   Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-idn          v1.26.0   Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-intl-normalizer   v1.26.0   Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring          v1.26.0   Symfony polyfill for the Mbstring extension
symfony/polyfill-php72             v1.26.0   Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-php80             v1.26.0   Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/polyfill-php81             v1.26.0   Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions
symfony/process                    v6.1.0    Executes commands in sub-processes
symfony/service-contracts          v3.1.1    Generic abstractions related to writing services
symfony/string                     v6.1.2    Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and graph...
symfony/translation                v6.1.0    Provides tools to internationalize your application
symfony/translation-contracts      v3.1.1    Generic abstractions related to translation
symfony/var-dumper                 v6.1.0    Provides mechanisms for walking through any arbitrary PHP variable
symfony/yaml                       v6.1.2    Loads and dumps YAML files
theseer/tokenizer                  1.2.1     A small library for converting tokenized PHP source code into XML and potentially other formats
vlucas/phpdotenv                   v5.4.1    Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.
voku/portable-ascii                2.0.1     Portable ASCII library - performance optimized (ascii) string functions for php.
webmozart/assert                   1.11.0    Assertions to validate method input/output with nice error messages.

  • Suite configuration:
actor: ApiTester
suite_namespace: \Api
modules:
    enabled:
      - REST:
          url: /api/v1/
          depends: Lumen

Activity

  1. PetrenkoAnton commented on Feb 11, 2024

    @PetrenkoAnton

    Same error. Are there any fixes?

  2. blacksheep122 commented on Feb 11, 2024

    @blacksheep122
    Author

    Fastest way to fix it (for my case at least):

    In composer.json:

    "autoload-dev": {
        "exclude-from-classmap": [
          "vendor/codeception/module-lumen/src/Codeception/Lib/Connector/Lumen/DummyKernel.php",
        ],
        "files": [
          "app/Custom/Codeception/Lib/Connector/Lumen/DummyKernel.php",
        ],

    Content of "app/Custom/Codeception/Lib/Connector/Lumen/DummyKernel.php":

    <?php
    
    declare(strict_types=1);
    
    namespace Codeception\Lib\Connector\Lumen;
    
    use Symfony\Component\HttpFoundation\Request;
    use Symfony\Component\HttpKernel\HttpKernelInterface;
    
    /**
     * Dummy kernel to satisfy the parent constructor of the LumenConnector class.
     */
    class DummyKernel implements HttpKernelInterface
    {
        public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true): void
        {
            //
         }
    }
  3. PetrenkoAnton commented on Feb 11, 2024

    @PetrenkoAnton

    @blacksheep122 , thanks!

    After the fixes everything works as expected.

    Below are some explanations.

    tests/Support/DummyKernel.php (location in my case):

    <?php
    
    declare(strict_types=1);
    
    namespace Codeception\Lib\Connector\Lumen;
    
    use Symfony\Component\HttpFoundation\Request;
    use Symfony\Component\HttpFoundation\Response;
    use Symfony\Component\HttpKernel\HttpKernelInterface;
    
    /**
     * Dummy kernel to satisfy the parent constructor of the LumenConnector class.
     */
    class DummyKernel implements HttpKernelInterface
    {
        public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true): Response
        {
            //
        }
    }

    and valid json struct in composer.json:

        "autoload-dev": {
            "exclude-from-classmap": [
                "vendor/codeception/module-lumen/src/Codeception/Lib/Connector/Lumen/DummyKernel.php"
            ],
            "files": [
                "tests/Support/DummyKernel.php"
            ]
        },

    And don't forget to run composer dump-autoload

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions