Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Container builder seems to create Invalid PHP Syntax #46627

Closed
@alexander-schranz

Description

@alexander-schranz

Symfony version(s) affected

6.2.0@dev (not on 6.1.*)

Description

I'm running into a strange issues with building the container in @sulu: https://github.com/sulu/sulu/runs/6810915566?check_suite_focus=true#logs

The generated code looks like this:

<?php
        return $this->services['doctrine_phpcr.session'] = new \Sulu\Bundle\DocumentManagerBundle\Session\Session([$this->privates['doctrine_phpcr.jackalope.repository.factory.service.doctrinedbal']
            ??= new \Jackalope\RepositoryFactoryDoctrineDBAL()->getRepository([
                'jackalope.doctrine_dbal_connection' => (
                    $this->services['doctrine.dbal.default_connection'] 
                    ?? $this->getDoctrine_Dbal_DefaultConnectionService()
                ),
                'jackalope.data_caches' => ['meta' => ($this->privates['doctrine_phpcr.meta_cache_provider'] 
                    ?? $this->getDoctrinePhpcr_MetaCacheProviderService()), 'nodes' => ($this->privates['doctrine_phpcr.nodes_cache_provider'] 
                    ?? $this->getDoctrinePhpcr_NodesCacheProviderService())
                ],
                'jackalope.check_login_on_server' => false]), 'login'](
                    new \PHPCR\SimpleCredentials('admin', 'admin'),
                    $this->getEnv('PHPCR_WORKSPACE')
                )
        );

So it looks like ??= new \Jackalope\RepositoryFactoryDoctrineDBAL()->
Should be:
??= (new \Jackalope\RepositoryFactoryDoctrineDBAL()).

Used PHP version: 8.1.6

How to reproduce

Copy following snippet into your terminal to reproduce it (requires PHP 8.1):

git clone [email protected]:sulu/sulu.git
cd sulu
git remote add alex [email protected]:alexander-schranz/sulu.git
git checkout alex/enhancement/update-from-skeleton
composer config minimum-stability dev
composer update

bin/console cache:clear

Possible Solution

Not sure what does cause the issue yet. It does not appear on 6.1.0 so maybe its also just a current @dev problem. Just thought I already greate an issue so maybe avoiding that it maybe can be target before being tagged.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions