Skip to content

Commit

Permalink
Fixed PHPDoc syntax (#311)
Browse files Browse the repository at this point in the history
* URLAlias: Fix $languageCodes class property's phpdoc

* AbstractInMemoryCollection.php: Fix phpstan VS phpdoc

* ArrayList.php: Fix phpstan VS phpdoc

* ArrayMap.php: Fix phpstan VS phpdoc

* phpstan-baseline.neon: Remove fixed `Unexpected token \"languageCodes\"` in URLAlias.php

* phpstan-baseline.neon: Rm related to URLAlias::$languageCodes fix

* phpstan-baseline.neon: Rm related to URLAlias::$languageCodes fix

---------

Co-authored-by: Adrien Dupuis <[email protected]>
  • Loading branch information
adriendupuis and adriendupuis authored Apr 16, 2024
1 parent 28ca460 commit f1ce2b2
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 34 deletions.
25 changes: 0 additions & 25 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -7375,11 +7375,6 @@ parameters:
count: 1
path: src/contracts/Repository/Values/Content/Trash/TrashItemDeleteResultList.php

-
message: "#^PHPDoc tag @property\\-read has invalid value \\(string\\[\\] languageCodes the languages for which this alias is valid\\)\\: Unexpected token \"languageCodes\", expected variable at offset 451$#"
count: 1
path: src/contracts/Repository/Values/Content/URLAlias.php

-
message: "#^Class Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\URLWildcard\\\\SearchResult implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#"
count: 1
Expand Down Expand Up @@ -21215,11 +21210,6 @@ parameters:
count: 1
path: src/lib/Repository/TrashService.php

-
message: "#^Access to protected property Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\URLAlias\\:\\:\\$languageCodes\\.$#"
count: 2
path: src/lib/Repository/URLAliasService.php

-
message: "#^Class Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Content\\\\UrlAlias referenced with incorrect case\\: Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Content\\\\URLAlias\\.$#"
count: 7
Expand Down Expand Up @@ -27370,11 +27360,6 @@ parameters:
count: 9
path: tests/integration/Core/Repository/ContentServiceTest.php

-
message: "#^Access to protected property Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\URLAlias\\:\\:\\$languageCodes\\.$#"
count: 2
path: tests/integration/Core/Repository/ContentServiceTest.php

-
message: "#^Argument of an invalid type Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\ContentMetadataUpdateStruct supplied for foreach, only iterables are supported\\.$#"
count: 1
Expand Down Expand Up @@ -38810,11 +38795,6 @@ parameters:
count: 1
path: tests/integration/Core/Repository/URLAliasServiceAuthorizationTest.php

-
message: "#^Access to protected property Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\URLAlias\\:\\:\\$languageCodes\\.$#"
count: 1
path: tests/integration/Core/Repository/URLAliasServiceTest.php

-
message: "#^Cannot access offset 0 on iterable\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\URLAlias\\>\\.$#"
count: 1
Expand Down Expand Up @@ -59800,11 +59780,6 @@ parameters:
count: 1
path: tests/lib/Repository/Service/Mock/SearchTest.php

-
message: "#^Access to protected property Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\URLAlias\\:\\:\\$languageCodes\\.$#"
count: 3
path: tests/lib/Repository/Service/Mock/UrlAliasTest.php

-
message: "#^Cannot access offset 0 on iterable\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\URLAlias\\>\\.$#"
count: 3
Expand Down
4 changes: 2 additions & 2 deletions src/contracts/Collection/AbstractInMemoryCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
*/
abstract class AbstractInMemoryCollection implements CollectionInterface, StreamableInterface
{
/** @var TValue[] */
/** @phpstan-var TValue[] */
protected array $items;

/**
* @param TValue[] $items
* @phpstan-param TValue[] $items
*/
public function __construct(array $items = [])
{
Expand Down
8 changes: 4 additions & 4 deletions src/contracts/Collection/ArrayList.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
class ArrayList extends AbstractInMemoryCollection implements ListInterface
{
/**
* @param TValue[] $items
* @phpstan-param TValue[] $items
*/
public function __construct(array $items = [])
{
Expand All @@ -45,17 +45,17 @@ public function last()
}

/**
* @param TValue $value
* @phpstan-param TValue $value
*/
public function contains($value): bool
{
return in_array($value, $this->items, true);
}

/**
* @param TValue[] $items
* @phpstan-param TValue[] $items
*
* @return \Ibexa\Contracts\Core\Collection\ArrayList<TValue>
* @phpstan-return \Ibexa\Contracts\Core\Collection\ArrayList<TValue>
*/
protected function createFrom(array $items): self
{
Expand Down
4 changes: 2 additions & 2 deletions src/contracts/Collection/ArrayMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ public function has($key): bool
}

/**
* @param TValue[] $items
* @phpstan-param TValue[] $items
*
* @return \Ibexa\Contracts\Core\Collection\ArrayMap<TKey,TValue>
* @phpstan-return \Ibexa\Contracts\Core\Collection\ArrayMap<TKey,TValue>
*/
protected function createFrom(array $items): self
{
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/Repository/Values/Content/URLAlias.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @property-read int $type The type of the URL Alias i.e. one of URLAlias::LOCATION, URLAlias::RESOURCE, URLAlias::VIRTUAL
* @property-read mixed $destination If type = URLAlias::LOCATION it is a Location id otherwise a string (e.g. /content/search)
* @property-read string $path the alias path
* @property-read string[] languageCodes the languages for which this alias is valid
* @property-read string[] $languageCodes the languages for which this alias is valid
* @property-read bool $alwaysAvailable Fallback indicator for other languages
* @property-read bool $isHistory Indicates that this alias was autogenerated for an in the meanwhile archived version of the content
* @property-read bool $isCustom If false this alias was autogenerated otherwise manuel created
Expand Down

0 comments on commit f1ce2b2

Please sign in to comment.