Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
a5b158c
#139 adding text-decoration shorthand
tbela99 Nov 12, 2022
e9df236
Merge branch 'master' of github.com:tbela99/css into shorthands
tbela99 Nov 12, 2022
60ea6f7
Remove an optimisation which breaks relative URLs
shish Aug 18, 2023
0baabc1
use relative paths in sourcemap
shish Aug 18, 2023
1de04ec
Fix deprecation warnings
shish Aug 18, 2023
48edbbf
fix another incompatible type hint
shish Aug 18, 2023
64c2d29
Fix implicitly marking parameter as nullable is deprecated, the expli…
8ctopus Nov 25, 2025
3b92a3e
Fix case statements followed by a semicolon (;) are deprecated, use a…
8ctopus Nov 25, 2025
7e4480e
Fix return type of TBela\CSS\Property\Property::offsetSet(, ) should …
8ctopus Nov 25, 2025
fe83395
update ci scripts
tbela99 Nov 25, 2025
217aadc
Merge pull request #148 from shish/relative-url
tbela99 Nov 25, 2025
777eb3a
Merge pull request #149 from shish/relative-source
tbela99 Nov 25, 2025
a51a03b
Merge branch 'fix-implicit-nullable' of https://github.com/8ctopus/cs…
tbela99 Nov 25, 2025
1b100c8
Merge branch 'v.next' of github.com:tbela99/css into v.next
tbela99 Nov 25, 2025
5d19371
Merge branch 'deprecations' of https://github.com/shish/php-css into …
tbela99 Nov 25, 2025
3db538e
Merge branch 'fix-case' of https://github.com/8ctopus/css into 8ctopu…
tbela99 Nov 25, 2025
c62932a
Merge branch 'fix-array-access' of https://github.com/8ctopus/css int…
tbela99 Nov 26, 2025
bdfbd9a
Fix deprecations on v.next branch
8ctopus Nov 26, 2025
85783c8
Merge pull request #155 from 8ctopus/v.next
tbela99 Nov 26, 2025
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
11 changes: 5 additions & 6 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
name: PHP8.0-CI
name: PHP8.5-CI

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

jobs:
build:

runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: "8.5"
extensions: mbstring, xml, curl
tools: phpunit, composer

Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/php8.1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@ name: PHP8.1-CI

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

jobs:
build:

runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: "8.1"
extensions: mbstring, xml, curl
tools: phpunit, composer

Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/php8.2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@ name: PHP8.2-CI

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

jobs:
build:

runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: "8.2"
extensions: mbstring, xml, curl
tools: phpunit, composer

Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/php5.6.yml → .github/workflows/php8.3.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
name: PHP5.6-CI
name: PHP8.3-CI

on:
push:
branches: [ php56-backport ]
branches: [master]
pull_request:
branches: [ php56-backport ]
branches: [master]

jobs:
build:

runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '5.6'
php-version: "8.3"
extensions: mbstring, xml, curl
tools: phpunit, composer

Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/php7.4.yml → .github/workflows/php8.4.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
name: PHP7.4-CI
name: PHP8.4-CI

on:
push:
branches: [ php56-backport ]
branches: [master]
pull_request:
branches: [ php56-backport ]
branches: [master]

jobs:
build:

runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: "8.4"
extensions: mbstring, xml, curl
tools: phpunit, composer

Expand Down
8 changes: 6 additions & 2 deletions src/ArrayTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public function __unset($name) {
* @param string $value
* @ignore
*/
public function offsetSet($offset, $value)
#[\ReturnTypeWillChange]
public function offsetSet(mixed $offset, mixed $value): void
{

if (is_callable([$this, 'set' . $offset])) {
Expand All @@ -58,6 +59,7 @@ public function offsetSet($offset, $value)
* @return bool
* @ignore
*/
#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
return is_callable([$this, 'get' . $offset]) ||
Expand All @@ -69,6 +71,7 @@ public function offsetExists($offset)
* @param string $offset
* @ignore
*/
#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{

Expand All @@ -83,6 +86,7 @@ public function offsetUnset($offset)
* @return mixed|null
* @ignore
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{

Expand Down Expand Up @@ -116,4 +120,4 @@ public function offsetGet($offset)

return null;
}
}
}
8 changes: 4 additions & 4 deletions src/Color.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,19 +342,19 @@ public static function hex2rgba_values($hex)

switch (strlen($hex)) {

case 4;
case 4:

return [hexdec($hex[1] . $hex[1]), hexdec($hex[2] . $hex[2]), hexdec($hex[3] . $hex[3])];

case 5;
case 5:

return [hexdec($hex[1] . $hex[1]), hexdec($hex[2] . $hex[2]), hexdec($hex[3] . $hex[3]), ValueNumber::compress(round(hexdec($hex[4] . $hex[4]) / 255, 2))];

case 7;
case 7:

return [hexdec($hex[1] . $hex[2]), hexdec($hex[3] . $hex[4]), hexdec($hex[5] . $hex[6])];

case 9;
case 9:

return [hexdec($hex[1] . $hex[2]), hexdec($hex[3] . $hex[4]), hexdec($hex[5] . $hex[6]), ValueNumber::compress(round(hexdec($hex[7] . $hex[8]) / 255, 2))];
}
Expand Down
5 changes: 3 additions & 2 deletions src/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,8 @@ public function getAst()
* @return stdClass
* @ignore
*/
public function jsonSerialize () {
#[\ReturnTypeWillChange]
public function jsonSerialize (): mixed {

return $this->getAst();
}
Expand Down Expand Up @@ -652,4 +653,4 @@ public function toObject()
{
return $this->ast;
}
}
}
4 changes: 2 additions & 2 deletions src/Element/AtRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function addDeclaration ($name, $value) {
* @return \stdClass
* @ignore
*/
public function jsonSerialize () {
public function jsonSerialize (): mixed {

$ast = parent::jsonSerialize();

Expand All @@ -116,4 +116,4 @@ public function jsonSerialize () {

return $ast;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?php

namespace TBela\CSS\Property;
namespace TBela\CSS\Element\Declaration;

use TBela\CSS\Interfaces\RenderableInterface;
use TBela\CSS\Value;

/**
* Comment property class
Expand Down
25 changes: 15 additions & 10 deletions src/Property/Config.php → src/Element/Declaration/Config.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace TBela\CSS\Property;
namespace TBela\CSS\Element\Declaration;

$file = dirname(__DIR__).'/config.json';
$file = dirname(__DIR__.'/../../..').'/config.json';

if (is_file($file)) {

Expand All @@ -29,7 +29,8 @@ final class Config {
* load properties configuration from a JSON file
* @param string $file
*/
public static function load($file) {
public static function load(string $file): void
{

Config::$config = json_decode(file_get_contents($file), true) ?? [];
}
Expand All @@ -39,7 +40,8 @@ public static function load($file) {
* @param string $path
* @return bool
*/
public static function exists($path) {
public static function exists(string $path): bool
{

$found = true;
$item = Config::$config['alias'];
Expand Down Expand Up @@ -83,7 +85,8 @@ public static function exists($path) {
* @return mixed|null
* @ignore
*/
public static function getPath($path, $default = null) {
public static function getPath(string $path, mixed $default = null): mixed
{

$data = Config::$config;

Expand All @@ -106,7 +109,8 @@ public static function getPath($path, $default = null) {
* @param mixed|null $default
* @return array|mixed|null
*/
public static function getProperty ($name = null, $default = null) {
public static function getProperty (?string $name = null, mixed $default = null): mixed
{

if (is_null($name)) {

Expand Down Expand Up @@ -136,7 +140,8 @@ public static function getProperty ($name = null, $default = null) {
* @return array
* @ignore
*/
public static function addSet ($shorthand, $pattern, array $properties, $separator = null, $shorthandOverride = null) {
public static function addSet ($shorthand, $pattern, array $properties, ?string $separator = null, ?string $shorthandOverride = null): array
{

$config = [];

Expand All @@ -157,7 +162,7 @@ public static function addSet ($shorthand, $pattern, array $properties, $separat
// build value map
foreach ($properties as $property => $data) {

if (strpos($property, '.') !== false) {
if (str_contains($property, '.')) {

continue;
}
Expand All @@ -167,7 +172,7 @@ public static function addSet ($shorthand, $pattern, array $properties, $separat

foreach ($properties as $property => $data) {

if (strpos($property, '.') !== false) {
if (str_contains($property, '.')) {

$config[$shorthand][preg_replace('#^[^.]+\.#', '', $property)] = $data;
continue;
Expand All @@ -177,7 +182,7 @@ public static function addSet ($shorthand, $pattern, array $properties, $separat

if (isset($data['value_map'])) {

$map_keys = $value_map_keys[$properties[$property]['type']];
$map_keys = $value_map_keys[$data['type']];

$config[$shorthand]['value_map'][$property] = array_map(function ($value) use ($map_keys) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace TBela\CSS\Property;
namespace TBela\CSS\Element\Declaration;

use ArrayAccess;
use TBela\CSS\ArrayTrait;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?php

namespace TBela\CSS\Property;
namespace TBela\CSS\Element\Declaration;

use ArrayIterator;
use IteratorAggregate;
use TBela\CSS\Value;
use TBela\CSS\Element\Rule;
use TBela\CSS\Element\RuleList;

Expand Down Expand Up @@ -36,7 +35,7 @@ class PropertyList implements IteratorAggregate
* @param RuleList|null $list
* @param array $options
*/
public function __construct(RuleList $list = null, array $options = [])
public function __construct(?RuleList $list = null, array $options = [])
{

$this->options = array_merge($this->options, $options);
Expand Down Expand Up @@ -360,7 +359,8 @@ public function isEmpty() {
/**
* @inheritDoc
*/
public function getIterator()
#[\ReturnTypeWillChange]
public function getIterator(): \Traversable
{
return $this->getProperties();
}
Expand Down
Loading
Loading