Skip to content

Commit 28de582

Browse files
authored
v2 (#21)
* chore: update gitignore * refactor: perform initial upgrade * style: add PER config file for Pint * ci: update GitHub workflows * chore: Update Dependabot config * docs: Update README * style: Run Pint * fix: remember to autoload helper method * test: remove dead tests * chore: gitignore phpunit cache files * chore(deps): Bump Laravel requirement to 11 * chore: remove unneeded directories from phpstan config * style: push stylistic changes that should resolve phpstan issues * style: phpstan
1 parent 2238921 commit 28de582

21 files changed

+135
-499
lines changed

.github/dependabot.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,11 @@ updates:
99
schedule:
1010
interval: "weekly"
1111
labels:
12-
- "dependencies"
12+
- "dependencies"
13+
14+
- package-ecosystem: "composer"
15+
directory: "/"
16+
schedule:
17+
interval: "weekly"
18+
labels:
19+
- "dependencies"

.github/workflows/dependabot-auto-merge.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,23 @@ permissions:
88
jobs:
99
dependabot:
1010
runs-on: ubuntu-latest
11+
timeout-minutes: 5
1112
if: ${{ github.actor == 'dependabot[bot]' }}
1213
steps:
13-
14+
1415
- name: Dependabot metadata
1516
id: metadata
1617
uses: dependabot/[email protected]
1718
with:
1819
github-token: "${{ secrets.GITHUB_TOKEN }}"
19-
20+
2021
- name: Auto-merge Dependabot PRs for semver-minor updates
2122
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}}
2223
run: gh pr merge --auto --merge "$PR_URL"
2324
env:
2425
PR_URL: ${{github.event.pull_request.html_url}}
2526
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
26-
27+
2728
- name: Auto-merge Dependabot PRs for semver-patch updates
2829
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
2930
run: gh pr merge --auto --merge "$PR_URL"

.github/workflows/php-cs-fixer.yml .github/workflows/fix-php-code-style-issues.yml

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
1-
name: Check & fix styling
1+
name: Fix PHP code style issues
22

3-
on: [push]
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
7+
8+
permissions:
9+
contents: write
410

511
jobs:
6-
php-cs-fixer:
12+
php-code-styling:
713
runs-on: ubuntu-latest
14+
timeout-minutes: 5
815

916
steps:
1017
- name: Checkout code
1118
uses: actions/checkout@v4
1219
with:
1320
ref: ${{ github.head_ref }}
1421

15-
- name: Run PHP CS Fixer
16-
uses: docker://oskarstark/php-cs-fixer-ga
17-
with:
18-
args: --config=.php_cs.dist.php --allow-risky=yes
22+
- name: Fix PHP code style issues
23+
uses: aglipanci/[email protected]
1924

2025
- name: Commit changes
2126
uses: stefanzweifel/git-auto-commit-action@v5

.github/workflows/phpstan.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,20 @@ on:
55
paths:
66
- '**.php'
77
- 'phpstan.neon.dist'
8+
- '.github/workflows/phpstan.yml'
89

910
jobs:
1011
phpstan:
1112
name: phpstan
1213
runs-on: ubuntu-latest
14+
timeout-minutes: 5
1315
steps:
1416
- uses: actions/checkout@v4
1517

1618
- name: Setup PHP
1719
uses: shivammathur/setup-php@v2
1820
with:
19-
php-version: '8.0'
21+
php-version: '8.4'
2022
coverage: none
2123

2224
- name: Install composer dependencies

.github/workflows/run-tests.yml

+19-13
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,28 @@ name: run-tests
22

33
on:
44
push:
5-
branches: [main]
6-
pull_request:
7-
branches: [main]
5+
paths:
6+
- '**.php'
7+
- '.github/workflows/run-tests.yml'
8+
- 'phpunit.xml.dist'
9+
- 'composer.json'
10+
- 'composer.lock'
811

912
jobs:
1013
test:
1114
runs-on: ${{ matrix.os }}
15+
timeout-minutes: 5
1216
strategy:
1317
fail-fast: true
1418
matrix:
15-
os: [ubuntu-latest, windows-latest]
16-
php: ["8.0", "8.1"]
17-
laravel: [8.*, 9.*]
18-
stability: [prefer-stable]
19+
os: [ubuntu-latest]
20+
php: [8.4, 8.3]
21+
laravel: [11.*]
22+
stability: [prefer-lowest, prefer-stable]
1923
include:
20-
- laravel: 9.*
21-
testbench: 7.*
22-
- laravel: 8.*
23-
testbench: 6.*
24+
- laravel: 11.*
25+
testbench: 9.*
26+
carbon: ^2.63
2427

2528
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
2629

@@ -42,8 +45,11 @@ jobs:
4245
4346
- name: Install dependencies
4447
run: |
45-
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
48+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.os == 'windows-latest' && '^^^' || '' }}${{ matrix.carbon }}" --no-interaction --no-update
4649
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
4750
51+
- name: List Installed Dependencies
52+
run: composer show -D
53+
4854
- name: Execute tests
49-
run: vendor/bin/pest
55+
run: vendor/bin/pest --ci

.github/workflows/update-changelog.yml

+4
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ on:
44
release:
55
types: [released]
66

7+
permissions:
8+
contents: write
9+
710
jobs:
811
update:
912
runs-on: ubuntu-latest
13+
timeout-minutes: 5
1014

1115
steps:
1216
- name: Checkout code

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ testbench.yaml
1212
vendor
1313
node_modules
1414
.php-cs-fixer.cache
15+
test-results
16+
.phpunit.cache

.php_cs.dist.php

-40
This file was deleted.

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) Petrobolos Games <info@petrobolos.com>
3+
Copyright (c) Oliver Earl <oliver.earl@petrobolos.com>
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ large sets of data.
1414

1515
## Requirements
1616

17-
Currently, requires PHP 8 or above, but work to backport support for 7.4 is in progress. This package is designed
18-
for Laravel 8 and 9, but might play nicely with older versions, or with Lumen. Let us know.
17+
Currently, requires PHP 8.3 or above, and Laravel 11+.
1918

2019
## Installation
2120

@@ -110,9 +109,6 @@ $everything = FixedArray::merge(
110109
| toArray | Converts a fixed array into a standard array. | `FixedArray::toArray($array)` |
111110
| toCollection | Converts a fixed array into an Illuminate collection. | `FixedArray::toCollection($array)` |
112111

113-
**NB:** Methods `current`, `key`, `next`, `rewind`, and `valid` are legacy alias operations for pointer-based array
114-
methods and simply return `null` currently. They will be implemented in a future version.
115-
116112
## Testing
117113

118114
Tests are run using Pest. You can run the suite like so:

composer.json

+27-18
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "petrobolos/fixed-array-functions",
3-
"description": "This is my package fixed-array-functions",
3+
"description": "Laravel helper methods for working with high performance SPL fixed arrays.",
44
"keywords": [
55
"laravel",
66
"splfixedarray",
77
"array",
88
"collection"
99
],
10-
"homepage": "https://github.com/petrobolos/fixed-array-functions",
10+
"homepage": "https://github.com/oliverearl/fixed-array-functions",
1111
"license": "MIT",
1212
"authors": [
1313
{
@@ -17,38 +17,44 @@
1717
}
1818
],
1919
"require": {
20-
"php": "^8.0 || ^8.1",
21-
"spatie/laravel-package-tools": "^1.9.2",
22-
"illuminate/contracts": "^8.0 || ^9.0"
20+
"php": "^8.3",
21+
"spatie/laravel-package-tools": "^1.16",
22+
"illuminate/contracts": "^11.0"
2323
},
2424
"require-dev": {
25-
"nunomaduro/collision": "^5.0 || ^6.0",
26-
"nunomaduro/larastan": "^1.0.3 || ^2.0.1",
27-
"orchestra/testbench": "^6.0 || ^7.0",
28-
"pestphp/pest": "^1.21",
29-
"pestphp/pest-plugin-laravel": "^1.1",
30-
"phpstan/extension-installer": "^1.1",
31-
"phpstan/phpstan-deprecation-rules": "^1.0",
32-
"phpstan/phpstan-phpunit": "^1.0",
33-
"phpunit/phpunit": "^9.5"
25+
"laravel/pint": "^1.14",
26+
"nunomaduro/collision": "^8.1.1",
27+
"larastan/larastan": "^2.9",
28+
"orchestra/testbench": "^9.0.0",
29+
"pestphp/pest": "^3.0",
30+
"pestphp/pest-plugin-arch": "^3.0",
31+
"pestphp/pest-plugin-laravel": "^3.0",
32+
"phpstan/extension-installer": "^1.3",
33+
"phpstan/phpstan-deprecation-rules": "^1.1",
34+
"phpstan/phpstan-phpunit": "^1.3",
35+
"spatie/laravel-ray": "^1.35"
3436
},
3537
"autoload": {
3638
"psr-4": {
37-
"Petrobolos\\FixedArray\\": "src"
39+
"Petrobolos\\FixedArray\\": "src/"
3840
},
3941
"files": [
4042
"src/helpers.php"
4143
]
4244
},
4345
"autoload-dev": {
4446
"psr-4": {
45-
"Petrobolos\\FixedArray\\Tests\\": "tests"
47+
"Petrobolos\\FixedArray\\Tests\\": "tests",
48+
"Workbench\\App\\": "workbench/app/"
4649
}
4750
},
4851
"scripts": {
52+
"post-autoload-dump": "@composer run prepare",
53+
"prepare": "@php vendor/bin/testbench package:discover --ansi",
4954
"analyse": "vendor/bin/phpstan analyse",
5055
"test": "vendor/bin/pest",
51-
"test-coverage": "vendor/bin/pest --coverage"
56+
"test-coverage": "vendor/bin/pest --coverage",
57+
"format": "vendor/bin/pint"
5258
},
5359
"config": {
5460
"sort-packages": true,
@@ -61,7 +67,10 @@
6167
"laravel": {
6268
"providers": [
6369
"Petrobolos\\FixedArray\\FixedArrayFunctionsServiceProvider"
64-
]
70+
],
71+
"aliases": {
72+
"FixedArray": "Petrobolos\\FixedArrayFunctions\\Facades\\FixedArray"
73+
}
6574
}
6675
},
6776
"minimum-stability": "dev",

phpstan.neon.dist

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ includes:
22
- phpstan-baseline.neon
33

44
parameters:
5-
level: 4
5+
level: 5
66
paths:
77
- src
88
tmpDir: build/phpstan
99
checkOctaneCompatibility: true
1010
checkModelProperties: true
11-
checkMissingIterableValueType: false
12-

0 commit comments

Comments
 (0)