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
7 changes: 6 additions & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@ jobs:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
mongo:
image: library/mongo:4.0
image: mongo:4.4
ports:
- 27017:27017
env:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: secret
options: >-
--health-cmd "mongo mongodb://admin:secret@localhost:27017/admin --eval 'db.adminCommand(\"ping\")'"
--health-interval 10s
--health-timeout 5s
--health-retries 5

strategy:
matrix:
Expand Down
15 changes: 13 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
# Composer dependencies (installed with composer install)
vendor
composer.lock

# PhpStorm IDE configuration and cache
.idea

# Test application temporary directory
Tests/app/tmp/

# PHPUnit result cache
.phpunit.result.cache

# PHP-CS-Fixer cache
.php-cs-fixer.cache

# Generated documentation
.docs
.demo

# Demo or demonstration environment
.demo
21 changes: 21 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

$finder = PhpCsFixer\Finder::create()
->exclude('bin')
->exclude('vendor')
->in(__DIR__);

return (new PhpCsFixer\Config())
->setRules([
'@PSR12' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => true,
'blank_line_after_opening_tag' => true,
'concat_space' => ['spacing' => 'one'],
'no_extra_blank_lines' => true,
'no_leading_import_slash' => true,
'no_trailing_comma_in_singleline' => true,
'no_unused_imports' => true,
'ordered_imports' => true,
])
->setFinder($finder);
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.4-cli-bullseye
FROM php:8.3-cli-bullseye
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The one downside I see here is that we will not see deprecation errors when testing/running the code on local. Personally, I'm not affected by this, because I have a separate php 8.5 docker running for it, but still...


ENV COMPOSER_ALLOW_SUPERUSER=1

Expand Down
4 changes: 2 additions & 2 deletions LexikTranslationBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Lexik\Bundle\TranslationBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Lexik\Bundle\TranslationBundle\DependencyInjection\Compiler\RegisterMappingPass;
use Lexik\Bundle\TranslationBundle\DependencyInjection\Compiler\TranslatorPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

/**
* Bundle main class.
Expand Down
55 changes: 55 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
.PHONY: up down build test rector cs-fix phpstan ensure-up help cache-clear install update

DOCKER_RUN = docker compose run --rm lexik_translation

.DEFAULT_GOAL := help

help:
@echo "LexikTranslationBundle - Available commands:"
@echo ""
@echo " make up Start services in the background"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix white space please

@echo " make ensure-up Start services and install dependencies (composer)"
@echo " make down Stop and remove containers"
@echo " make build Build Docker images"
@echo " make test Run test suite (PHPUnit)"
@echo " make rector Run Rector (refactoring)"
@echo " make cs-fix Apply PHP-CS-Fixer (code style)"
@echo " make phpstan Run PHPStan (static analysis)"
@echo " make cache-clear Clear Composer cache"
@echo " make install Install dependencies (composer install)"
@echo " make update Update dependencies (composer update)"
@echo " make help Show this help"

up:
docker compose up -d

ensure-up:
docker compose up -d
$(DOCKER_RUN) composer install --prefer-dist --no-progress

down:
docker compose down

build:
docker compose build

test: ensure-up
$(DOCKER_RUN) composer test

rector: ensure-up
$(DOCKER_RUN) vendor/bin/rector process

cs-fix: ensure-up
$(DOCKER_RUN) vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php

phpstan: ensure-up
$(DOCKER_RUN) vendor/bin/phpstan analyse --memory-limit=512M

cache-clear: ensure-up
$(DOCKER_RUN) composer clear-cache

install: ensure-up
$(DOCKER_RUN) composer install --prefer-dist --no-progress

update: ensure-up
$(DOCKER_RUN) composer update --no-progress
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ Here is a little screen shot of the edition page :)

![edition page screen](https://github.com/lexik/LexikTranslationBundle/raw/master/Resources/doc/screen/grid.jpg)

Development
===========

The project provides a **Makefile** for common tasks (tests, static analysis, code style). See **[docs/development.md](docs/development.md)** for:

* How to use the Makefile (requires [GNU Make](https://www.gnu.org/software/make/), usually pre-installed on Linux and macOS).
* **Cross-platform**: running the same commands on Windows (without Make) using Docker Compose.
* Cache files (e.g. `.php-cs-fixer.cache`) are listed in `.gitignore` and are not committed; you can remove them locally if needed.

TESTING
=======

Expand Down
9 changes: 7 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@
"doctrine/doctrine-bundle": "^2.2",
"doctrine/mongodb-odm": "^2.7",
"doctrine/mongodb-odm-bundle": "^5.0",
"friendsofphp/php-cs-fixer": "^3.64",
"mikey179/vfsstream": "^1.6",
"mongodb/mongodb": "^1.21.0 || ^2.0.0",
"phpstan/phpstan": "^2.0",
"phpunit/phpunit": "^9.5|^10.0",
"rector/jack": "^0.2.3",
"rector/rector": "^0.14.8|^0.15",
"rector/rector": "^2.0",
"symfony/var-exporter": "^6.4|^7.0"
},
"autoload": {
Expand All @@ -70,6 +71,10 @@
"test": "vendor/bin/phpunit"
},
"config": {
"platform": {
"php": "8.2.0",
"ext-mongodb": "2.1.4"
},
"sort-packages": true
}
}
Loading