[FrameworkBundle] Place initialization of $bundlesDir out of foreach loop

Code enhancement. $bundlesDir variable doesnt't need any bundle information for initialization. So it must be placed out of the loop to not process unnecessary operations.
merged branch alexpods/patch-1 (PR #7891)

This PR was merged into the master branch.

Discussion
----------

[FrameworkBundle] Place initialization of $bundlesDir out of the foreach loop.

Code enhancement. $bundlesDir variable doesn't need any bundle information for initialization. So it must be placed out of the loop to not process unnecessary operations.

Commits
-------

9cca065 [FrameworkBundle] Place initialization of $bundlesDir out of foreach loop