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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [ '8.3', '8.4' ]
php-versions: [ '8.3', '8.4', '8.5' ]

steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: SonarQube

on:
push:
Expand Down Expand Up @@ -41,6 +41,6 @@ jobs:
run: make php/tests # To generate the coverage report

- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v5.2.0
uses: SonarSource/sonarqube-scan-action@v7
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//~ Rules
->setRules(
[
'@PER-CS2.0' => true,
'@PER-CS3x0' => true,
]
)

Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [7.1.0] - 2026-01-05
[7.1.0]: https://github.com/eureka-framework/component-web/compare/7.0.0...7.1.0
### Added
- Now support PHP 8.5
### Changed
- Update CI
- Fix from PHPStan
- Fix code style
- Update dev dependencies


## [7.0.0] - 2025-08-15
[7.0.0]: https://github.com/eureka-framework/component-web/compare/6.0.0...7.0.0
### Added
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.PHONY: validate install update php/deps php/check php/fix php/min-compatibility php/max-compatibility php/phpstan php/analyze php/tests php/test php/testdox ci clean

PHP_MIN_VERSION := "8.3"
PHP_MAX_VERSION := "8.5"
COMPOSER_BIN := composer
PHP_VERSION_MIN := 8.3
PHP_VERSION_MAX := 8.4
define header =
@if [ -t 1 ]; then printf "\n\e[37m\e[100m \e[104m $(1) \e[0m\n"; else printf "\n### $(1)\n"; fi
endef
Expand Down Expand Up @@ -42,17 +42,17 @@ php/deps: composer.json

php/check: vendor/bin/php-cs-fixer
$(call header,Checking Code Style)
@./vendor/bin/php-cs-fixer check -v --diff
@XDEBUG_MODE=off ./vendor/bin/php-cs-fixer check
php/fix: vendor/bin/php-cs-fixer
$(call header,Fixing Code Style)
@./vendor/bin/php-cs-fixer fix -v
@XDEBUG_MODE=off ./vendor/bin/php-cs-fixer fix -v

php/min-compatibility: vendor/bin/phpstan build/reports/phpstan
$(call header,Checking PHP ${PHP_VERSION_MIN} compatibility)
$(call header,Checking PHP ${PHP_MIN_VERSION} compatibility)
@XDEBUG_MODE=off ./vendor/bin/phpstan analyse --configuration=./ci/phpmin-compatibility.neon --error-format=table

php/max-compatibility: vendor/bin/phpstan build/reports/phpstan #ci
$(call header,Checking PHP ${PHP_VERSION_MAX} compatibility)
$(call header,Checking PHP ${PHP_MAX_VERSION} compatibility)
@XDEBUG_MODE=off ./vendor/bin/phpstan analyse --configuration=./ci/phpmax-compatibility.neon --error-format=table

php/analyze: vendor/bin/phpstan build/reports/phpstan #manual & ci
Expand Down
63 changes: 42 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# component-web

[![Current version](https://img.shields.io/packagist/v/eureka/component-web.svg?logo=composer)](https://packagist.org/packages/eureka/component-web)
[![Supported PHP version](https://img.shields.io/static/v1?logo=php&label=PHP&message=8.3%20-%208.4&color=777bb4)](https://packagist.org/packages/eureka/component-web)
[![Supported PHP version](https://img.shields.io/static/v1?logo=php&label=PHP&message=>%3D8.3&color=777bb4)](https://packagist.org/packages/eureka/component-web)
![CI](https://github.com/eureka-framework/component-web/workflows/CI/badge.svg)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=eureka-framework_component-web&metric=alert_status)](https://sonarcloud.io/dashboard?id=eureka-framework_component-web)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=eureka-framework_component-web&metric=coverage)](https://sonarcloud.io/dashboard?id=eureka-framework_component-web)
Expand All @@ -18,11 +18,10 @@ Provide some utilities to website application:

## Composer
```bash
composer require "eureka/component-password"
composer require "eureka/component-web"
```



## Contributing

See the [CONTRIBUTING](CONTRIBUTING.md) file.
Expand All @@ -42,43 +41,65 @@ make update

NB: For the components, the `composer.lock` file is not committed.

## Testing & CI (Continuous Integration)
### Testing & CI (Continuous Integration)

#### Tests
You can run unit tests (with coverage) on your side with following command:
```bash
make php/tests
```

You can run integration tests (without coverage) on your side with following command:
```bash
make php/integration
```

You can run tests on your side with following commands:
For prettier output (but without coverage), you can use the following command:
```bash
make php/tests # run tests with coverage
make php/test # run tests with coverage
make php/testdox # run tests without coverage reports but with prettified output
```

You also can run code style check or code style fixes with following commands:
#### Code Style
You also can run code style check with following commands:
```bash
make php/check
```

You also can run code style fixes with following commands:
```bash
make php/check # run checks on check style
make php/fix # run check style auto fix
make php/fix
```

#### Check for missing explicit dependencies
You can check if any explicit dependency is missing with the following command:
```bash
make php/deps
```

#### Static Analysis
To perform a static analyze of your code (with phpstan, lvl 9 at default), you can use the following command:
```bash
make php/analyze # Same as phpstan but with CLI output as table
make php/analyse
```

To ensure you code still compatible with current supported version and futures versions of php, you need to
To ensure you code still compatible with current supported version at Deezer and futures versions of php, you need to
run the following commands (both are required for full support):

Minimal supported version:
```bash
make php/min-compatibility # run compatibility check on current minimal version of php we support
make php/max-compatibility # run compatibility check on last version of php we will support in future
make php/min-compatibility
```

And the last "helper" commands, you can run before commit and push is:
Maximal supported version:
```bash
make ci
make php/max-compatibility
```
This command clean the previous reports, install component if needed and run tests (with coverage report),
check the code style and check the php compatibility check, as it would be done in our CI.

## Contributing

See the [CONTRIBUTING](CONTRIBUTING.md) file.
#### CI Simulation
And the last "helper" commands, you can run before commit and push, is:
```bash
make ci
```

## License

Expand Down
2 changes: 1 addition & 1 deletion ci/phpmax-compatibility.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ includes:
- ./../vendor/phpstan/phpstan-phpunit/rules.neon

parameters:
phpVersion: 80400
phpVersion: 80500
level: 0
paths:
- ./../src
Expand Down
17 changes: 9 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,21 @@
},

"require": {
"php": "8.3.*||8.4.*",
"php": ">=8.3",
"ext-mbstring": "*",

"psr/http-message": "^1.0||^2.0"
},

"require-dev": {
"friendsofphp/php-cs-fixer": "^3.86.0",
"phpstan/phpstan": "^2.1.22",
"phpstan/phpstan-phpunit": "^2.0.7",
"phpstan/phpstan-strict-rules": "^2.0.6",
"phpunit/phpcov": "^11.0.1",
"phpunit/phpunit": "^12.3.4",
"shipmonk/composer-dependency-analyser": "^1.8.3"
"friendsofphp/php-cs-fixer": "^3.92.4",
"phpstan/phpstan": "^2.1.33",
"phpstan/phpstan-deprecation-rules": "^2.0.3",
"phpstan/phpstan-phpunit": "^2.0.11",
"phpstan/phpstan-strict-rules": "^2.0.7",
"phpunit/phpcov": "^11.0.3",
"phpunit/phpunit": "^12.5.4",
"shipmonk/composer-dependency-analyser": "^1.8.4"
}

}
2 changes: 2 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
includes:
- ./vendor/phpstan/phpstan-phpunit/extension.neon
- ./vendor/phpstan/phpstan-phpunit/rules.neon
- ./vendor/phpstan/phpstan-deprecation-rules/rules.neon
- ./vendor/phpstan/phpstan-strict-rules/rules.neon
- phar://phpstan.phar/conf/bleedingEdge.neon

parameters:
phpVersion: 80300
Expand Down
18 changes: 3 additions & 15 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
<?xml version="1.0"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.2/phpunit.xsd"
backupGlobals="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.5/phpunit.xsd"
colors="true"
failOnEmptyTestSuite="false"
failOnIncomplete="true"
failOnRisky="true"
failOnWarning="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnPhpunitDeprecations="true"
displayDetailsOnTestsThatTriggerErrors="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true"
cacheDirectory="build/.phpunit.cache">

<php>
<ini name="error_reporting" value="E_ALL"/>
</php>
cacheDirectory="build/.phpunit.cache"
>

<source>
<include>
Expand Down
1 change: 1 addition & 0 deletions src/Collection/AbstractCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public function count(): int

protected function pushItem(BreadcrumbItem|CarouselItem|MenuItem|NotificationInterface $item): self
{
/** @var string $itemName */
$itemName = \method_exists($item, 'getName') ? $item->getName() : (string) $this->count();
$this->collection[$this->count] = $item;
$this->names[$itemName] = $this->count;
Expand Down
4 changes: 2 additions & 2 deletions src/Session/SessionAwareTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@

trait SessionAwareTrait
{
protected Session|null $session = null;
protected ?Session $session = null;

public function setSession(Session $session): void
{
$this->session = $session;
}

protected function getSession(): Session|null
protected function getSession(): ?Session
{
return $this->session;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/BreadcrumbTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function testICanPushAndPopItemToBreadcrumb(): void

$item = $breadcrumb->pop();

self::assertEquals('item 2', $item->getName());
self::assertSame('item 2', $item->getName());
}

public function testICanIterateOnBreadcrumbInstance(): void
Expand All @@ -36,7 +36,7 @@ public function testICanIterateOnBreadcrumbInstance(): void

foreach ($breadcrumb as $index => $item) {
/** @var BreadcrumbItem $item */
self::assertEquals('item ' . ($index + 1), $item->getName());
self::assertSame('item ' . ($index + 1), $item->getName());
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/CarouselTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function testICanPushAndPopItemToCarousel(): void

$item = $carousel->pop();

self::assertEquals('item 2', $item->getTitle());
self::assertSame('item 2', $item->getTitle());
}

public function testICanIterateOnCarouselInstance(): void
Expand All @@ -36,7 +36,7 @@ public function testICanIterateOnCarouselInstance(): void

foreach ($carousel as $index => $item) {
/** @var CarouselItem $item */
self::assertEquals('item ' . ($index + 1), $item->getTitle());
self::assertSame('item ' . ($index + 1), $item->getTitle());
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/MenuTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function testICanPushAndGetItemToMenu(): void

$item = $menu->get('item 2');

self::assertEquals('item 2', $item?->getName());
self::assertSame('item 2', $item?->getName());
}

public function testICanIterateOnMenuInstance(): void
Expand All @@ -36,7 +36,7 @@ public function testICanIterateOnMenuInstance(): void

foreach ($menu as $index => $item) {
/** @var MenuItem $item */
self::assertEquals('item ' . ($index + 1), $item->getName());
self::assertSame('item ' . ($index + 1), $item->getName());
}
}

Expand Down
Loading