Skip to content

Commit

Permalink
Merge pull request #6 from enflow/laravel10
Browse files Browse the repository at this point in the history
  • Loading branch information
mbardelmeijer authored Feb 24, 2023
2 parents 7482a20 + 40317be commit 8f533ae
Show file tree
Hide file tree
Showing 14 changed files with 140 additions and 114 deletions.
20 changes: 14 additions & 6 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Ignore all test and documentation with "export-ignore".
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/.php-cs-fixer.dist.php export-ignore
/example export-ignore
/phpunit.xml.dist export-ignore
/tests export-ignore

# All test snapshots and text stubs must have LF line endings
tests/**/__snapshots__/** text eol=lf
tests/**/stubs/** text eol=lf
tests/**/stubs/**/*.jpg binary
tests/**/stubs/**/*.png binary
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
labels:
- "dependencies"
32 changes: 32 additions & 0 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: dependabot-auto-merge
on: pull_request_target

permissions:
pull-requests: write
contents: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:

- name: Dependabot metadata
id: metadata
uses: dependabot/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Auto-merge Dependabot PRs for semver-minor updates
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Auto-merge Dependabot PRs for semver-patch updates
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
24 changes: 24 additions & 0 deletions .github/workflows/fix-php-code-style-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Fix PHP code style issues

on:
push:
paths:
- '**.php'

jobs:
php-code-styling:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

- name: Fix PHP code style issues
uses: aglipanci/[email protected]

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Fix styling
23 changes: 0 additions & 23 deletions .github/workflows/php-cs-fixer.yml

This file was deleted.

69 changes: 37 additions & 32 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,50 @@
name: run-tests

on: [push, pull_request]
on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.1]
laravel: [9.*, 8.*]
dependency-version: [prefer-lowest, prefer-stable]
os: [ubuntu-latest]
php: [8.2]
laravel: [10.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 9.*
testbench: 7.*
- laravel: 8.*
testbench: ^6.23
- laravel: 10.*
testbench: 8.*

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

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
- name: Execute tests
run: vendor/bin/phpunit
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: List Installed Dependencies
run: composer show -D

- name: Execute tests
run: vendor/bin/phpunit
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.php-cs-fixer.cache
.phpunit.result.cache
.phpunit.cache
composer.lock
coverage
docs
phpunit.xml
psalm.xml
vendor
36 changes: 0 additions & 36 deletions .php-cs-fixer.dist.php

This file was deleted.

14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
}
],
"require": {
"php": "^8.1",
"php": "^8.2",
"livewire/livewire": "^2.2"
},
"require-dev": {
"orchestra/testbench": "^7.0",
"phpunit/phpunit": "^9.5",
"rcrowe/twigbridge": "^0.13.1",
"friendsofphp/php-cs-fixer": "^3.2"
"laravel/pint": "^1.0",
"orchestra/testbench": "^8.0",
"phpunit/phpunit": "^10.0",
"rcrowe/twigbridge": "^0.14.1"
},
"suggest": {
"rcrowe/twigbridge": "For adding Twig support to your Laravel application"
Expand All @@ -42,7 +42,7 @@
}
},
"scripts": {
"test": "vendor/bin/phpunit",
"format": "vendor/bin/php-cs-fixer fix --allow-risky=yes"
"format": "vendor/bin/pint",
"test": "vendor/bin/phpunit"
}
}
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<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">
<coverage>
<include>
<directory suffix=".php">src/</directory>
Expand Down
4 changes: 2 additions & 2 deletions src/LivewireExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class LivewireExtension extends AbstractExtension
{
public function getFunctions()
public function getFunctions(): array
{
return [
new TwigFunction('livewireStyles', [$this, 'livewireStyles'], ['is_safe' => ['html']]),
Expand All @@ -26,7 +26,7 @@ public function livewireScripts()
return Livewire::scripts();
}

public function getTokenParsers()
public function getTokenParsers(): array
{
return [
new LivewireTokenParser(),
Expand Down
6 changes: 3 additions & 3 deletions src/LivewireNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function compile(Compiler $compiler)
{
$component = $this->getAttribute('component');

$compiler->raw("if (! isset(\$_instance)) {")
$compiler->raw('if (! isset($_instance)) {')
->outdent()
->raw("\$html = \Livewire\Livewire::mount('$component', ");

Expand All @@ -36,8 +36,8 @@ public function compile(Compiler $compiler)

$compiler->raw(")->html();\n")
->indent()
->raw("}");
->raw('}');

$compiler->write("echo \$html;");
$compiler->write('echo $html;');
}
}
1 change: 1 addition & 0 deletions tests/RenderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public function test_invalid_type_throws_exception()
class Counter extends Component
{
public $count = 3;

public $title = null;

public function render()
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class TestCase extends BaseTestCase
{
protected function getPackageProviders($app)
protected function getPackageProviders($app): array
{
return [
LivewireServiceProvider::class,
Expand All @@ -18,7 +18,7 @@ protected function getPackageProviders($app)
];
}

protected function getEnvironmentSetUp($app)
protected function getEnvironmentSetUp($app): void
{
$app['config']->set('view.paths', [
__DIR__.'/views',
Expand Down

0 comments on commit 8f533ae

Please sign in to comment.