Skip to content

Commit

Permalink
Change namespace from App to Acme\App to better comply with PSR-4
Browse files Browse the repository at this point in the history
2.1 The fully qualified class name MUST have a top-level namespace name,
    also known as a “vendor namespace”.

https://www.php-fig.org/psr/psr-4/
  • Loading branch information
hgraca committed Apr 13, 2018
1 parent c08fd71 commit ca4ed0c
Show file tree
Hide file tree
Showing 48 changed files with 105 additions and 105 deletions.
2 changes: 1 addition & 1 deletion bin/console
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env php
<?php

use App\Kernel;
use Acme\App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@
},
"autoload": {
"psr-4": {
"App\\": "src/"
"Acme\\App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
"Acme\\App\\Tests\\": "tests/"
}
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion config/packages/doctrine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ doctrine:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
prefix: 'Acme\App\Entity'
alias: App
2 changes: 1 addition & 1 deletion config/packages/doctrine_migrations.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
doctrine_migrations:
dir_name: '%kernel.project_dir%/src/Migrations'
# namespace is arbitrary but should be different from App\Migrations
# namespace is arbitrary but should be different from Acme\App\Migrations
# as migrations classes should NOT be autoloaded
namespace: DoctrineMigrations
4 changes: 2 additions & 2 deletions config/packages/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ security:
encoders:
# Our user class and the algorithm we'll use to encode passwords
# https://symfony.com/doc/current/security.html#c-encoding-the-user-s-password
App\Entity\User: bcrypt
Acme\App\Entity\User: bcrypt

providers:
# https://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded
# In this example, users are stored via Doctrine in the database
# To see the users at src/App/DataFixtures/ORM/LoadFixtures.php
# To load users from somewhere else: https://symfony.com/doc/current/security/custom_provider.html
database_users:
entity: { class: App\Entity\User, property: username }
entity: { class: Acme\App\Entity\User, property: username }

# https://symfony.com/doc/current/security.html#initial-security-yml-setup-authentication
firewalls:
Expand Down
2 changes: 1 addition & 1 deletion config/packages/test/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ security:
encoders:
# to make tests much faster, BCrypt cost is changed to its minimum allowed value (4)
# See https://symfony.com/doc/current/reference/configuration/security.html#using-the-bcrypt-password-encoder
App\Entity\User: { algorithm: bcrypt, cost: 4 }
Acme\App\Entity\User: { algorithm: bcrypt, cost: 4 }

firewalls:
main:
Expand Down
4 changes: 2 additions & 2 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ services:

# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
App\:
Acme\App\:
resource: '../src/*'
# you can exclude directories or files
# but if a service is unused, it's removed anyway
exclude: '../src/{Entity,Migrations,Tests}'

# when the service definition only contains arguments, you can omit the
# 'arguments' key and define the arguments just below the service class
App\EventSubscriber\CommentNotificationSubscriber:
Acme\App\EventSubscriber\CommentNotificationSubscriber:
$sender: '%app.notifications.email_sender%'
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
>
<php>
<ini name="error_reporting" value="-1" />
<env name="KERNEL_CLASS" value="App\Kernel" />
<env name="KERNEL_CLASS" value="Acme\App\Kernel" />
<env name="APP_ENV" value="test"/>
<env name="APP_DEBUG" value="1"/>
<env name="APP_SECRET" value="5a79a1c866efef9ca1800f971d689f3e"/>
Expand Down
2 changes: 1 addition & 1 deletion public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

use App\Kernel;
use Acme\App\Kernel;
use Symfony\Component\Debug\Debug;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\HttpFoundation\Request;
Expand Down
8 changes: 4 additions & 4 deletions src/Command/AddUserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
* file that was distributed with this source code.
*/

namespace App\Command;
namespace Acme\App\Command;

use App\Entity\User;
use App\Repository\UserRepository;
use App\Utils\Validator;
use Acme\App\Entity\User;
use Acme\App\Repository\UserRepository;
use Acme\App\Utils\Validator;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Exception\RuntimeException;
Expand Down
8 changes: 4 additions & 4 deletions src/Command/DeleteUserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
* file that was distributed with this source code.
*/

namespace App\Command;
namespace Acme\App\Command;

use App\Entity\User;
use App\Repository\UserRepository;
use App\Utils\Validator;
use Acme\App\Entity\User;
use Acme\App\Repository\UserRepository;
use Acme\App\Utils\Validator;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Exception\RuntimeException;
Expand Down
6 changes: 3 additions & 3 deletions src/Command/ListUsersCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
* file that was distributed with this source code.
*/

namespace App\Command;
namespace Acme\App\Command;

use App\Entity\User;
use App\Repository\UserRepository;
use Acme\App\Entity\User;
use Acme\App\Repository\UserRepository;
use Swift_Mailer;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
Expand Down
10 changes: 5 additions & 5 deletions src/Controller/Admin/BlogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
* file that was distributed with this source code.
*/

namespace App\Controller\Admin;
namespace Acme\App\Controller\Admin;

use App\Entity\Post;
use App\Form\PostType;
use App\Repository\PostRepository;
use App\Utils\Slugger;
use Acme\App\Entity\Post;
use Acme\App\Form\PostType;
use Acme\App\Repository\PostRepository;
use Acme\App\Utils\Slugger;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
Expand Down
12 changes: 6 additions & 6 deletions src/Controller/BlogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
* file that was distributed with this source code.
*/

namespace App\Controller;
namespace Acme\App\Controller;

use App\Entity\Comment;
use App\Entity\Post;
use App\Events;
use App\Form\CommentType;
use App\Repository\PostRepository;
use Acme\App\Entity\Comment;
use Acme\App\Entity\Post;
use Acme\App\Events;
use Acme\App\Form\CommentType;
use Acme\App\Repository\PostRepository;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/SecurityController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace App\Controller;
namespace Acme\App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
Expand Down
12 changes: 6 additions & 6 deletions src/DataFixtures/AppFixtures.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
* file that was distributed with this source code.
*/

namespace App\DataFixtures;
namespace Acme\App\DataFixtures;

use App\Entity\Comment;
use App\Entity\Post;
use App\Entity\Tag;
use App\Entity\User;
use App\Utils\Slugger;
use Acme\App\Entity\Comment;
use Acme\App\Entity\Post;
use Acme\App\Entity\Tag;
use Acme\App\Entity\User;
use Acme\App\Utils\Slugger;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
Expand Down
4 changes: 2 additions & 2 deletions src/Entity/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace App\Entity;
namespace Acme\App\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
Expand Down Expand Up @@ -71,7 +71,7 @@ class Comment
/**
* @var User
*
* @ORM\ManyToOne(targetEntity="App\Entity\User")
* @ORM\ManyToOne(targetEntity="Acme\App\Entity\User")
* @ORM\JoinColumn(nullable=false)
*/
private $author;
Expand Down
8 changes: 4 additions & 4 deletions src/Entity/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
* file that was distributed with this source code.
*/

namespace App\Entity;
namespace Acme\App\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

/**
* @ORM\Entity(repositoryClass="App\Repository\PostRepository")
* @ORM\Entity(repositoryClass="Acme\App\Repository\PostRepository")
* @ORM\Table(name="symfony_demo_post")
*
* Defines the properties of the Post entity to represent the blog posts.
Expand Down Expand Up @@ -93,7 +93,7 @@ class Post
/**
* @var User
*
* @ORM\ManyToOne(targetEntity="App\Entity\User")
* @ORM\ManyToOne(targetEntity="Acme\App\Entity\User")
* @ORM\JoinColumn(nullable=false)
*/
private $author;
Expand All @@ -114,7 +114,7 @@ class Post
/**
* @var Tag[]|ArrayCollection
*
* @ORM\ManyToMany(targetEntity="App\Entity\Tag", cascade={"persist"})
* @ORM\ManyToMany(targetEntity="Acme\App\Entity\Tag", cascade={"persist"})
* @ORM\JoinTable(name="symfony_demo_post_tag")
* @ORM\OrderBy({"name": "ASC"})
* @Assert\Count(max="4", maxMessage="post.too_many_tags")
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace App\Entity;
namespace Acme\App\Entity;

use Doctrine\ORM\Mapping as ORM;

Expand Down
4 changes: 2 additions & 2 deletions src/Entity/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
* file that was distributed with this source code.
*/

namespace App\Entity;
namespace Acme\App\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;

/**
* @ORM\Entity(repositoryClass="App\Repository\UserRepository")
* @ORM\Entity(repositoryClass="Acme\App\Repository\UserRepository")
* @ORM\Table(name="symfony_demo_user")
*
* Defines the properties of the User entity to represent the application users.
Expand Down
2 changes: 1 addition & 1 deletion src/EventSubscriber/CheckRequirementsSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace App\EventSubscriber;
namespace Acme\App\EventSubscriber;

use Doctrine\DBAL\Exception\DriverException;
use Doctrine\ORM\EntityManagerInterface;
Expand Down
6 changes: 3 additions & 3 deletions src/EventSubscriber/CommentNotificationSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
* file that was distributed with this source code.
*/

namespace App\EventSubscriber;
namespace Acme\App\EventSubscriber;

use App\Entity\Comment;
use App\Events;
use Acme\App\Entity\Comment;
use Acme\App\Events;
use Swift_Mailer;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
Expand Down
4 changes: 2 additions & 2 deletions src/EventSubscriber/ControllerSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* file that was distributed with this source code.
*/

namespace App\EventSubscriber;
namespace Acme\App\EventSubscriber;

use App\Twig\SourceCodeExtension;
use Acme\App\Twig\SourceCodeExtension;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
use Symfony\Component\HttpKernel\KernelEvents;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace App\EventSubscriber;
namespace Acme\App\EventSubscriber;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
Expand Down
2 changes: 1 addition & 1 deletion src/Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace App;
namespace Acme\App;

/**
* This class defines the names of all the events dispatched in
Expand Down
4 changes: 2 additions & 2 deletions src/Form/CommentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* file that was distributed with this source code.
*/

namespace App\Form;
namespace Acme\App\Form;

use App\Entity\Comment;
use Acme\App\Entity\Comment;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
Expand Down
6 changes: 3 additions & 3 deletions src/Form/DataTransformer/TagArrayToStringTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* file that was distributed with this source code.
*/

namespace App\Form\DataTransformer;
namespace Acme\App\Form\DataTransformer;

use App\Entity\Tag;
use Acme\App\Entity\Tag;
use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Component\Form\DataTransformerInterface;

Expand Down Expand Up @@ -71,7 +71,7 @@ public function reverseTransform($string): array
$tags[] = $tag;

// There's no need to persist these new tags because Doctrine does that automatically
// thanks to the cascade={"persist"} option in the App\Entity\Post::$tags property.
// thanks to the cascade={"persist"} option in the Acme\App\Entity\Post::$tags property.
}

// Return an array of tags to transform them back into a Doctrine Collection.
Expand Down
8 changes: 4 additions & 4 deletions src/Form/PostType.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
* file that was distributed with this source code.
*/

namespace App\Form;
namespace Acme\App\Form;

use App\Entity\Post;
use App\Form\Type\DateTimePickerType;
use App\Form\Type\TagsInputType;
use Acme\App\Entity\Post;
use Acme\App\Form\Type\DateTimePickerType;
use Acme\App\Form\Type\TagsInputType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
Expand Down
Loading

0 comments on commit ca4ed0c

Please sign in to comment.