Skip to content

Commit

Permalink
fix phpstan errors
Browse files Browse the repository at this point in the history
  • Loading branch information
koertho committed Oct 20, 2023
1 parent 3f6d3d0 commit ba95427
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 19 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

[![](https://img.shields.io/packagist/v/heimrichhannot/contao-utils-bundle.svg)](https://packagist.org/packages/heimrichhannot/contao-utils-bundle)
[![](https://img.shields.io/packagist/dt/heimrichhannot/contao-utils-bundle.svg)](https://packagist.org/packages/heimrichhannot/contao-utils-bundle)
[![Build Status](https://travis-ci.org/heimrichhannot/contao-utils-bundle.svg?branch=master)](https://travis-ci.org/heimrichhannot/contao-utils-bundle)
[![Coverage Status](https://coveralls.io/repos/github/heimrichhannot/contao-utils-bundle/badge.svg?branch=master)](https://coveralls.io/github/heimrichhannot/contao-utils-bundle?branch=master)
![example branch parameter](https://github.com/heimrichhannot/contao-utils-bundle/actions/workflows/ci.yml/badge.svg?branch=v3)
[![Coverage Status](https://coveralls.io/repos/github/heimrichhannot/contao-utils-bundle/badge.svg?branch=v3)](https://coveralls.io/github/heimrichhannot/contao-utils-bundle?branch=master)

This bundle offers various utility functionality for the Contao CMS.

Expand Down
3 changes: 3 additions & 0 deletions src/Util/HtmlUtil/GenerateDataAttributesStringOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public function isNormalizeKeys(): bool
return $this->normalizeKeys;
}

/**
* Array keys are normalized to lowercase dash-cased strings (e.g. Foo Bar_player is transformed to foo-bar-player)
*/
public function setNormalizeKeys(bool $normalizeKeys): GenerateDataAttributesStringOptions
{
$this->normalizeKeys = $normalizeKeys;
Expand Down
6 changes: 0 additions & 6 deletions src/Util/HtmlUtil/HtmlUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ public function generateAttributeString(array $attributes, array $options = []):
*
* Options (additional to Options from HtmlUtl::generateAttributeString()):
* - normalizeKeys: Array keys are normalized to lowercase dash-cased strings (e.g. Foo Bar_player is transformed to foo-bar-player)
*
* @param array{
* xhtml?: bool,
* normalizeKeys?: bool,
* array_handling?: string|HtmlUtilArrayHandling
* } $options
*/
public function generateDataAttributesString(array $attributes, GenerateDataAttributesStringOptions $options = new GenerateDataAttributesStringOptions()): string
{
Expand Down
8 changes: 3 additions & 5 deletions src/Util/Model/ModelUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ public function addPublishedCheckToModelArrays(string $table, array &$columns, a
* Options:
* - skipReplaceInsertTags: (bool) Skip the replacement of inserttags. Default: false
*
* @param mixed $columns
* @param mixed $values
* @param array{
* skipReplaceInsertTags?: bool
* } $options
Expand Down Expand Up @@ -111,9 +109,9 @@ public function findModelInstancesBy(string $table, array|string|null $columns,
/**
* Find a single model instance for given table by its primary key (id).
*
* @param string $table The table
* @param mixed $pk The property value
* @param array $options An optional options array
* @param string $table The table
* @param int|string $pk The property value
* @param array $options An optional options array
*
* @return Model|null The model or null if the result is empty
*/
Expand Down
12 changes: 6 additions & 6 deletions src/Util/Type/StringUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ public function camelCaseToSnake(string $value): string
public function randomChar(bool $includeAmbiguousChars = false, array $options = []): string
{
if ($includeAmbiguousChars) {
$chars = static::CAPITAL_LETTERS.static::SMALL_LETTERS.static::NUMBERS;
$chars = self::CAPITAL_LETTERS.self::SMALL_LETTERS.self::NUMBERS;
} else {
$chars = static::CAPITAL_LETTERS_NONAMBIGUOUS.static::SMALL_LETTERS_NONAMBIGUOUS.static::NUMBERS_NONAMBIGUOUS;
$chars = self::CAPITAL_LETTERS_NONAMBIGUOUS.self::SMALL_LETTERS_NONAMBIGUOUS.self::NUMBERS_NONAMBIGUOUS;
}

return $this->random($chars, $options);
Expand All @@ -68,9 +68,9 @@ public function randomChar(bool $includeAmbiguousChars = false, array $options =
public function randomLetter(bool $includeAmbiguousChars = false, array $options = []): string
{
if ($includeAmbiguousChars) {
$chars = static::CAPITAL_LETTERS.static::SMALL_LETTERS;
$chars = self::CAPITAL_LETTERS.self::SMALL_LETTERS;
} else {
$chars = static::CAPITAL_LETTERS_NONAMBIGUOUS.static::SMALL_LETTERS_NONAMBIGUOUS;
$chars = self::CAPITAL_LETTERS_NONAMBIGUOUS.self::SMALL_LETTERS_NONAMBIGUOUS;
}

return $this->random($chars, $options);
Expand All @@ -84,9 +84,9 @@ public function randomLetter(bool $includeAmbiguousChars = false, array $options
public function randomNumber(bool $includeAmbiguousChars = false, array $options = []): string
{
if ($includeAmbiguousChars) {
$chars = static::NUMBERS;
$chars = self::NUMBERS;
} else {
$chars = static::NUMBERS_NONAMBIGUOUS;
$chars = self::NUMBERS_NONAMBIGUOUS;
}

return $this->random($chars, $options);
Expand Down

0 comments on commit ba95427

Please sign in to comment.