Skip to content

Commit 438c395

Browse files
committed
Laravel 10
1 parent ae97cf4 commit 438c395

15 files changed

+132
-127
lines changed

.gitattributes

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
# Path-based git attributes
21
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
32

43
# Ignore all test and documentation with "export-ignore".
5-
/.gitattributes export-ignore
6-
/.gitignore export-ignore
7-
/.travis.yml export-ignore
8-
/phpunit.xml.dist export-ignore
9-
/tests export-ignore
10-
/docs export-ignore
4+
/.editorconfig export-ignore
5+
/.gitattributes export-ignore
6+
/.github export-ignore
7+
/.gitignore export-ignore
8+
/.php-cs-fixer.dist.php export-ignore
9+
/example export-ignore
10+
/phpunit.xml.dist export-ignore
11+
/tests export-ignore
12+
13+
# All test snapshots and text stubs must have LF line endings
14+
tests/**/__snapshots__/** text eol=lf
15+
tests/**/stubs/** text eol=lf
16+
tests/**/stubs/**/*.jpg binary
17+
tests/**/stubs/**/*.png binary

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Please see the documentation for all configuration options:
2+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
3+
4+
version: 2
5+
updates:
6+
7+
- package-ecosystem: "github-actions"
8+
directory: "/"
9+
schedule:
10+
interval: "weekly"
11+
labels:
12+
- "dependencies"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: dependabot-auto-merge
2+
on: pull_request_target
3+
4+
permissions:
5+
pull-requests: write
6+
contents: write
7+
8+
jobs:
9+
dependabot:
10+
runs-on: ubuntu-latest
11+
if: ${{ github.actor == 'dependabot[bot]' }}
12+
steps:
13+
14+
- name: Dependabot metadata
15+
id: metadata
16+
uses: dependabot/[email protected]
17+
with:
18+
github-token: "${{ secrets.GITHUB_TOKEN }}"
19+
20+
- name: Auto-merge Dependabot PRs for semver-minor updates
21+
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}}
22+
run: gh pr merge --auto --merge "$PR_URL"
23+
env:
24+
PR_URL: ${{github.event.pull_request.html_url}}
25+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
26+
27+
- name: Auto-merge Dependabot PRs for semver-patch updates
28+
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
29+
run: gh pr merge --auto --merge "$PR_URL"
30+
env:
31+
PR_URL: ${{github.event.pull_request.html_url}}
32+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
name: Check & fix styling
1+
name: Fix PHP code style issues
22

3-
on: [push]
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
47

58
jobs:
6-
php-cs-fixer:
9+
php-code-styling:
710
runs-on: ubuntu-latest
811

912
steps:
1013
- name: Checkout code
11-
uses: actions/checkout@v2
14+
uses: actions/checkout@v3
1215
with:
1316
ref: ${{ github.head_ref }}
1417

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

2021
- name: Commit changes
2122
uses: stefanzweifel/git-auto-commit-action@v4

.github/workflows/run-tests.yml

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: run-tests
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
48

59
jobs:
610
test:
@@ -9,38 +13,38 @@ jobs:
913
fail-fast: true
1014
matrix:
1115
os: [ubuntu-latest]
12-
php: [8.1]
13-
laravel: [9.*, 8.*]
14-
dependency-version: [prefer-lowest, prefer-stable]
16+
php: [8.2]
17+
laravel: [10.*]
18+
stability: [prefer-lowest, prefer-stable]
1519
include:
16-
- laravel: 9.*
17-
testbench: 7.*
18-
- laravel: 8.*
19-
testbench: ^6.23
20+
- laravel: 10.*
21+
testbench: 8.*
2022

21-
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
23+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
2224

2325
steps:
24-
- name: Checkout code
25-
uses: actions/checkout@v1
26-
27-
- name: Cache dependencies
28-
uses: actions/cache@v1
29-
with:
30-
path: ~/.composer/cache/files
31-
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
32-
33-
- name: Setup PHP
34-
uses: shivammathur/setup-php@v2
35-
with:
36-
php-version: ${{ matrix.php }}
37-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
38-
coverage: none
39-
40-
- name: Install dependencies
41-
run: |
42-
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
43-
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
44-
45-
- name: Execute tests
46-
run: vendor/bin/phpunit
26+
- name: Checkout code
27+
uses: actions/checkout@v3
28+
29+
- name: Setup PHP
30+
uses: shivammathur/setup-php@v2
31+
with:
32+
php-version: ${{ matrix.php }}
33+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
34+
coverage: none
35+
36+
- name: Setup problem matchers
37+
run: |
38+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
39+
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
40+
41+
- name: Install dependencies
42+
run: |
43+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
44+
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
45+
46+
- name: List Installed Dependencies
47+
run: composer show -D
48+
49+
- name: Execute tests
50+
run: vendor/bin/phpunit

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
.php-cs-fixer.cache
2-
.phpunit.result.cache
1+
.phpunit.cache
32
composer.lock
3+
coverage
4+
docs
5+
phpunit.xml
6+
psalm.xml
47
vendor

.php-cs-fixer.dist.php

Lines changed: 0 additions & 42 deletions
This file was deleted.

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
}
1010
],
1111
"require": {
12-
"php": "^8.1",
13-
"illuminate/support": "^8.75|^9.0"
12+
"php": "^8.2",
13+
"illuminate/support": "^10.0"
1414
},
1515
"require-dev": {
16-
"friendsofphp/php-cs-fixer": "^3.0",
17-
"orchestra/testbench": "^6.23|^7.0",
18-
"phpunit/phpunit": "^9.5"
16+
"laravel/pint": "^1.0",
17+
"orchestra/testbench": "^8.0",
18+
"phpunit/phpunit": "^10.0"
1919
},
2020
"config": {
2121
"sort-packages": true
@@ -38,7 +38,7 @@
3838
}
3939
},
4040
"scripts": {
41-
"format": "vendor/bin/php-cs-fixer fix --allow-risky=yes",
41+
"format": "vendor/bin/pint",
4242
"test": "vendor/bin/phpunit",
4343
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"
4444
},

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" verbose="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
33
<coverage>
44
<include>
55
<directory suffix=".php">src/</directory>

resources/views/logic.blade.php

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/Detector/UserAgentDetector.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ public function __construct()
1313
$this->regexes = config('outdated-browser.blocked_user_agent_regexes', []);
1414
}
1515

16-
public function setRegexes(array $regexes)
16+
public function setRegexes(array $regexes): self
1717
{
1818
$this->regexes = $regexes;
19+
20+
return $this;
1921
}
2022

2123
public function isOutdated(Request $request): bool

src/Memory/CookieMemory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class CookieMemory implements Memory
1010

1111
public function hasContinued(): bool
1212
{
13-
return ! ! Cookie::get(static::KEY);
13+
return (bool) Cookie::get(static::KEY);
1414
}
1515

1616
public function remember(): void

src/Memory/SessionMemory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class SessionMemory implements Memory
88

99
public function hasContinued(): bool
1010
{
11-
return ! ! session()->get(static::KEY);
11+
return (bool) session()->get(static::KEY);
1212
}
1313

1414
public function remember(): void

src/OutdatedBrowserMiddleware.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,11 @@
1010

1111
class OutdatedBrowserMiddleware
1212
{
13-
public Detector $detector;
14-
public Memory $memory;
15-
public Inspector $inspector;
16-
17-
public function __construct(Detector $detector, Memory $memory, Inspector $inspector)
18-
{
19-
$this->detector = $detector;
20-
$this->memory = $memory;
21-
$this->inspecter = $inspector;
13+
public function __construct(
14+
public readonly Detector $detector,
15+
public readonly Memory $memory,
16+
public readonly Inspector $inspector,
17+
) {
2218
}
2319

2420
public function handle(Request $request, Closure $next)
@@ -34,7 +30,7 @@ public function handle(Request $request, Closure $next)
3430
}
3531

3632
// We cannot ask here.
37-
if ($this->inspecter->shouldPresentGate($request) !== true) {
33+
if ($this->inspector->shouldPresentGate($request) !== true) {
3834
return $next($request);
3935
}
4036

src/OutdatedBrowserServiceProvider.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,32 @@ public function boot(): void
2222

2323
private function registerConfig(): void
2424
{
25-
$this->mergeConfigFrom(__DIR__ . '/../config/outdated-browser.php', 'outdated-browser');
25+
$this->mergeConfigFrom(__DIR__.'/../config/outdated-browser.php', 'outdated-browser');
2626
}
2727

2828
private function registerViews(): void
2929
{
30-
$this->loadViewsFrom(__DIR__ . '/../resources/views', 'outdated-browser');
30+
$this->loadViewsFrom(__DIR__.'/../resources/views', 'outdated-browser');
3131
}
3232

3333
private function registerTranslations(): void
3434
{
35-
$this->loadTranslationsFrom(__DIR__ . '/../lang', 'outdated-browser');
35+
$this->loadTranslationsFrom(__DIR__.'/../lang', 'outdated-browser');
3636
}
3737

3838
private function registerPublishables(): self
3939
{
4040
if ($this->app->runningInConsole()) {
4141
$this->publishes([
42-
__DIR__ . '/../config/outdated-browser.php' => config_path('outdated-browser.php'),
42+
__DIR__.'/../config/outdated-browser.php' => config_path('outdated-browser.php'),
4343
], 'config');
4444

4545
$this->publishes([
46-
__DIR__ . '/../resources/views' => base_path('resources/views/vendor/outdated-browser'),
46+
__DIR__.'/../resources/views' => base_path('resources/views/vendor/outdated-browser'),
4747
], 'views');
4848

4949
$this->publishes([
50-
__DIR__ . '/../../lang' => lang_path('vendor/outdated-browser'),
50+
__DIR__.'/../../lang' => lang_path('vendor/outdated-browser'),
5151
], 'translations');
5252
}
5353

0 commit comments

Comments
 (0)