Skip to content

Starting New Symfony Project

First QA Run

Now we have PHPQA installed, we need to confirm that the current codebase is passing - at least up the level of Infection which will fail as there is basically no code and so no coverage

./bin/qa

Common Issues

Stan Issues

Kernel Boolean

find

        $container->setParameter('container.dumper.inline_class_loader', \PHP_VERSION_ID < 70400 || false !== ini_get('opcache.preload'));

replace

        $container->setParameter('container.dumper.inline_class_loader',
                                 \PHP_VERSION_ID < 70400 || false !== ini_get('opcache.preload'));

Prepare Next Commit

Once we have QA passing up to the level of infection, we should commit and push

Then add, commit and push

git add -A
git commit -am 'next commit - basic deps installed, QA running up to infection'
git push

Setting Up PHPStorm

Now we have a very basic bootstrapped symfony project, we need to properly set it up in PHPStorm to get the most out of it

You need to ensure you have all these extensions installed

Enable the Symfony Integration

By default this is disabled. To get the most out of the project, you should enable it by opening settings, searching for "symfony" and then ticking the box

You also need to make the following changes:

TODO - wrap this up

Configure PHPUnit

You need to be able to run single tests via PHPStorm

You should create a custom phpunit-phpstorm.xml in your qaConfig folder

This shoul be a copy of the standard one, but with the <logging> section entirely removed so that you don't waste CPU cycles building coverage reports for single tests.

Once you have created the file, you should configure PHPStorm to use it in the PHPUnit settings

Creating Services

The next thing you should do is start to create the services that your proejct is going to require

This means creating classes in your src folder and creating tests, generally in the tests/Small or if needs be, tests/Medium folders.

Your tests should extend from the AbstractServiceTest

You also need to make sure you have copied config/services.yml