Skip to content

Commit

Permalink
Bump coding standard to v11 (#10295)
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus authored Dec 13, 2022
1 parent 4e6cb90 commit 83f6356
Show file tree
Hide file tree
Showing 203 changed files with 345 additions and 66 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
"require-dev": {
"doctrine/annotations": "^1.13",
"doctrine/coding-standard": "^9.0.2 || ^10.0",
"doctrine/coding-standard": "^9.0.2 || ^11.0",
"phpbench/phpbench": "^0.16.10 || ^1.0",
"phpstan/phpstan": "~1.4.10 || 1.9.3",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
Expand Down
1 change: 1 addition & 0 deletions lib/Doctrine/ORM/Mapping/Driver/SimplifiedXmlDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class SimplifiedXmlDriver extends XmlDriver
public function __construct($prefixes, $fileExtension = self::DEFAULT_FILE_EXTENSION)
{
$locator = new SymfonyFileLocator((array) $prefixes, $fileExtension);

parent::__construct($locator, $fileExtension);
}
}
1 change: 1 addition & 0 deletions lib/Doctrine/ORM/Mapping/Driver/SimplifiedYamlDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class SimplifiedYamlDriver extends YamlDriver
public function __construct($prefixes, $fileExtension = self::DEFAULT_FILE_EXTENSION)
{
$locator = new SymfonyFileLocator((array) $prefixes, $fileExtension);

parent::__construct($locator, $fileExtension);
}
}
1 change: 1 addition & 0 deletions lib/Doctrine/ORM/OptimisticLockException.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class OptimisticLockException extends ORMException
public function __construct($msg, $entity)
{
parent::__construct($msg);

$this->entity = $entity;
}

Expand Down
1 change: 1 addition & 0 deletions lib/Doctrine/ORM/Proxy/ProxyFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public function __construct(EntityManagerInterface $em, $proxyDir, $proxyNs, $au
$proxyGenerator = new ProxyGenerator($proxyDir, $proxyNs);

$proxyGenerator->setPlaceholder('baseProxyInterface', Proxy::class);

parent::__construct($proxyGenerator, $em->getMetadataFactory(), $autoGenerate);

$this->em = $em;
Expand Down
4 changes: 3 additions & 1 deletion tests/Doctrine/Tests/Models/CMS/CmsAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ class CmsAddress
* @Id
* @GeneratedValue
*/
#[ORM\Id, ORM\GeneratedValue, ORM\Column(type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
public $id;

/**
Expand Down
11 changes: 8 additions & 3 deletions tests/Doctrine/Tests/Models/Cache/City.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
* @Entity
* @Table("cache_city")
*/
#[ORM\Entity, ORM\Table(name: 'cache_city'), ORM\Cache]
#[ORM\Entity]
#[ORM\Table(name: 'cache_city')]
#[ORM\Cache]
class City
{
/**
Expand All @@ -34,7 +36,9 @@ class City
* @GeneratedValue
* @Column(type="integer")
*/
#[ORM\Id, ORM\GeneratedValue, ORM\Column(type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
protected $id;

/**
Expand Down Expand Up @@ -68,7 +72,8 @@ class City
* @OrderBy({"name" = "ASC"})
* @OneToMany(targetEntity="Attraction", mappedBy="city")
*/
#[ORM\Cache, ORM\OrderBy(['name' => 'ASC'])]
#[ORM\Cache]
#[ORM\OrderBy(['name' => 'ASC'])]
#[ORM\OneToMany(targetEntity: 'Attraction', mappedBy: 'city')]
public $attractions;

Expand Down
7 changes: 5 additions & 2 deletions tests/Doctrine/Tests/Models/Company/CompanyContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
* ),
* })
*/
#[ORM\Entity, ORM\Table(name: 'company_contracts')]
#[ORM\Entity]
#[ORM\Table(name: 'company_contracts')]
#[ORM\InheritanceType('SINGLE_TABLE')]
#[ORM\DiscriminatorColumn(name: 'discr', type: 'string')]
#[ORM\DiscriminatorMap(['fix' => 'CompanyFixContract', 'flexible' => 'CompanyFlexContract', 'flexultra' => 'CompanyFlexUltraContract'])]
Expand All @@ -94,7 +95,9 @@ abstract class CompanyContract
* @Column(type="integer")
* @GeneratedValue
*/
#[ORM\Id, ORM\Column(type: 'integer'), ORM\GeneratedValue]
#[ORM\Id]
#[ORM\Column(type: 'integer')]
#[ORM\GeneratedValue]
private $id;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ class DDC1476EntityWithDefaultFieldType
* @Column()
* @GeneratedValue("NONE")
*/
#[ORM\Id, ORM\Column, ORM\GeneratedValue(strategy: 'NONE')]
#[ORM\Id]
#[ORM\Column]
#[ORM\GeneratedValue(strategy: 'NONE')]
protected $id;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
* @Entity
* @Table(name="explicit_table", schema="explicit_schema")
*/
#[ORM\Entity, ORM\Table(name: 'explicit_table', schema: 'explicit_schema')]
#[ORM\Entity]
#[ORM\Table(name: 'explicit_table', schema: 'explicit_schema')]
class ExplicitSchemaAndTable
{
/**
Expand All @@ -24,6 +25,8 @@ class ExplicitSchemaAndTable
* @Column(type="integer")
* @GeneratedValue(strategy="AUTO")
*/
#[ORM\Id, ORM\Column(type: 'integer'), ORM\GeneratedValue(strategy: 'AUTO')]
#[ORM\Id]
#[ORM\Column(type: 'integer')]
#[ORM\GeneratedValue(strategy: 'AUTO')]
public $id;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
* @Entity
* @Table(name="implicit_schema.implicit_table")
*/
#[ORM\Entity, ORM\Table(name: 'implicit_schema.implicit_table')]
#[ORM\Entity]
#[ORM\Table(name: 'implicit_schema.implicit_table')]
class SchemaAndTableInTableName
{
/**
Expand All @@ -27,6 +28,8 @@ class SchemaAndTableInTableName
* @Column(type="integer")
* @GeneratedValue(strategy="AUTO")
*/
#[ORM\Id, ORM\Column(type: 'integer'), ORM\GeneratedValue(strategy: 'AUTO')]
#[ORM\Id]
#[ORM\Column(type: 'integer')]
#[ORM\GeneratedValue(strategy: 'AUTO')]
public $id;
}
4 changes: 3 additions & 1 deletion tests/Doctrine/Tests/Models/DDC3579/DDC3579Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class DDC3579Group
* @Id
* @Column(type="integer")
*/
#[Id, GeneratedValue, Column(type: 'integer')]
#[Id]
#[GeneratedValue]
#[Column(type: 'integer')]
private $id;

/**
Expand Down
4 changes: 3 additions & 1 deletion tests/Doctrine/Tests/Models/DDC3579/DDC3579User.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class DDC3579User
* @GeneratedValue
* @Column(type="integer", name="user_id", length=150)
*/
#[Id, GeneratedValue, Column(type: 'integer', name: 'user_id', length: 150)]
#[Id]
#[GeneratedValue]
#[Column(type: 'integer', name: 'user_id', length: 150)]
protected $id;

/**
Expand Down
1 change: 1 addition & 0 deletions tests/Doctrine/Tests/Models/DDC3597/DDC3597Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class DDC3597Image extends DDC3597Media
public function __construct(string $distributionHash)
{
parent::__construct($distributionHash);

$this->dimension = new DDC3597Dimension();
}

Expand Down
4 changes: 3 additions & 1 deletion tests/Doctrine/Tests/Models/DDC5934/DDC5934BaseContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ class DDC5934BaseContract
* @Column(name="id", type="integer")
* @GeneratedValue()
*/
#[Id, Column, GeneratedValue]
#[Id]
#[Column]
#[GeneratedValue]
public $id;

/**
Expand Down
4 changes: 3 additions & 1 deletion tests/Doctrine/Tests/Models/DDC869/DDC869Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ class DDC869Payment
* @Column(type="integer")
* @GeneratedValue
*/
#[ORM\Id, ORM\Column(type: 'integer'), ORM\GeneratedValue]
#[ORM\Id]
#[ORM\Column(type: 'integer')]
#[ORM\GeneratedValue]
protected $id;

/**
Expand Down
4 changes: 3 additions & 1 deletion tests/Doctrine/Tests/Models/DDC964/DDC964User.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ class DDC964User
* @GeneratedValue
* @Column(type="integer", name="user_id", length=150)
*/
#[Id, GeneratedValue, Column(type: 'integer', name: 'user_id', length: 150)]
#[Id]
#[GeneratedValue]
#[Column(type: 'integer', name: 'user_id', length: 150)]
protected $id;

/**
Expand Down
4 changes: 3 additions & 1 deletion tests/Doctrine/Tests/Models/Enums/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ class Card
* @Id @GeneratedValue @Column(type="integer")
* @var int
*/
#[Id, GeneratedValue, Column(type: 'integer')]
#[Id]
#[GeneratedValue]
#[Column(type: 'integer')]
public $id;

/**
Expand Down
3 changes: 2 additions & 1 deletion tests/Doctrine/Tests/Models/Enums/CardWithDefault.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
#[Entity]
class CardWithDefault
{
#[Id, Column]
#[Id]
#[Column]
public string $id;

#[Column(options: ['default' => Suit::Hearts])]
Expand Down
4 changes: 3 additions & 1 deletion tests/Doctrine/Tests/Models/Enums/CardWithNullable.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ class CardWithNullable
* @Id @GeneratedValue @Column(type="integer")
* @var int
*/
#[Id, GeneratedValue, Column(type: 'integer')]
#[Id]
#[GeneratedValue]
#[Column(type: 'integer')]
public $id;

/**
Expand Down
4 changes: 3 additions & 1 deletion tests/Doctrine/Tests/Models/Enums/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
#[Entity]
class Product
{
#[Id, GeneratedValue, Column(type: 'integer')]
#[Id]
#[GeneratedValue]
#[Column(type: 'integer')]
public int $id;

#[Embedded(class: Quantity::class)]
Expand Down
4 changes: 3 additions & 1 deletion tests/Doctrine/Tests/Models/Enums/Scale.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ class Scale
* @Id @GeneratedValue @Column(type="integer")
* @var int
*/
#[Id, GeneratedValue, Column(type: 'integer')]
#[Id]
#[GeneratedValue]
#[Column(type: 'integer')]
public $id;

/**
Expand Down
4 changes: 3 additions & 1 deletion tests/Doctrine/Tests/Models/Enums/TypedCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
#[Entity]
class TypedCard
{
#[Id, GeneratedValue, Column]
#[Id]
#[GeneratedValue]
#[Column]
public int $id;

#[Column]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ class TypedCardEnumCompositeId
* @ORM\Id()
* @ORM\Column(type="string", enumType=Suit::class)
*/
#[Id, Column(type: 'string', enumType: Suit::class)]
#[Id]
#[Column(type: 'string', enumType: Suit::class)]
public Suit $suit;

/**
* @ORM\Id()
* @ORM\Column(type="string", enumType=Unit::class)
*/
#[Id, Column(type: 'string', enumType: Unit::class)]
#[Id]
#[Column(type: 'string', enumType: Unit::class)]
public Unit $unit;
}
3 changes: 2 additions & 1 deletion tests/Doctrine/Tests/Models/Enums/TypedCardEnumId.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class TypedCardEnumId
* @ORM\Id()
* @ORM\Column(type="string", enumType=Suit::class)
*/
#[Id, Column(type: 'string', enumType: Suit::class)]
#[Id]
#[Column(type: 'string', enumType: Suit::class)]
public Suit $suit;
}
7 changes: 5 additions & 2 deletions tests/Doctrine/Tests/Models/ReadonlyProperties/Author.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\Table;

#[Entity, Table(name: 'author')]
#[Entity]
#[Table(name: 'author')]
class Author
{
#[Column, Id, GeneratedValue(strategy: 'IDENTITY')]
#[Column]
#[Id]
#[GeneratedValue(strategy: 'IDENTITY')]
private readonly int $id;

#[Column]
Expand Down
10 changes: 7 additions & 3 deletions tests/Doctrine/Tests/Models/ReadonlyProperties/Book.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,20 @@
use Doctrine\ORM\Mapping\ManyToMany;
use Doctrine\ORM\Mapping\Table;

#[Entity, Table(name: 'book')]
#[Entity]
#[Table(name: 'book')]
class Book
{
#[Column, Id, GeneratedValue(strategy: 'IDENTITY')]
#[Column]
#[Id]
#[GeneratedValue(strategy: 'IDENTITY')]
private readonly int $id;

#[Column]
private readonly string $title;

#[ManyToMany(targetEntity: Author::class), JoinTable(name: 'book_author')]
#[ManyToMany(targetEntity: Author::class)]
#[JoinTable(name: 'book_author')]
private readonly Collection $authors;

public function __construct()
Expand Down
10 changes: 7 additions & 3 deletions tests/Doctrine/Tests/Models/ReadonlyProperties/SimpleBook.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,20 @@
use Doctrine\ORM\Mapping\ManyToOne;
use Doctrine\ORM\Mapping\Table;

#[Entity, Table(name: 'simple_book')]
#[Entity]
#[Table(name: 'simple_book')]
class SimpleBook
{
#[Column, Id, GeneratedValue(strategy: 'IDENTITY')]
#[Column]
#[Id]
#[GeneratedValue(strategy: 'IDENTITY')]
private readonly int $id;

#[Column]
private readonly string $title;

#[ManyToOne, JoinColumn(nullable: false)]
#[ManyToOne]
#[JoinColumn(nullable: false)]
private readonly Author $author;

public function getId(): int
Expand Down
Loading

0 comments on commit 83f6356

Please sign in to comment.