Peter Josjka
Peter Josjka

Reputation: 1

Symfony: How to name classes/namespaces when the actual name begins with a digit

How would you name namespaces or classes when a project or company name (e.g. 37signals) begins with a digit? Symfony does not let you name your namespace "37signals/BlogBundle".

Upvotes: 0

Views: 218

Answers (2)

codemaster
codemaster

Reputation: 572

Start your namespace or project name with a "_" as prefix in such cases like "_37signals/BlogBundle" in your case.

Upvotes: 1

leejmurphy
leejmurphy

Reputation: 984

Seeing as Symfony is written in PHP this would make sense. You can read the official PHP definition for a valid class name here - http://php.net/manual/en/language.oop5.basic.php

You can have numbers, but not at the start of the class name. Perhaps use Signals37, Signals or ThirtySevenSignals. I would personally just drop the numbers and use Signals.

Upvotes: 0

Related Questions