Can I put namespace in old classes?

3

Well, I work for a company that has a huge system, and we used Doctrine to do the mapping of our tables, but this is a very old one. We used Doctrine a long time ago and we were not aware of namespaces at the time. / p>

Now if I just put the namespace in all DAO classes to use in the whole system with the help of the compositor's autoload PSR4 would it cause some system error, or would it work normal?

    
asked by anonymous 14.08.2017 / 16:01

1 answer

2

As you may already know and as already described in the comment of this question the namespaces is intended to avoid name conflicts. Such conflicts may occur in relation to the names of:

  • Classes;
  • Functions;
  • Variables; and
  • Constants.
  • As you mentioned your legacy project does not currently use namespaces and works perfectly. This means that there are no name conflicts in the above cases.

    Before making this change, there is only one requirement. Your PHP version should be >= 5.3.0 .

    If this is ok, there will be no objection. This change will only benefit the maintenance of the system as a whole. Great decision.

        
    14.08.2017 / 16:43