Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# This is a basic workflow to help you get started with Actions

name: Tests

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
phpstan:
name: PHPStan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: 8.4
coverage: none

- run: composer install --no-progress --prefer-dist
- run: composer phpstan -- --no-progress
continue-on-error: true

phpcs:
name: PHP CS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: 8.4
coverage: none

- run: composer install --no-progress --prefer-dist
- run: composer phpcs
continue-on-error: true

# psalm:
# name: Psalm
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: shivammathur/setup-php@v2
# with:
# php-version: 8.0
# coverage: none
#
# - run: composer install --no-progress --prefer-dist
# - run: composer psalm -- --no-progress
# continue-on-error: true

tests:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '8.2', '8.3', '8.4' ]

fail-fast: false

name: PHP ${{ matrix.php }} tests
steps:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- run: composer install --no-progress --prefer-dist
- run: vendor/bin/tester tests -s -C

code_coverage:
name: Code Coverage
runs-on: ubuntu-latest
needs: [tests]
steps:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: 8.4
coverage: none

- run: composer install --no-progress --prefer-dist
- run: vendor/bin/tester -p phpdbg tests -s -C --coverage ./coverage.xml --coverage-src ./src
# - run: wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.4.3/php-coveralls.phar
# - env:
# COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: php php-coveralls.phar --verbose --config tests/.coveralls.yml
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/vendor
/temp
/composer.lock
.php-cs-fixer.cache
15 changes: 15 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

$finder = (new PhpCsFixer\Finder())
->in(__DIR__ . '/src')
;

return (new PhpCsFixer\Config())
->setRules([
'@PER-CS' => true,
'@PHP82Migration' => true,
'array_syntax' => ['syntax' => 'short'],
])
->setIndent("\t")
->setFinder($finder)
;
74 changes: 0 additions & 74 deletions .travis.yml

This file was deleted.

5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ Bckp\Translator
====================

[![Downloads this Month](https://img.shields.io/packagist/dm/bckp/translator-core.svg)](https://packagist.org/packages/bckp/translator-core)
[![Build Status](https://travis-ci.org/bckp/translator-core.svg?branch=master)](https://travis-ci.org/bckp/translator-core)
[![Coverage Status](https://coveralls.io/repos/github/bckp/translator-core/badge.svg?branch=master)](https://coveralls.io/github/bckp/translator-core?branch=master)
[![Build Status](https://github.com/bckp/translator-core/actions/workflows/tests.yaml)](https://github.com/bckp/translator-core/actions/workflows/tests.yaml/badge.svg)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/bckp/translator-core/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/bckp/translator-core/?branch=master)
[![Latest Stable Version](https://poser.pugx.org/bckp/translator-core/v/stable)](https://packagist.org/packages/bckp/translator-core)
[![License](https://img.shields.io/badge/license-New%20BSD-blue.svg)](https://github.com/nette/application/blob/master/license.md)
Expand All @@ -25,7 +24,7 @@ $compiledCatalogue = $catalogue->compile();
$translator = new Translator($compiledCatalogue);

$translator->translate('errors.error.notFound'); // Will output "Soubor nenalezen"
$translator->translate(['messages.plural', 4]); // Will output "4 lidé"
$translator->translate('messages.plural', 4); // Will output "4 lidé"
$translator->translate('messages.withArgs', 'Honza', 'poledne'); // Will output "Ahoj, já jsem Honza, přeji krásné poledne"
$translator->translate('messages.withArgsRev', 'Honza', 'poledne'); // Will output "Krásné poledne, já jsem Honza"
```
Expand Down
67 changes: 40 additions & 27 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,42 @@
{
"name": "bckp/translator-core",
"description": "Simple and fast PHP translator",
"keywords": ["translator"],
"homepage": "https://github.com/bckp/translator-core",
"license": "BSD-3-Clause",
"authors": [
{
"name": "Radovan Kepák",
"homepage": "https://kepak.eu"
}
],
"require": {
"php": "^7.1|^8.0",
"nette/php-generator": ">3.3 <4",
"nette/neon": ">=2.4"
},
"suggest": {
"bckp/translator-nette": "For NETTE support"
},
"autoload": {
"classmap": ["src/"]
},
"require-dev": {
"squizlabs/php_codesniffer": "*",
"phpstan/phpstan": "^0.12",
"nette/tester": "^2.3"
}
"name": "bckp/translator-core",
"description": "Simple and fast PHP translator",
"keywords": [
"translator"
],
"homepage": "https://github.com/bckp/translator-core",
"license": "BSD-3-Clause",
"authors": [
{
"name": "Radovan Kepák",
"homepage": "https://kepak.dev"
}
],
"require": {
"php": "^8.2",
"nette/php-generator": ">=4 <5",
"nette/neon": ">3.3 <4"
},
"suggest": {
"bckp/translator-nette": "For NETTE support"
},
"autoload": {
"classmap": [
"src/"
]
},
"scripts": {
"phpstan": "phpstan analyse",
"tests": "tester tests -s",
"tests-watch": "tester tests -s -w src",
"phpcs": "PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer check",
"phpcs-fix": "PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix"
},
"require-dev": {
"roave/security-advisories": "dev-latest",
"phpstan/phpstan": "^2",
"nette/utils": "^4.0",
"nette/tester": "^2.5",
"friendsofphp/php-cs-fixer": "^3.75"
}
}
5 changes: 5 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
parameters:
level: 8

paths:
- src
8 changes: 0 additions & 8 deletions ruleset.xml

This file was deleted.

Loading