Skip to content

Commit

Permalink
Remove type enforcements altogether
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarpsvo committed Aug 15, 2019
1 parent e66528a commit f3f34c0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.3.3] - 2019-08-15

### Changed

- Fix MenuLinkable types

BREAKING!

Previous `string` enforcements failed in some cases, it is safer to just remove them. New type definitions for `getDisplayValue` and `getValue`:

```
public static function getDisplayValue($value = null)
public static function getValue($value = null, array $parameters = null)
```

## [1.3.2] - 2019-08-15

### Changed
Expand Down Expand Up @@ -103,6 +118,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Nesting and re-ordering of menu-items
- Creation of custom link options (ie links to Laravel models)

[1.3.3]: https://github.com/optimistdigital/nova-menu-builder/compare/1.3.2...1.3.3
[1.3.2]: https://github.com/optimistdigital/nova-menu-builder/compare/1.3.1...1.3.2
[1.3.1]: https://github.com/optimistdigital/nova-menu-builder/compare/1.3.0...1.3.1
[1.3.0]: https://github.com/optimistdigital/nova-menu-builder/compare/1.2.1...1.3.0
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public static function getOptions($locale): array {
* @param string $value
* @return string
**/
public static function getDisplayValue(string $value): string {
public static function getDisplayValue($value = null) {
// Example usecase
// return 'Page: ' . Page::find($value)->name;
return $value;
Expand All @@ -138,7 +138,7 @@ public static function getDisplayValue(string $value): string {
* @param array $parameters The JSON parameters added to the item.
* @return any
**/
public static function getValue(string $value, array $parameters = null)
public static function getValue($value = null, array $parameters = null)
// Example usecase
// return Page::find($value);
return $value;
Expand Down
4 changes: 2 additions & 2 deletions src/Classes/MenuItemBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ abstract public static function getType(): string;
* @param string $value
* @return string
**/
public static function getDisplayValue(?string $value): string
public static function getDisplayValue($value = null)
{
return $value;
}
Expand All @@ -49,7 +49,7 @@ public static function getDisplayValue(?string $value): string
* @param array $parameters The JSON parameters added to the item.
* @return any
**/
public static function getValue(?string $value, array $parameters = null)
public static function getValue($value = null, array $parameters = null)
{
return $value;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Classes/MenuItemText.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ public static function getType(): string
return 'text';
}

public static function getDisplayValue(?string $value): string
public static function getDisplayValue($value = null)
{
return '';
}

public static function getValue(?string $value, array $parameters = null)
public static function getValue($value = null, array $parameters = null)
{
return null;
}
Expand Down

0 comments on commit f3f34c0

Please sign in to comment.