Question

To maintain code integrity across our servers we'd like to keep the /vendor/* directory under source control, rather than use composer to download files each time we roll out onto another server - i.e. we can be certain that the /vendor/* files are identical.

We run a syntax checker against all files committed to source control and run across the following error:

File '/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Resources/skeleton/bundle/Bundle.php' failed the PHP syntax check with the following error:
PHP Parse error:  syntax error, unexpected '}', expecting T_NS_SEPARATOR in /vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Resources/skeleton/bundle/Bundle.php on line 3

Is the "error" in this file intentional ? Any help appreciated. File contents below:

<?php
namespace {{ namespace }};

use Symfony\Component\HttpKernel\Bundle\Bundle;

class {{ bundle }} extends Bundle
{
}
Was it helpful?

Solution

Yes, the "error" in this file is intentional as it is not really to be proceed by php "as is". It is a template used by the command app/console generate:bundle to generate a bundle.

So {{ namespace }} will be replaced by a real namespace and {{ bundle }} by the bundle name you choose when you generate the bundle.

OTHER TIPS

First you must check if php/bin is on your $PATH.

PATH=$PATH: /your/path/to/php/bin
export PATH

Besides make sure that PHP can execute with CLI (in shell with exec).

Second check your server requirements, which are for running Sympony2:

You can easily see if your system passes all requirements by running the web/config.php in your Symfony distribution. Since the CLI often uses a different php.ini configuration file, it's also a good idea to check your requirements from the command line via:

php app/check.php

Required:

  1. PHP needs to be a minimum version of PHP 5.3.2
  2. Sqlite3 needs to be enabled
  3. JSON needs to be enabled
  4. ctype needs to be enabled
  5. Your PHP.ini needs to have the date.timezone setting

Optional:

  1. You need to have the PHP-XML module installed
  2. You need to have at least version 2.6.21 of libxml
  3. PHP tokenizer needs to be enabled
  4. mbstring functions need to be enabled
  5. iconv needs to be enabled
  6. POSIX needs to be enabled (only on *nix)
  7. Intl needs to be installed with ICU 4+
  8. APC 3.0.17+ (or another opcode cache needs to be installed)
  9. PHP.ini recommended settings
    9.1. short_open_tag = Off
    9.2. magic_quotes_gpc = Off
    9.3. register_globals = Off
    9.4. session.autostart = Off

If you want to use Doctrine, you will need to have PDO installed. Additionally, you need to have the PDO driver installed for the database server you want to use.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top