Skip to content

Commit

Permalink
NameableInterface::setName add missing null case as it is mentioned…
Browse files Browse the repository at this point in the history
… on the trait

+ `NameableTrait::name` property scope set as protected
+ `PersonNameableTrait::getInitial` use mb_substr for string with first accentuated character
  • Loading branch information
mathieu-ducrot committed Sep 19, 2024
1 parent fe4b6d7 commit 655b557
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
CHANGELOG for 1.x
===================
## v1.11.0 - (2024-09-19)
### Added
`CreatableTrait` Trait & interface with creation date
`MonthYearTrait` Trait & interface with numeric representation of a month and his numeric year. Useful for statistics purposes.

### Changed
`README.md` update : Add missing nelmio security settings configuration (@lfortunier)

### Fixed
- `HistoryLogger` add missing STATUS_PROPERTY check on **log** update skip
- `NameableInterface::setName` add missing null case as it is mentioned on the trait
- `NameableTrait::name` property scope set as protected
- `PersonNameableTrait::getInitial` use mb_substr for string with first accentuated character

## v1.10.0 - (2024-08-28)
### Added
- `ArrayUtils::hasDuplicateValue` + tests (@lfortunier)
Expand Down
3 changes: 0 additions & 3 deletions CHANGELOG_add_trait_monthelable_and_created.md

This file was deleted.

2 changes: 0 additions & 2 deletions CHANGELOG_update_nelmio_security_doc.md

This file was deleted.

2 changes: 1 addition & 1 deletion src/Entity/NameableInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ interface NameableInterface
{
public function getName(): ?string;

public function setName(string $name): self;
public function setName(?string $name): self;
}
2 changes: 1 addition & 1 deletion src/Entity/NameableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ trait NameableTrait
#[ORM\Column(length: 255)]
#[Assert\Length(max: 255)]
#[Assert\NotBlank]
private ?string $name = null;
protected ?string $name = null;

public function getName(): ?string
{
Expand Down
4 changes: 2 additions & 2 deletions src/Entity/PersonNameableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public function getInitial(): string
{
return sprintf(
'%s%s',
substr(trim($this->getFirstName()), 0, 1),
substr(trim($this->getLastName()), 0, 1)
mb_substr(trim($this->getFirstName()), 0, 1),
mb_substr(trim($this->getLastName()), 0, 1)
);
}

Expand Down

0 comments on commit 655b557

Please sign in to comment.