Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow friendsofphp/php-cs-fixer >= 3.10 #2626

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,18 @@
'no_homoglyph_names' => true,
'no_null_property_initialization' => true,
'no_superfluous_elseif' => true,
'no_superfluous_phpdoc_tags' => false,
'no_unset_on_property' => true,
'no_useless_else' => true,
'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => true],
'ordered_class_elements' => true,
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'phpdoc_order' => ['order' => ['param', 'throws', 'return']],
'phpdoc_separation' => ['groups' => [
['Gedmo\\*'],
['ODM\\*'],
['ORM\\*'],
]],
'phpdoc_summary' => false,
'phpdoc_to_comment' => false,
'php_unit_construct' => true,
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"doctrine/doctrine-bundle": "^2.3",
"doctrine/mongodb-odm": "^2.3",
"doctrine/orm": "^2.14.0",
"friendsofphp/php-cs-fixer": "^3.4.0 <3.10",
"friendsofphp/php-cs-fixer": "^3.14.0",
"nesbot/carbon": "^2.55",
"phpstan/phpstan": "^1.10.2",
"phpstan/phpstan-doctrine": "^1.0",
Expand Down
14 changes: 14 additions & 0 deletions example/app/Entity/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@

/**
* @Gedmo\Tree(type="nested")
*
* @ORM\Table(name="ext_categories")
* @ORM\Entity(repositoryClass="App\Entity\Repository\CategoryRepository")
*
* @Gedmo\TranslationEntity(class="App\Entity\CategoryTranslation")
*/
class Category
Expand All @@ -34,6 +36,7 @@ class Category
* @var string|null
*
* @Gedmo\Translatable
*
* @ORM\Column(length=64)
*/
private $title;
Expand All @@ -42,6 +45,7 @@ class Category
* @var string|null
*
* @Gedmo\Translatable
*
* @ORM\Column(type="text", nullable=true)
*/
private $description;
Expand All @@ -51,37 +55,43 @@ class Category
*
* @Gedmo\Translatable
* @Gedmo\Slug(fields={"created", "title"})
*
* @ORM\Column(length=64, unique=true)
*/
private $slug;

/**
* @Gedmo\TreeLeft
*
* @ORM\Column(type="integer")
*/
private $lft;

/**
* @Gedmo\TreeRight
*
* @ORM\Column(type="integer")
*/
private $rgt;

/**
* @Gedmo\TreeParent
*
* @ORM\ManyToOne(targetEntity="Category", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="CASCADE")
*/
private $parent;

/**
* @Gedmo\TreeRoot
*
* @ORM\Column(type="integer", nullable=true)
*/
private $root;

/**
* @Gedmo\TreeLevel
*
* @ORM\Column(name="lvl", type="integer")
*/
private $level;
Expand All @@ -93,24 +103,28 @@ class Category

/**
* @Gedmo\Timestampable(on="create")
*
* @ORM\Column(type="datetime")
*/
private $created;

/**
* @Gedmo\Timestampable(on="update")
*
* @ORM\Column(type="datetime")
*/
private $updated;

/**
* @Gedmo\Blameable(on="create")
*
* @ORM\Column(type="string")
*/
private $createdBy;

/**
* @Gedmo\Blameable(on="update")
*
* @ORM\Column(type="string")
*/
private $updatedBy;
Expand Down
1 change: 1 addition & 0 deletions src/AbstractTrackingListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public function getSubscribedEvents()
* Maps additional metadata for the object.
*
* @param LoadClassMetadataEventArgs $eventArgs
*
* @phpstan-param LoadClassMetadataEventArgs<ClassMetadata<object>, ObjectManager> $eventArgs
*
* @return void
Expand Down
6 changes: 3 additions & 3 deletions src/Blameable/Mapping/Driver/Annotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ public function readExtendedMetadata($meta, array &$config)
$class = $this->getMetaReflectionClass($meta);
// property annotations
foreach ($class->getProperties() as $property) {
if ($meta->isMappedSuperclass && !$property->isPrivate() ||
$meta->isInheritedField($property->name) ||
isset($meta->associationMappings[$property->name]['inherited'])
if ($meta->isMappedSuperclass && !$property->isPrivate()
|| $meta->isInheritedField($property->name)
|| isset($meta->associationMappings[$property->name]['inherited'])
) {
continue;
}
Expand Down
4 changes: 4 additions & 0 deletions src/Blameable/Traits/BlameableDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ trait BlameableDocument
{
/**
* @var string
*
* @Gedmo\Blameable(on="create")
*
* @ODM\Field(type="string")
*/
#[ODM\Field(type: Type::STRING)]
Expand All @@ -31,7 +33,9 @@ trait BlameableDocument

/**
* @var string
*
* @Gedmo\Blameable(on="update")
*
* @ODM\Field(type="string")
*/
#[ODM\Field(type: Type::STRING)]
Expand Down
4 changes: 4 additions & 0 deletions src/Blameable/Traits/BlameableEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ trait BlameableEntity
{
/**
* @var string
*
* @Gedmo\Blameable(on="create")
*
* @ORM\Column(nullable=true)
*/
#[ORM\Column(nullable: true)]
Expand All @@ -30,7 +32,9 @@ trait BlameableEntity

/**
* @var string
*
* @Gedmo\Blameable(on="update")
*
* @ORM\Column(nullable=true)
*/
#[ORM\Column(nullable: true)]
Expand Down
6 changes: 3 additions & 3 deletions src/IpTraceable/Mapping/Driver/Annotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ public function readExtendedMetadata($meta, array &$config)
$class = $this->getMetaReflectionClass($meta);
// property annotations
foreach ($class->getProperties() as $property) {
if ($meta->isMappedSuperclass && !$property->isPrivate() ||
$meta->isInheritedField($property->name) ||
isset($meta->associationMappings[$property->name]['inherited'])
if ($meta->isMappedSuperclass && !$property->isPrivate()
|| $meta->isInheritedField($property->name)
|| isset($meta->associationMappings[$property->name]['inherited'])
) {
continue;
}
Expand Down
4 changes: 4 additions & 0 deletions src/IpTraceable/Traits/IpTraceableDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ trait IpTraceableDocument
{
/**
* @var string
*
* @Gedmo\IpTraceable(on="create")
*
* @ODM\Field(type="string")
*/
#[ODM\Field(type: Type::STRING)]
Expand All @@ -31,7 +33,9 @@ trait IpTraceableDocument

/**
* @var string
*
* @Gedmo\IpTraceable(on="update")
*
* @ODM\Field(type="string")
*/
#[ODM\Field(type: Type::STRING)]
Expand Down
4 changes: 4 additions & 0 deletions src/IpTraceable/Traits/IpTraceableEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ trait IpTraceableEntity
{
/**
* @var string
*
* @Gedmo\IpTraceable(on="create")
*
* @ORM\Column(length=45, nullable=true)
*/
#[ORM\Column(length: 45, nullable: true)]
Expand All @@ -30,7 +32,9 @@ trait IpTraceableEntity

/**
* @var string
*
* @Gedmo\IpTraceable(on="update")
*
* @ORM\Column(length=45, nullable=true)
*/
#[ORM\Column(length: 45, nullable: true)]
Expand Down
1 change: 1 addition & 0 deletions src/Loggable/Document/LogEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Gedmo\Loggable\Document\LogEntry
*
* @MongoODM\Document(repositoryClass="Gedmo\Loggable\Document\Repository\LogEntryRepository")
*
* @MongoODM\Index(keys={"objectId": "asc", "objectClass": "asc", "version": "asc"})
* @MongoODM\Index(keys={"loggedAt": "asc"})
* @MongoODM\Index(keys={"objectClass": "asc"})
Expand Down
3 changes: 3 additions & 0 deletions src/Loggable/LoggableListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public function getSubscribedEvents()
* Maps additional metadata
*
* @param LoadClassMetadataEventArgs $eventArgs
*
* @phpstan-param LoadClassMetadataEventArgs<ClassMetadata<object>, ObjectManager> $eventArgs
*
* @return void
Expand Down Expand Up @@ -209,9 +210,11 @@ public function onFlush(EventArgs $eventArgs)
* Get the LogEntry class
*
* @param string $class
*
* @phpstan-param class-string $class
*
* @return string
*
* @phpstan-return class-string<LogEntryInterface<T>>
*/
protected function getLogEntryClass(LoggableAdapter $ea, $class)
Expand Down
1 change: 1 addition & 0 deletions src/Loggable/Mapping/Event/LoggableAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ interface LoggableAdapter extends AdapterInterface
* Get the default object class name used to store the log entries.
*
* @return string
*
* @phpstan-return class-string
*/
public function getDefaultLogEntryClass();
Expand Down
2 changes: 2 additions & 0 deletions src/Mapping/Annotation/Blameable.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
* Blameable annotation for Blameable behavioral extension
*
* @Annotation
*
* @NamedArgumentConstructor
*
* @Target("PROPERTY")
*
* @author David Buchmann <[email protected]>
Expand Down
2 changes: 2 additions & 0 deletions src/Mapping/Annotation/IpTraceable.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
* IpTraceable annotation for IpTraceable behavioral extension
*
* @Annotation
*
* @NamedArgumentConstructor
*
* @Target("PROPERTY")
*
* @author Pierre-Charles Bertineau <[email protected]>
Expand Down
1 change: 1 addition & 0 deletions src/Mapping/Annotation/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* Language annotation for Translatable behavioral extension
*
* @Annotation
*
* @Target("PROPERTY")
*
* @author Gediminas Morkevicius <[email protected]>
Expand Down
1 change: 1 addition & 0 deletions src/Mapping/Annotation/Locale.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* Locale annotation for Translatable behavioral extension
*
* @Annotation
*
* @Target("PROPERTY")
*
* @author Gediminas Morkevicius <[email protected]>
Expand Down
2 changes: 2 additions & 0 deletions src/Mapping/Annotation/Loggable.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
* @phpstan-template T of LogEntryInterface
*
* @Annotation
*
* @NamedArgumentConstructor
*
* @Target("CLASS")
*
* @author Gediminas Morkevicius <[email protected]>
Expand Down
3 changes: 3 additions & 0 deletions src/Mapping/Annotation/Reference.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* to be user like "@ReferenceMany(type="entity", class="MyEntity", identifier="entity_id")"
*
* @author Bulat Shakirzyanov <[email protected]>
*
* @Annotation
*/
abstract class Reference implements GedmoAnnotation
Expand All @@ -25,12 +26,14 @@ abstract class Reference implements GedmoAnnotation

/**
* @var string|null
*
* @phpstan-var 'entity'|'document'|null
*/
public $type;

/**
* @var string|null
*
* @phpstan-var class-string|null
*/
public $class;
Expand Down
2 changes: 2 additions & 0 deletions src/Mapping/Annotation/ReferenceIntegrity.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
* ReferenceIntegrity annotation for ReferenceIntegrity behavioral extension
*
* @Annotation
*
* @NamedArgumentConstructor
*
* @Target("PROPERTY")
*
* @author Evert Harmeling <[email protected]>
Expand Down
2 changes: 2 additions & 0 deletions src/Mapping/Annotation/ReferenceMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
* to be user like "@ReferenceMany(type="entity", class="MyEntity", identifier="entity_id")"
*
* @author Bulat Shakirzyanov <[email protected]>
*
* @NamedArgumentConstructor
*
* @Annotation
*
* @final since gedmo/doctrine-extensions 3.11
Expand Down
1 change: 1 addition & 0 deletions src/Mapping/Annotation/ReferenceManyEmbed.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

/**
* @NamedArgumentConstructor
*
* @Annotation
*
* @final since gedmo/doctrine-extensions 3.11
Expand Down
2 changes: 2 additions & 0 deletions src/Mapping/Annotation/Slug.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
* Slug annotation for Sluggable behavioral extension
*
* @Annotation
*
* @NamedArgumentConstructor
*
* @Target("PROPERTY")
*
* @author Gediminas Morkevicius <[email protected]>
Expand Down
1 change: 1 addition & 0 deletions src/Mapping/Annotation/SlugHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* SlugHandler annotation for Sluggable behavioral extension
*
* @Annotation
*
* @NamedArgumentConstructor
*
* @author Gediminas Morkevicius <[email protected]>
Expand Down
Loading