Skip to content

Commit 2305fa0

Browse files
authored
Update StyleCI config + fixes
1 parent 6b339f0 commit 2305fa0

File tree

9 files changed

+192
-19
lines changed

9 files changed

+192
-19
lines changed

.styleci.yml

Lines changed: 87 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,90 @@
11
preset: psr12
2+
risky: true
3+
4+
version: 8
25

36
finder:
4-
exclude:
5-
- docs
6-
- vendor
7+
exclude:
8+
- docs
9+
- vendor
10+
- resources
11+
- views
12+
- public
13+
not-name:
14+
- UnionCar.php
15+
16+
enabled:
17+
- alpha_ordered_imports
18+
- alpha_ordered_traits
19+
- array_indentation
20+
- array_push
21+
- combine_consecutive_issets
22+
- combine_consecutive_unsets
23+
- combine_nested_dirname
24+
- declare_strict_types
25+
- dir_constant
26+
- final_static_access
27+
- fully_qualified_strict_types
28+
- function_to_constant
29+
- hash_to_slash_comment
30+
- is_null
31+
- logical_operators
32+
- magic_constant_casing
33+
- magic_method_casing
34+
- method_separation
35+
- modernize_types_casting
36+
- native_function_casing
37+
- native_function_type_declaration_casing
38+
- no_alias_functions
39+
- no_alternative_syntax
40+
- no_empty_comment
41+
- no_empty_phpdoc
42+
- no_empty_statement
43+
- no_extra_block_blank_lines
44+
- no_short_bool_cast
45+
- no_short_echo_tag
46+
- no_superfluous_elseif
47+
- no_unneeded_control_parentheses
48+
- no_unneeded_curly_braces
49+
- no_unneeded_final_method
50+
- no_unset_cast
51+
- no_unused_imports
52+
- no_unused_lambda_imports
53+
- no_useless_else
54+
- no_useless_return
55+
- normalize_index_brace
56+
- php_unit_dedicate_assert
57+
- php_unit_dedicate_assert_internal_type
58+
- php_unit_expectation
59+
- php_unit_mock
60+
- php_unit_mock_short_will_return
61+
- php_unit_namespaced
62+
- php_unit_no_expectation_annotation
63+
- phpdoc_no_empty_return
64+
- phpdoc_no_useless_inheritdoc
65+
- phpdoc_order
66+
- phpdoc_property
67+
- phpdoc_scalar
68+
- phpdoc_separation
69+
- phpdoc_singular_inheritdoc
70+
- phpdoc_trim
71+
- phpdoc_trim_consecutive_blank_line_separation
72+
- phpdoc_type_to_var
73+
- phpdoc_types
74+
- phpdoc_types_order
75+
- phpdoc_var_without_name
76+
- print_to_echo
77+
- regular_callable_call
78+
- return_assignment
79+
- self_accessor
80+
- self_static_accessor
81+
- set_type_to_cast
82+
- short_array_syntax
83+
- short_list_syntax
84+
- simplified_if_return
85+
- single_quote
86+
- standardize_not_equals
87+
- ternary_to_null_coalescing
88+
- trailing_comma_in_multiline_array
89+
- unalign_double_arrow
90+
- unalign_equals

src/Inflector.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ final class Inflector
1919
* `huò qǔ dào dochira Ukraí̈nsʹka: g̀,ê, Srpska: đ, n̂, d̂! ¿Español?`.
2020
*
2121
* For detailed information see [unicode normalization forms](http://unicode.org/reports/tr15/#Normalization_Forms_Table)
22+
*
2223
* @see http://unicode.org/reports/tr15/#Normalization_Forms_Table
2324
* @see toTransliterated()
2425
*/
@@ -141,6 +142,7 @@ final class Inflector
141142

142143
/**
143144
* @psalm-var array<string, string>
145+
*
144146
* @var string[] The special rules for converting a word between its plural form and singular form.
145147
* The keys are the special words in singular form, and the values are the corresponding plural form.
146148
*/
@@ -280,6 +282,7 @@ final class Inflector
280282
* @var string|\Transliterator Either a {@see \Transliterator}, or a string from which a {@see \Transliterator}
281283
* can be built for transliteration. Used by {@see toTransliterated()} when intl is available.
282284
* Defaults to {@see TRANSLITERATE_LOOSE}.
285+
*
283286
* @see https://secure.php.net/manual/en/transliterator.transliterate.php
284287
*/
285288
private $transliterator = self::TRANSLITERATE_LOOSE;
@@ -290,6 +293,7 @@ final class Inflector
290293
* @param string[] $rules The rules for converting a word into its plural form.
291294
* @psalm-param array<string, string> $rules
292295
* The keys are the regular expressions and the values are the corresponding replacements.
296+
*
293297
* @return self
294298
*/
295299
public function withPluralizeRules(array $rules): self
@@ -312,6 +316,7 @@ public function getPluralizeRules(): array
312316
* @param string[] $rules The rules for converting a word into its singular form.
313317
* The keys are the regular expressions and the values are the corresponding replacements.
314318
* @psalm-param array<string, string> $rules
319+
*
315320
* @return self
316321
*/
317322
public function withSingularizeRules(array $rules): self
@@ -334,6 +339,7 @@ public function getSingularizeRules(): array
334339
* @param string[] $rules The special rules for converting a word between its plural form and singular form.
335340
* @psalm-param array<string, string> $rules
336341
* The keys are the special words in singular form, and the values are the corresponding plural form.
342+
*
337343
* @return self
338344
*/
339345
public function withSpecialRules(array $rules): self
@@ -356,7 +362,9 @@ public function getSpecialRules(): array
356362
* @param string|\Transliterator $transliterator Either a {@see \Transliterator}, or a string from which
357363
* a {@see \Transliterator} can be built for transliteration. Used by {@see toTransliterated()} when intl is available.
358364
* Defaults to {@see TRANSLITERATE_LOOSE}.
365+
*
359366
* @return self
367+
*
360368
* @see https://secure.php.net/manual/en/transliterator.transliterate.php
361369
*/
362370
public function withTransliterator($transliterator): self
@@ -369,6 +377,7 @@ public function withTransliterator($transliterator): self
369377
/**
370378
* @param string[] $transliterationMap Fallback map for transliteration used by {@see toTransliterated()} when intl
371379
* isn't available or turned off with {@see withoutIntl()}.
380+
*
372381
* @return $this
373382
*/
374383
public function withTransliterationMap(array $transliterationMap): self
@@ -380,6 +389,7 @@ public function withTransliterationMap(array $transliterationMap): self
380389

381390
/**
382391
* Disables usage of intl for {@see toTransliterated()}.
392+
*
383393
* @return self
384394
*/
385395
public function withoutIntl(): self
@@ -393,7 +403,9 @@ public function withoutIntl(): self
393403
* Converts a word to its plural form.
394404
* Note that this is for English only!
395405
* For example, "apple" will become "apples", and "child" will become "children".
406+
*
396407
* @param string $input The word to be pluralized.
408+
*
397409
* @return string The pluralized word.
398410
*/
399411
public function toPlural(string $input): string
@@ -412,7 +424,9 @@ public function toPlural(string $input): string
412424

413425
/**
414426
* Returns the singular of the $word.
427+
*
415428
* @param string $input The english word to singularize.
429+
*
416430
* @return string Singular noun.
417431
*/
418432
public function toSingular(string $input): string
@@ -433,8 +447,10 @@ public function toSingular(string $input): string
433447
/**
434448
* Converts an underscored or PascalCase word into a English
435449
* sentence.
450+
*
436451
* @param string $input The string to titleize.
437452
* @param bool $uppercaseAll Whether to set all words to uppercase.
453+
*
438454
* @return string
439455
*/
440456
public function toSentence(string $input, bool $uppercaseAll = false): string
@@ -447,7 +463,9 @@ public function toSentence(string $input, bool $uppercaseAll = false): string
447463
/**
448464
* Converts a string into space-separated words.
449465
* For example, 'PostTag' will be converted to 'Post Tag'.
466+
*
450467
* @param string $input The string to be converted.
468+
*
451469
* @return string The resulting words.
452470
*/
453471
public function toWords(string $input): string
@@ -463,9 +481,11 @@ public function toWords(string $input): string
463481
* Converts a PascalCase name into an ID in lowercase.
464482
* Words in the ID may be concatenated using the specified character (defaults to '-').
465483
* For example, 'PostTag' will be converted to 'post-tag'.
484+
*
466485
* @param string $input The string to be converted.
467486
* @param string $separator The character used to concatenate the words in the ID.
468487
* @param bool $strict Whether to insert a separator between two consecutive uppercase chars, defaults to false.
488+
*
469489
* @return string The resulting ID.
470490
*/
471491
public function pascalCaseToId(string $input, string $separator = '-', bool $strict = false): string
@@ -488,8 +508,11 @@ public function pascalCaseToId(string $input, string $separator = '-', bool $str
488508
* Converts a word like "send_email" to "SendEmail". It
489509
* will remove non alphanumeric character from the word, so
490510
* "who's online" will be converted to "WhoSOnline".
511+
*
491512
* @param string $input The word to PascalCase.
513+
*
492514
* @return string PascalCased string.
515+
*
493516
* @see toCamelCase()
494517
*/
495518
public function toPascalCase(string $input): string
@@ -499,8 +522,10 @@ public function toPascalCase(string $input): string
499522

500523
/**
501524
* Returns a human-readable string.
525+
*
502526
* @param string $input The string to humanize.
503527
* @param bool $uppercaseWords Whether to set all words to uppercase or not.
528+
*
504529
* @return string
505530
*/
506531
public function toHumanReadable(string $input, bool $uppercaseWords = false): string
@@ -516,7 +541,9 @@ public function toHumanReadable(string $input, bool $uppercaseWords = false): st
516541
* Converts a word like "send_email" to "sendEmail". It
517542
* will remove non alphanumeric character from the word, so
518543
* "who's online" will be converted to "whoSOnline".
544+
*
519545
* @param string $input The word to convert.
546+
*
520547
* @return string
521548
*/
522549
public function toCamelCase(string $input): string
@@ -530,7 +557,9 @@ public function toCamelCase(string $input): string
530557
* Converts a class name to its table name (pluralized) naming conventions.
531558
*
532559
* For example, converts "Car" to "cars", "Person" to "people", and "ActionLog" to "action_log".
560+
*
533561
* @param string $className the class name for getting related table_name.
562+
*
534563
* @return string
535564
*/
536565
public function classToTable(string $className): string
@@ -542,7 +571,9 @@ public function classToTable(string $className): string
542571
* Converts a table name to its class name.
543572
*
544573
* For example, converts "cars" to "Car", "people" to "Person", and "action_log" to "ActionLog".
574+
*
545575
* @param string $tableName
576+
*
546577
* @return string
547578
*/
548579
public function tableToClass(string $tableName): string
@@ -561,6 +592,7 @@ public function tableToClass(string $tableName): string
561592
* @param string $input An arbitrary string to convert.
562593
* @param string $replacement The replacement to use for spaces.
563594
* @param bool $lowercase whether to return the string in lowercase or not. Defaults to `true`.
595+
*
564596
* @return string The converted string.
565597
*/
566598
public function toSlug(string $input, string $replacement = '-', bool $lowercase = true): string
@@ -586,6 +618,7 @@ public function toSlug(string $input, string $replacement = '-', bool $lowercase
586618
* @param string|\Transliterator|null $transliterator either a {@see \Transliterator} or a string
587619
* from which a {@see \Transliterator} can be built. If null, value set with {@see withTransliterator()}
588620
* or {@see TRANSLITERATE_LOOSE} is used.
621+
*
589622
* @return string
590623
*/
591624
public function toTransliterated(string $input, $transliterator = null): string

src/NumericHelper.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ final class NumericHelper
1111
{
1212
/**
1313
* Converts number to its ordinal English form. For example, converts 13 to 13th, 2 to 2nd etc.
14-
* @param int|float|string $value The number to get its ordinal value.
14+
*
15+
* @param float|int|string $value The number to get its ordinal value.
16+
*
1517
* @return string
1618
*/
1719
public static function toOrdinal($value): string
@@ -42,7 +44,9 @@ public static function toOrdinal($value): string
4244

4345
/**
4446
* Returns string representation of a number value without thousands separators and with dot as decimal separator.
45-
* @param int|float|string $value
47+
*
48+
* @param float|int|string $value
49+
*
4650
* @return string
4751
*/
4852
public static function normalize($value): string

0 commit comments

Comments
 (0)