Skip to content

Commit

Permalink
Merge branch '7.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
llaville committed Jan 1, 2024
2 parents 2b783d0 + 45c36a8 commit 26b0219
Show file tree
Hide file tree
Showing 41 changed files with 862 additions and 67 deletions.
16 changes: 16 additions & 0 deletions .changes/7.x/7.1.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

## 7.1.0 - 2024-01-01

> **WARNING**
>
> As PHP 8.0 is still supported, database of CompatInfoDB (v5.14) is outdated and does not contain recent PHP 8.3 elements.
>
> But source code that implement PHP 8.3 new features may be detected !
### Added

- PHP 8.3.0 support
- Docker support with official image : <https://github.com/llaville/php-compatinfo/pkgs/container/php-compatinfo>
- Compatibility with Symfony Components v7

**Full Changelog**: [7.0.3...7.1.0](https://github.com/llaville/php-compatinfo/compare/7.0.3...7.1.0)
1 change: 1 addition & 0 deletions .github/linters/phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ parameters:
excludePaths:
- ../../src/Infrastructure/ManifestBuilder.php
treatPhpDocTypesAsCertain: false
checkGenericClassInNonGenericObjectType: false
ignoreErrors:
-
message: "#^Method Bartlett\\\\CompatInfo\\\\Application\\\\Analyser\\\\CompatibilityAnalyser\\:\\:leave[a-zA-Z0-9\\_]+\\(\\) is unused\\.$#"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ on:
push:
branches:
- master
- "7.0"
- "7.1"
paths:
- docs/**
pull_request:
workflow_dispatch:

jobs:
deploy:
uses: llaville/.github/.github/workflows/gh-pages.yml@uml
uses: llaville/.github/.github/workflows/gh-pages.yml@master
with:
destination-dir: "7.0"
destination-dir: "7.1"
force-orphan: false
hook-script: "resources/gh-pages-hook.sh"
php-version: "8.1"
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ jobs:
os:
- ubuntu-22.04
php:
- 8.1
- 8.2
tools:
- box:4.6 # available since https://github.com/shivammathur/setup-php/releases/tag/2.27.0

steps:
- # https://github.com/actions/checkout
Expand All @@ -37,6 +39,8 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: "none"
tools: ${{ matrix.tools }}

- # https://github.com/ramsey/composer-install
name: Install Composer dependencies
Expand All @@ -56,15 +60,15 @@ jobs:
box-manifest manifest:build --ansi -vv -c box.json --output-file=sbom.json
box-manifest manifest:build --ansi -vv -c box.json --output-file=console.txt --format console
box-manifest manifest:stub --ansi -vv -c box.json --output-file=stub.php --resource console.txt --resource sbom.json
box-manifest box:compile --ansi -vv -c box.json.dist
box compile --ansi -vv -c box.json.dist
- # https://github.com/softprops/action-gh-release
name: Create Release from current tag
if: github.ref_type == 'tag'
uses: softprops/action-gh-release@v1
with: # https://github.com/softprops/action-gh-release#-customizing
prerelease: false
draft: true
draft: false
body_path: ${{ github.workspace }}/.changes/7.x/${{ github.ref_name }}.md
# https://github.com/softprops/action-gh-release#%EF%B8%8F-uploading-release-assets
files: |
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).

## 7.1.0 - 2024-01-01

> **WARNING**
>
> As PHP 8.0 is still supported, database of CompatInfoDB (v5.14) is outdated and does not contain recent PHP 8.3 elements.
>
> But source code that implement PHP 8.3 new features may be detected !
### Added

- PHP 8.3.0 support
- Docker support with official image : <https://github.com/llaville/php-compatinfo/pkgs/container/php-compatinfo>
- Compatibility with Symfony Components v7

**Full Changelog**: [7.0.3...7.1.0](https://github.com/llaville/php-compatinfo/compare/7.0.3...7.1.0)

## 7.0.3 - 2023-12-30

### Fixed
Expand Down
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# syntax=docker/dockerfile:1.4
ARG PHP_VERSION=8.1

FROM php:${PHP_VERSION}-cli-alpine

# https://github.com/opencontainers/image-spec/blob/main/annotations.md

LABEL org.opencontainers.image.title="llaville/php-compatinfo"
LABEL org.opencontainers.image.description="Docker image of bartlett/php-compatinfo Composer package"
LABEL org.opencontainers.image.source="https://github.com/llaville/php-compatinfo"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.authors="llaville"

COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh \
&& cp /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini

# Create a group and user
RUN addgroup appgroup && adduser appuser -D -G appgroup

# Tell docker that all future commands should run as the appuser user
USER appuser

# Install Composer v2 binary version
COPY --from=composer/composer:2-bin /composer /usr/bin/composer
ENV COMPOSER_ALLOW_SUPERUSER 1
ENV COMPOSER_PREFER_STABLE 1
RUN composer global require --no-progress bartlett/php-compatinfo ^7.1
#RUN composer global require --no-progress bartlett/php-compatinfo 7.1.x-dev

# Following recommendation at https://docs.github.com/en/actions/creating-actions/dockerfile-support-for-github-actions#workdir

ENTRYPOINT ["/entrypoint.sh"]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2010-2023, Laurent Laville <[email protected]>
Copyright (c) 2010-2024, Laurent Laville

Credits to :

Expand Down
28 changes: 20 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@

**PHP CompatInfo** is a library that can find the minimum version and the extensions required for a piece of code to run.

Running on PHP greater or equal than 7.2 for parsing source code in a format PHP 5.2 to PHP 8.2
Running on PHP greater or equal than 7.2 for parsing source code in a format PHP 5.2 to PHP 8.3

## Versions

| Releases | Branch | PHP | Packagist | License | Documentation |
|:--------------|:-------------------------------------------:|:-------------------------------------------------------------:|:---------------------------------------------------------:|:----------------------------------------------:|:----------------------------------------------------------------:|
| Stable v5.5.x | [![Branch 5.5][Branch_55x-img]][Branch_55x] | [![Minimum PHP Version)][PHPVersion_55x-img]][PHPVersion_55x] | [![Stable Version 5.5][Packagist_55x-img]][Packagist_55x] | [![License 5.5][License_55x-img]][License_55x] | [![Documentation 5.5][Documentation_55x-img]][Documentation_55x] |
| Stable v6.5.x | [![Branch 6.5][Branch_65x-img]][Branch_65x] | [![Minimum PHP Version)][PHPVersion_65x-img]][PHPVersion_65x] | [![Stable Version 6.5][Packagist_65x-img]][Packagist_65x] | [![License 6.5][License_65x-img]][License_65x] | [![Documentation 6.5][Documentation_65x-img]][Documentation_65x] |
| Stable v7.0.x | [![Branch 7.0][Branch_70x-img]][Branch_70x] | [![Minimum PHP Version)][PHPVersion_70x-img]][PHPVersion_70x] | [![Stable Version 7.0][Packagist_70x-img]][Packagist_70x] | [![License 7.0][License_70x-img]][License_70x] | [![Documentation 7.0][Documentation_70x-img]][Documentation_70x] |
| Releases | Branch | PHP | Packagist | License | Documentation |
|:----------------|:-------------------------------------------:|:-------------------------------------------------------------:|:---------------------------------------------------------:|:----------------------------------------------:|:----------------------------------------------------------------:|
| Stable v5.5.x | [![Branch 5.5][Branch_55x-img]][Branch_55x] | [![Minimum PHP Version)][PHPVersion_55x-img]][PHPVersion_55x] | [![Stable Version 5.5][Packagist_55x-img]][Packagist_55x] | [![License 5.5][License_55x-img]][License_55x] | [![Documentation 5.5][Documentation_55x-img]][Documentation_55x] |
| Stable v6.5.x | [![Branch 6.5][Branch_65x-img]][Branch_65x] | [![Minimum PHP Version)][PHPVersion_65x-img]][PHPVersion_65x] | [![Stable Version 6.5][Packagist_65x-img]][Packagist_65x] | [![License 6.5][License_65x-img]][License_65x] | [![Documentation 6.5][Documentation_65x-img]][Documentation_65x] |
| Stable v7.0.x | [![Branch 7.0][Branch_70x-img]][Branch_70x] | [![Minimum PHP Version)][PHPVersion_70x-img]][PHPVersion_70x] | [![Stable Version 7.0][Packagist_70x-img]][Packagist_70x] | [![License 7.0][License_70x-img]][License_70x] | [![Documentation 7.0][Documentation_70x-img]][Documentation_70x] |
| Stable v7.1.x | [![Branch 7.1][Branch_71x-img]][Branch_71x] | [![Minimum PHP Version)][PHPVersion_71x-img]][PHPVersion_71x] | [![Stable Version 7.1][Packagist_71x-img]][Packagist_71x] | [![License 7.1][License_71x-img]][License_71x] | [![Documentation 7.1][Documentation_71x-img]][Documentation_71x] |

[Branch_55x-img]: https://img.shields.io/badge/branch-5.5-orange
[Branch_55x]: https://github.com/llaville/php-compatinfo/tree/5.5
Expand Down Expand Up @@ -49,10 +50,21 @@ Running on PHP greater or equal than 7.2 for parsing source code in a format PHP
[Documentation_70x-img]: https://img.shields.io/badge/documentation-v7.0-green
[Documentation_70x]: https://github.com/llaville/php-compatinfo/tree/7.0/docs

[Branch_71x-img]: https://img.shields.io/badge/branch-7.1-orange
[Branch_71x]: https://github.com/llaville/php-compatinfo/tree/7.1
[PHPVersion_71x-img]: https://img.shields.io/packagist/php-v/bartlett/php-compatinfo/7.1.0
[PHPVersion_71x]: https://www.php.net/supported-versions.php
[Packagist_71x-img]: https://img.shields.io/badge/packagist-v7.1.0-blue
[Packagist_71x]: https://packagist.org/packages/bartlett/php-compatinfo
[License_71x-img]: https://img.shields.io/packagist/l/bartlett/php-compatinfo
[License_71x]: https://github.com/llaville/php-compatinfo/blob/7.1/LICENSE
[Documentation_71x-img]: https://img.shields.io/badge/documentation-v7.1-green
[Documentation_71x]: https://github.com/llaville/php-compatinfo/tree/7.1/docs

## Documentation

All the documentation is available on [website](https://llaville.github.io/php-compatinfo/7.0),
generated from the [docs](https://github.com/llaville/php-compatinfo/tree/7.0/docs) folder.
All the documentation is available on [website](https://llaville.github.io/php-compatinfo/7.1),
generated from the [docs](https://github.com/llaville/php-compatinfo/tree/7.1/docs) folder.

## Contributors

Expand Down
20 changes: 10 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"issues": "https://github.com/llaville/php-compatinfo/issues"
},
"require": {
"php": "~8.0 || ~8.1 || ~8.2",
"php": "~8.0 || ~8.1 || ~8.2 || ~8.3",
"ext-json": "*",
"ext-pcre": "*",
"ext-spl": "*",
Expand All @@ -21,16 +21,16 @@
"nikic/php-parser": "^4.10",
"psr/log": "^3.0",
"ramsey/uuid": "^3.9 || ^4.0",
"symfony/config": "^5.4 || ^6.0",
"symfony/console": "^5.4 || ^6.0",
"symfony/event-dispatcher": "^5.4 || ^6.0",
"symfony/finder": "^5.4 || ^6.0",
"symfony/dependency-injection": "^5.4 || ^6.0",
"symfony/serializer": "^5.4 || ^6.0",
"symfony/stopwatch": "^5.4 || ^6.0"
"symfony/config": "^5.4 || ^6.0 || ^7.0",
"symfony/console": "^5.4 || ^6.0 || ^7.0",
"symfony/event-dispatcher": "^5.4 || ^6.0 || ^7.0",
"symfony/finder": "^5.4 || ^6.0 || ^7.0",
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
"symfony/serializer": "^5.4 || ^6.0 || ^7.0",
"symfony/stopwatch": "^5.4 || ^6.0 || ^7.0"
},
"require-dev": {
"symfony/framework-bundle": "^5.4 || ^6.0",
"symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0",
"bamarni/composer-bin-plugin": "^1.8"
},
"authors": [
Expand Down Expand Up @@ -68,7 +68,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "7.0.x-dev"
"dev-master": "7.1.x-dev"
},
"bamarni-bin": {
"bin-links": true,
Expand Down
33 changes: 33 additions & 0 deletions config/set/php83.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php declare(strict_types=1);
/**
* This file is part of the PHP_CompatInfo package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

use Bartlett\CompatInfo\Application\Sniffs\Attributes\OverrideAttributeSniff;
use Bartlett\CompatInfo\Application\Sniffs\Constants\DynamicClassConstantFetchSniff;
use Bartlett\CompatInfo\Application\Sniffs\Constants\TypedClassConstantSniff;
use Bartlett\CompatInfo\Application\Sniffs\Expressions\StaticVarInitializerSniff;

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

/**
* Build the Container with PHP 8.3 features detection
*
* @author Laurent Laville
* @since Release 7.1.0
*/
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();

$services->defaults()
->autowire()
;

$services->set(OverrideAttributeSniff::class);
$services->set(DynamicClassConstantFetchSniff::class);
$services->set(TypedClassConstantSniff::class);
$services->set(StaticVarInitializerSniff::class);
};
20 changes: 20 additions & 0 deletions config/set/up-to-php83.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php declare(strict_types=1);
/**
* This file is part of the PHP_CompatInfo package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

/**
* Build the Container with PHP features detection up to version 8.3
*
* @author Laurent Laville
* @since Release 7.1.0
*/
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import(__DIR__ . '/up-to-php82.php');
$containerConfigurator->import(__DIR__ . '/php83.php');
};
10 changes: 8 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,23 @@
**PHP CompatInfo** is a library that
can find the minimum version and the extensions required for a piece of code to run.

Running on PHP greater or equal than 8.0 for parsing source code in a format PHP 5.2 to PHP 8.2
Running on PHP greater or equal than 8.0 for parsing source code in a format PHP 5.2 to PHP 8.3

![Graph Composer](./assets/images/graph-composer.svg)

## Features

- Parse source code in format PHP 5.2 to PHP 8.2
- Parse source code in format PHP 5.2 to PHP 8.3
- Detect PHP features for each Major/minor versions
- Detect versions of all directives, constants, functions, classes, interfaces of 100 extensions and more
- Display/Inspect list of extensions, and their versions supported

## Usage

> Learn more about different usages with console, Docker and programmatically.
See [Getting-Started's Guide](usage/README.md) to know how to use it.

## Installation

> Learn how to install `CompatInfo` application in different way.
Expand Down
20 changes: 10 additions & 10 deletions docs/components/README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
<!-- markdownlint-disable MD013 -->
## Components
# Components

- Parsing PHP 5, PHP 7 or PHP 8 code into an abstract syntax tree (AST) is provided by
the [PHP-Parser](https://github.com/nikic/PHP-Parser) library.

- Contextual elements and minimum PHP versions detection provided by following node visitors.

### PHP-Parser [Node Visitors](./parser/README.md)
## PHP-Parser [Node Visitors](./parser/README.md)

- Parent references with the `ParentContextVisitor`
- Name Resolution with the `NameResolverVisitor`
- Version Resolution with the `VersionResolverVisitor`

### [Profiler](./profiler/README.md)
## [Profiler](./profiler/README.md)

- Data Collector(s) with common `DataCollector` and specialized `VersionDataCollector` classes
- Data Collector(s) contract with the `CollectorInterface`
- Collector Handler for both Profile and Profiler with `CollectorTrait`
- Profile information for a single data source with `Profile`

### [Sniffs](./sniffs/README.md)
## [Sniffs](./sniffs/README.md)

They are grouped by categories to solve PHP features (from 4.0 to 8.2)
They are grouped by categories to solve PHP features (from 4.0 to 8.3)

- Arrays (3)
- Attributes (3)
- Attributes (4)
- Classes (11)
- Constants (4)
- Constants (6)
- ControlStructures (4)
- Enumerations (1)
- Expressions (3)
- Expressions (4)
- Fibers (1)
- FunctionCalls (1)
- FunctionDeclarations (7)
Expand All @@ -40,7 +40,7 @@ They are grouped by categories to solve PHP features (from 4.0 to 8.2)
- TextProcessing (2)
- UseDeclarations (2)

### [Extensions](./extensions/README.md)
## [Extensions](./extensions/README.md)

PHPCompatInfo can be extended by registering objects that implement one or more of the following interfaces:

Expand All @@ -59,7 +59,7 @@ PHPCompatInfo can be extended by registering objects that implement one or more

Furthermore, extensions may implement the `Symfony\Component\EventDispatcher\EventSubscriberInterface` in order to have its event handlers automatically registered with the EventDispatcher when the extension is loaded.

### [Polyfills](./polyfills/README.md)
## [Polyfills](./polyfills/README.md)

They are identified by services that implements the `Bartlett\CompatInfo\Application\Polyfills\PolyfillInterface`.

Loading

0 comments on commit 26b0219

Please sign in to comment.