Skip to content

Commit

Permalink
Modern PHP
Browse files Browse the repository at this point in the history
Upgrade coding style for modern PHP
  • Loading branch information
AntonyThorpe committed May 29, 2024
1 parent ccfd1f0 commit e2aba68
Show file tree
Hide file tree
Showing 25 changed files with 340 additions and 312 deletions.
7 changes: 1 addition & 6 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,14 @@ trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false

[*.{yml,js,json,css,scss,eslintrc,feature}]
[*.{yml,js,json,css,scss,feature}]
indent_size = 2
indent_style = space

[composer.json]
indent_size = 4

# Don't perform any clean-up on thirdparty files

[thirdparty/**]
trim_trailing_whitespace = false
insert_final_newline = false

[admin/thirdparty/**]
trim_trailing_whitespace = false
insert_final_newline = false
21 changes: 21 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="SilverStripe">
<description>CodeSniffer ruleset for SilverStripe coding conventions.</description>

<file>src</file>
<file>tests</file>

<!-- base rules are PSR-2 -->
<rule ref="PSR2" >
<!-- Current exclusions -->
<exclude name="PSR1.Methods.CamelCapsMethodName" />
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore" />
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />
<exclude name="Generic.Files.LineLength.TooLong" />
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols" />
</rule>

<!-- use short array syntax -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax" />
</ruleset>

7 changes: 2 additions & 5 deletions src/ArrayBulkLoaderSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,16 @@
class ArrayBulkLoaderSource extends BulkLoaderSource
{

protected $data;

public function __construct($data)
public function __construct(protected $data)
{
$this->data = $data;
}

public function getIterator(): ArrayIterator
{
return new ArrayIterator($this->data);
}

public function setData($data)
public function setData($data): static
{
$this->data = $data;

Expand Down
Loading

0 comments on commit e2aba68

Please sign in to comment.