Composer update

This commit is contained in:
Matias Griese
2020-07-01 21:51:08 +03:00
parent 5b72ff3765
commit 5ca476e0cb
46 changed files with 3097 additions and 974 deletions

View File

@@ -24,7 +24,7 @@
"ext-json": "*",
"composer/semver": "^1.4",
"p3k/picofeed": "@stable",
"scssphp/scssphp": "^1.0"
"scssphp/scssphp": "^1.1"
},
"require-dev": {
"codeception/codeception": "^2.4",

608
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -279,7 +279,7 @@ class ClassLoader
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
}
/**
@@ -377,7 +377,7 @@ class ClassLoader
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath . '\\';
$search = $subPath.'\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {

10
vendor/composer/autoload_files.php vendored Normal file
View File

@@ -0,0 +1,10 @@
<?php
// autoload_files.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'7e9bd612cc444b3eed788ebbe46263a0' => $vendorDir . '/laminas/laminas-zendframework-bridge/src/autoload.php',
);

View File

@@ -6,8 +6,9 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'ZendXml\\' => array($vendorDir . '/zendframework/zendxml/src'),
'ScssPhp\\ScssPhp\\' => array($vendorDir . '/scssphp/scssphp/src'),
'Laminas\\ZendFrameworkBridge\\' => array($vendorDir . '/laminas/laminas-zendframework-bridge/src'),
'Laminas\\Xml\\' => array($vendorDir . '/laminas/laminas-xml/src'),
'Grav\\Plugin\\Admin\\' => array($baseDir . '/classes/plugin'),
'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
);

View File

@@ -13,9 +13,6 @@ class ComposerAutoloaderInitb286bbda7f18d999afbef65014afb574
}
}
/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader()
{
if (null !== self::$loader) {
@@ -50,6 +47,24 @@ class ComposerAutoloaderInitb286bbda7f18d999afbef65014afb574
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInitb286bbda7f18d999afbef65014afb574::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequireb286bbda7f18d999afbef65014afb574($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequireb286bbda7f18d999afbef65014afb574($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
}
}

View File

@@ -6,15 +6,20 @@ namespace Composer\Autoload;
class ComposerStaticInitb286bbda7f18d999afbef65014afb574
{
public static $files = array (
'7e9bd612cc444b3eed788ebbe46263a0' => __DIR__ . '/..' . '/laminas/laminas-zendframework-bridge/src/autoload.php',
);
public static $prefixLengthsPsr4 = array (
'Z' =>
array (
'ZendXml\\' => 8,
),
'S' =>
array (
'ScssPhp\\ScssPhp\\' => 16,
),
'L' =>
array (
'Laminas\\ZendFrameworkBridge\\' => 28,
'Laminas\\Xml\\' => 12,
),
'G' =>
array (
'Grav\\Plugin\\Admin\\' => 18,
@@ -26,14 +31,18 @@ class ComposerStaticInitb286bbda7f18d999afbef65014afb574
);
public static $prefixDirsPsr4 = array (
'ZendXml\\' =>
array (
0 => __DIR__ . '/..' . '/zendframework/zendxml/src',
),
'ScssPhp\\ScssPhp\\' =>
array (
0 => __DIR__ . '/..' . '/scssphp/scssphp/src',
),
'Laminas\\ZendFrameworkBridge\\' =>
array (
0 => __DIR__ . '/..' . '/laminas/laminas-zendframework-bridge/src',
),
'Laminas\\Xml\\' =>
array (
0 => __DIR__ . '/..' . '/laminas/laminas-xml/src',
),
'Grav\\Plugin\\Admin\\' =>
array (
0 => __DIR__ . '/../..' . '/classes/plugin',

View File

@@ -63,18 +63,124 @@
]
},
{
"name": "p3k/picofeed",
"version": "v0.1.35",
"version_normalized": "0.1.35.0",
"name": "laminas/laminas-xml",
"version": "1.2.0",
"version_normalized": "1.2.0.0",
"source": {
"type": "git",
"url": "https://github.com/aaronpk/picofeed.git",
"reference": "b2a48acb026df91d2e21dfc8b4edbc1fc48f01f1"
"url": "https://github.com/laminas/laminas-xml.git",
"reference": "879cc66d1bba6a37705e98074f52a6960c220020"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aaronpk/picofeed/zipball/b2a48acb026df91d2e21dfc8b4edbc1fc48f01f1",
"reference": "b2a48acb026df91d2e21dfc8b4edbc1fc48f01f1",
"url": "https://api.github.com/repos/laminas/laminas-xml/zipball/879cc66d1bba6a37705e98074f52a6960c220020",
"reference": "879cc66d1bba6a37705e98074f52a6960c220020",
"shasum": ""
},
"require": {
"laminas/laminas-zendframework-bridge": "^1.0",
"php": "^5.6 || ^7.0"
},
"replace": {
"zendframework/zendxml": "self.version"
},
"require-dev": {
"laminas/laminas-coding-standard": "~1.0.0",
"phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.4"
},
"time": "2019-12-31T18:05:42+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev",
"dev-develop": "1.3.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Laminas\\Xml\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"description": "Utility library for XML usage, best practices, and security in PHP",
"homepage": "https://laminas.dev",
"keywords": [
"laminas",
"security",
"xml"
]
},
{
"name": "laminas/laminas-zendframework-bridge",
"version": "1.0.4",
"version_normalized": "1.0.4.0",
"source": {
"type": "git",
"url": "https://github.com/laminas/laminas-zendframework-bridge.git",
"reference": "fcd87520e4943d968557803919523772475e8ea3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laminas/laminas-zendframework-bridge/zipball/fcd87520e4943d968557803919523772475e8ea3",
"reference": "fcd87520e4943d968557803919523772475e8ea3",
"shasum": ""
},
"require": {
"php": "^5.6 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.1",
"squizlabs/php_codesniffer": "^3.5"
},
"time": "2020-05-20T16:45:56+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev",
"dev-develop": "1.1.x-dev"
},
"laminas": {
"module": "Laminas\\ZendFrameworkBridge"
}
},
"installation-source": "dist",
"autoload": {
"files": [
"src/autoload.php"
],
"psr-4": {
"Laminas\\ZendFrameworkBridge\\": "src//"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"description": "Alias legacy ZF class names to Laminas Project equivalents.",
"keywords": [
"ZendFramework",
"autoloading",
"laminas",
"zf"
]
},
{
"name": "p3k/picofeed",
"version": "v0.1.40",
"version_normalized": "0.1.40.0",
"source": {
"type": "git",
"url": "https://github.com/aaronpk/picofeed.git",
"reference": "356fd66d48779193b10ac28532cb4a4e11bb801c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aaronpk/picofeed/zipball/356fd66d48779193b10ac28532cb4a4e11bb801c",
"reference": "356fd66d48779193b10ac28532cb4a4e11bb801c",
"shasum": ""
},
"require": {
@@ -83,8 +189,11 @@
"ext-libxml": "*",
"ext-simplexml": "*",
"ext-xml": "*",
"php": ">=5.3.0",
"zendframework/zendxml": "^1.0"
"laminas/laminas-xml": "^1.2",
"php": ">=5.3.0"
},
"replace": {
"miniflux/picofeed": "0.1.35"
},
"require-dev": {
"phpdocumentor/reflection-docblock": "2.0.4",
@@ -94,7 +203,7 @@
"suggest": {
"ext-curl": "PicoFeed will use cURL if present"
},
"time": "2019-01-17T17:26:41+00:00",
"time": "2020-04-25T17:48:36+00:00",
"bin": [
"picofeed"
],
@@ -119,17 +228,17 @@
},
{
"name": "scssphp/scssphp",
"version": "1.0.9",
"version_normalized": "1.0.9.0",
"version": "1.1.1",
"version_normalized": "1.1.1.0",
"source": {
"type": "git",
"url": "https://github.com/scssphp/scssphp.git",
"reference": "c6626eebae7b123321d5ea803998487d835c260d"
"reference": "824e4cec10b2bfa88eec5dac23991cb9106622c1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/scssphp/scssphp/zipball/c6626eebae7b123321d5ea803998487d835c260d",
"reference": "c6626eebae7b123321d5ea803998487d835c260d",
"url": "https://api.github.com/repos/scssphp/scssphp/zipball/824e4cec10b2bfa88eec5dac23991cb9106622c1",
"reference": "824e4cec10b2bfa88eec5dac23991cb9106622c1",
"shasum": ""
},
"require": {
@@ -139,11 +248,11 @@
},
"require-dev": {
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.3",
"squizlabs/php_codesniffer": "~2.5",
"squizlabs/php_codesniffer": "~3.5",
"twbs/bootstrap": "~4.3",
"zurb/foundation": "~6.5"
},
"time": "2020-04-01T15:23:18+00:00",
"time": "2020-06-04T17:30:40+00:00",
"bin": [
"bin/pscss"
],
@@ -179,54 +288,5 @@
"scss",
"stylesheet"
]
},
{
"name": "zendframework/zendxml",
"version": "1.2.0",
"version_normalized": "1.2.0.0",
"source": {
"type": "git",
"url": "https://github.com/zendframework/ZendXml.git",
"reference": "eceab37a591c9e140772a1470338258857339e00"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/ZendXml/zipball/eceab37a591c9e140772a1470338258857339e00",
"reference": "eceab37a591c9e140772a1470338258857339e00",
"shasum": ""
},
"require": {
"php": "^5.6 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.4",
"zendframework/zend-coding-standard": "~1.0.0"
},
"time": "2019-01-22T19:42:14+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev",
"dev-develop": "1.3.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"ZendXml\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"description": "Utility library for XML usage, best practices, and security in PHP",
"keywords": [
"ZendFramework",
"security",
"xml",
"zf"
],
"abandoned": "laminas/laminas-xml"
}
]

View File

@@ -6,7 +6,7 @@ All notable changes to this project will be documented in this file, in reverse
### Added
- [#6](https://github.com/zendframework/zendxml/pull/6) adds the following method:
- [zendframework/zendxml#6](https://github.com/zendframework/zendxml/pull/6) adds the following method:
```php
Security::scanHtml(
@@ -39,7 +39,7 @@ All notable changes to this project will be documented in this file, in reverse
### Added
- [#16](https://github.com/zendframework/ZendXml/pull/16) adds support for PHP 7.3.
- [zendframework/zendxml#16](https://github.com/zendframework/ZendXml/pull/16) adds support for PHP 7.3.
### Changed
@@ -55,14 +55,14 @@ All notable changes to this project will be documented in this file, in reverse
### Fixed
- [#17](https://github.com/zendframework/ZendXml/pull/17) properly enables heuristic security checks for PHP 5.6.0 - 5.6.5 when PHP
- [zendframework/zendxml#17](https://github.com/zendframework/ZendXml/pull/17) properly enables heuristic security checks for PHP 5.6.0 - 5.6.5 when PHP
is running as PHP-FPM.
## 1.1.0 - 2018-04-30
### Added
- [#13](https://github.com/zendframework/ZendXml/pull/13) adds support for PHP 7.1 and 7.2.
- [zendframework/zendxml#13](https://github.com/zendframework/ZendXml/pull/13) adds support for PHP 7.1 and 7.2.
### Changed
@@ -74,9 +74,9 @@ All notable changes to this project will be documented in this file, in reverse
### Removed
- [#13](https://github.com/zendframework/ZendXml/pull/13) removes support for PHP 5.3, 5.4, and 5.5.
- [zendframework/zendxml#13](https://github.com/zendframework/ZendXml/pull/13) removes support for PHP 5.3, 5.4, and 5.5.
- [#13](https://github.com/zendframework/ZendXml/pull/13) removes support for HHVM.
- [zendframework/zendxml#13](https://github.com/zendframework/ZendXml/pull/13) removes support for HHVM.
### Fixed
@@ -98,7 +98,7 @@ All notable changes to this project will be documented in this file, in reverse
### Fixed
- [#11](https://github.com/zendframework/ZendXml/pull/11) updates the
- [zendframework/zendxml#11](https://github.com/zendframework/ZendXml/pull/11) updates the
dependencies to PHP `^5.3.3 || ^7.0` and PHPUnit `^3.7 || ^4.0`, ensuring
better compatibility with other components, and with PHP 7. The test matrix
was also expanded to add PHP 7 as a required platform.

View File

@@ -0,0 +1,2 @@
Copyright (c) 2019, Laminas Foundation.
All rights reserved. (https://getlaminas.org/)

View File

@@ -1,19 +1,19 @@
Copyright (c) 2014-2018, Zend Technologies USA, Inc.
Copyright (c) 2019, Laminas Foundation
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Zend Technologies USA, Inc. nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
- Neither the name of Laminas Foundation nor the names of its contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED

View File

@@ -1,7 +1,7 @@
# ZendXml
# laminas-xml
[![Build Status](https://secure.travis-ci.org/zendframework/ZendXml.svg?branch=master)](https://secure.travis-ci.org/zendframework/ZendXml)
[![Coverage Status](https://coveralls.io/repos/github/zendframework/ZendXml/badge.svg?branch=master)](https://coveralls.io/github/zendframework/ZendXml?branch=master)
[![Build Status](https://travis-ci.org/laminas/laminas-xml.svg?branch=master)](https://travis-ci.org/laminas/laminas-xml)
[![Coverage Status](https://coveralls.io/repos/github/laminas/laminas-xml/badge.svg?branch=master)](https://coveralls.io/github/laminas/laminas-xml?branch=master)
An utility component for XML usage and best practices in PHP
@@ -17,7 +17,7 @@ php composer.phar install
Notice that this library doesn't have any external dependencies, the usage of composer is for autoloading and standard purpose.
## ZendXml\Security
## Laminas\Xml\Security
This is a security component to prevent [XML eXternal Entity](https://www.owasp.org/index.php/XML_External_Entity_%28XXE%29_Processing) (XXE) and [XML Entity Expansion](http://projects.webappsec.org/w/page/13247002/XML%20Entity%20Expansion) (XEE) attacks on XML documents.
@@ -28,7 +28,7 @@ The XEE attack is prevented looking inside the XML document for ENTITY usage. If
We have two static methods to scan and load XML document from a string (scan) and from a file (scanFile). You can decide to get a SimpleXMLElement or DOMDocument as result, using the following use cases:
```php
use ZendXml\Security as XmlSecurity;
use Laminas\Xml\Security as XmlSecurity;
$xml = <<<XML
<?xml version="1.0"?>

View File

@@ -1,36 +1,20 @@
{
"name": "zendframework/zendxml",
"name": "laminas/laminas-xml",
"description": "Utility library for XML usage, best practices, and security in PHP",
"license": "BSD-3-Clause",
"keywords": [
"zf",
"zendframework",
"laminas",
"xml",
"security"
],
"homepage": "https://laminas.dev",
"support": {
"issues": "https://github.com/zendframework/ZendXml/issues",
"source": "https://github.com/zendframework/ZendXml",
"rss": "https://github.com/zendframework/ZendXml/releases.atom",
"chat": "https://zendframework-slack.herokuapp.com",
"forum": "https://discourse.zendframework.com/c/questions/components"
},
"require": {
"php": "^5.6 || ^7.0"
},
"require-dev": {
"zendframework/zend-coding-standard": "~1.0.0",
"phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.4"
},
"autoload": {
"psr-4": {
"ZendXml\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"ZendXmlTest\\": "test/"
}
"docs": "https://docs.laminas.dev/laminas-xml/",
"issues": "https://github.com/laminas/laminas-xml/issues",
"source": "https://github.com/laminas/laminas-xml",
"rss": "https://github.com/laminas/laminas-xml/releases.atom",
"chat": "https://laminas.dev/chat",
"forum": "https://discourse.laminas.dev"
},
"config": {
"sort-packages": true
@@ -41,6 +25,24 @@
"dev-develop": "1.3.x-dev"
}
},
"require": {
"php": "^5.6 || ^7.0",
"laminas/laminas-zendframework-bridge": "^1.0"
},
"require-dev": {
"laminas/laminas-coding-standard": "~1.0.0",
"phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.4"
},
"autoload": {
"psr-4": {
"Laminas\\Xml\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"LaminasTest\\Xml\\": "test/"
}
},
"scripts": {
"check": [
"@cs-check",
@@ -50,5 +52,8 @@
"cs-fix": "phpcbf",
"test": "phpunit --colors=always",
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml"
},
"replace": {
"zendframework/zendxml": "self.version"
}
}

View File

@@ -0,0 +1,13 @@
<?php
/**
* @see https://github.com/laminas/laminas-xml for the canonical source repository
* @copyright https://github.com/laminas/laminas-xml/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-xml/blob/master/LICENSE.md New BSD License
*/
namespace Laminas\Xml\Exception;
interface ExceptionInterface
{
}

View File

@@ -0,0 +1,16 @@
<?php
/**
* @see https://github.com/laminas/laminas-xml for the canonical source repository
* @copyright https://github.com/laminas/laminas-xml/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-xml/blob/master/LICENSE.md New BSD License
*/
namespace Laminas\Xml\Exception;
/**
* Invalid argument exception
*/
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
{
}

View File

@@ -0,0 +1,16 @@
<?php
/**
* @see https://github.com/laminas/laminas-xml for the canonical source repository
* @copyright https://github.com/laminas/laminas-xml/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-xml/blob/master/LICENSE.md New BSD License
*/
namespace Laminas\Xml\Exception;
/**
* Runtime exception
*/
class RuntimeException extends \RuntimeException implements ExceptionInterface
{
}

View File

@@ -1,11 +1,12 @@
<?php
/**
* @see https://github.com/zendframework/ZendXml for the canonical source repository
* @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://github.com/zendframework/ZendXml/blob/master/LICENSE.md New BSD License
* @see https://github.com/laminas/laminas-xml for the canonical source repository
* @copyright https://github.com/laminas/laminas-xml/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-xml/blob/master/LICENSE.md New BSD License
*/
namespace ZendXml;
namespace Laminas\Xml;
use DOMDocument;
use SimpleXMLElement;

View File

@@ -0,0 +1 @@
community_bridge: laminas-project

View File

@@ -0,0 +1,641 @@
# Changelog
All notable changes to this project will be documented in this file, in reverse chronological order by release.
## 1.0.4 - 2020-05-20
### Added
- Nothing.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#66](https://github.com/laminas/laminas-zendframework-bridge/pull/66) ensures that references to BjyAuthorize templates are not rewritten, so that they can be resolved during runtime.
## 1.0.3 - 2020-04-03
### Added
- Nothing.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#63](https://github.com/laminas/laminas-zendframework-bridge/pull/63) fixes handling of dependency configuration to ensure each of delegators, initializers, and abstract factories are properly handled during configuraiton post processing. The new approach should allow delegators to work post-migration to Laminas or Mezzio.
- [#61](https://github.com/laminas/laminas-zendframework-bridge/pull/61) ensures configuration for delegator factories gets rewritten; the functionality broke in version 1.0.1.
## 1.0.2 - 2020-03-26
### Added
- Nothing.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#55](https://github.com/laminas/laminas-zendframework-bridge/pull/55) adds provisions to ensure that references to legacy classes/interfaces in dependency configuration always create aliases from the legacy to the new classes. Previously, we did straight replacements in the configuration, which could lead to the legacy service no longer being available. Now it will remain available.
- [#59](https://github.com/laminas/laminas-zendframework-bridge/pull/59) fixes the replacement rules such as to avoid replacing references to API Skeletons packages, classes, or configuration keys.
- [#57](https://github.com/laminas/laminas-zendframework-bridge/pull/57) fixes how references to the "zf-apigility" key are replaced. Previously, they were rewritten to "laminas-api-tools", but the correct replacement is "api-tools".
- [#56](https://github.com/laminas/laminas-zendframework-bridge/pull/56) provides a mechanism to add additional maps with multiple levels of namespace separator escaping, in order to ensure that all various known permutations are matched. The escaping is applied to both the original and target, to ensure that rewrites conform to the original escaping.
- [#56](https://github.com/laminas/laminas-zendframework-bridge/pull/56) makes changes to the replacement rules to ensure we do not replace references to "Zend" or "ZF" if they occur as subnamespaces OR as class names (formerly, we only enforced subnamespaces). Additional rules were provided for cases where one or both occur within our own packages.
- [#52](https://github.com/laminas/laminas-zendframework-bridge/pull/52) fixes a scenario whereby factory _values_ were not being rewritten during configuration post processing.
- [#52](https://github.com/laminas/laminas-zendframework-bridge/pull/52) fixes an issue that occurs with the configuration post processor. Previously, when a service name used as a factory or invokable was encountered that referenced a legacy class, it would get rewritten. This would cause issues if the service was not exposed in the original legacy package, however, as there would now be no alias of the legacy service to the new one. This patch modifies the configuration post processor such that it now tests to see if a service name it will rename exists as an alias; if not, it also creates the alias.
## 1.0.1 - 2020-01-07
### Added
- Nothing.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#47](https://github.com/laminas/laminas-zendframework-bridge/pull/47) adds entries for rewriting the various `::*Zend()` methods exposed in the psr7bridge to `::*Laminas()` during migrations.
- [#46](https://github.com/laminas/laminas-zendframework-bridge/pull/46) adds a rule to rewrite the config key `use_zend_loader` to `use_laminas_loader`.
- [#45](https://github.com/laminas/laminas-zendframework-bridge/pull/45) adds a rule to exclude rewriting of view paths provided by the various Doctrine modules targeting the developer tools.
## 1.0.0 - 2019-12-31
### Added
- First stable release.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- Nothing.
## 0.4.5 - 2019-12-23
### Added
- Nothing.
### Changed
- [#42](https://github.com/laminas/laminas-zendframework-bridge/pull/42) modifies the replacement rules to no longer rewrite zf-deploy; the package will not be coming to the new organizations.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- Nothing.
## 0.4.4 - 2019-12-18
### Added
- Nothing.
### Changed
- [#40](https://github.com/laminas/laminas-zendframework-bridge/pull/40) adds exclusion rules for subnamespaces that reference Zend, ZF, ZendService, or ZendOAuth to ensure they are not rewritten.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#40](https://github.com/laminas/laminas-zendframework-bridge/pull/40) adds exclusions for classes referencing Zend Server product features to ensure they are not rewritten (e.g., `ZendServerDisk`, `ZendServerShm`, `ZendMonitor`).
## 0.4.3 - 2019-12-17
### Added
- Nothing.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#39](https://github.com/laminas/laminas-zendframework-bridge/pull/39) fixes an issue when using the Auryn DI container. The class `Northwoods\Container\Zend\Config` was incorrectly being renamed to `Northwoods\Container\Laminas\Config` (which should not happen, as it is not a class under our control).
## 0.4.2 - 2019-12-16
### Added
- Nothing.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#36](https://github.com/laminas/laminas-zendframework-bridge/pull/36) adds some cases for classes that contain the verbiage "Expressive" and "Apigility" ot ensure they are rewritten correctly.
## 0.4.1 - 2019-12-10
### Added
- Nothing.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#35](https://github.com/laminas/laminas-zendframework-bridge/pull/35) removes zend-debug from the replacement list, as it is not being brought over to Laminas.
## 0.4.0 - 2019-11-27
### Added
- Nothing.
### Changed
- [#32](https://github.com/laminas/laminas-zendframework-bridge/pull/32) changes all references to Expressive to instead reference Mezzio.
- [#32](https://github.com/laminas/laminas-zendframework-bridge/pull/32) changes all references to Apigility to instead reference Laminas API Tools. The vendor becomes laminas-api-tools, the URL becomes api-tools.getlaminas.org, packages and repos are prefixed with api-tools, and namespaces become `Laminas\ApiTools`.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- Nothing.
## 0.3.8 - 2019-11-14
### Added
- [#29](https://github.com/laminas/laminas-zendframework-bridge/pull/29) adds entries to translate `ZendDeveloperTools` to `Laminas\DeveloperTools`, and vice-versa.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- Nothing.
## 0.3.7 - 2019-11-12
### Added
- Nothing.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#28](https://github.com/laminas/laminas-zendframework-bridge/pull/28) updates the `zenddevelopertools` string to rewrite to `laminas-developer-tools` instead of `laminasdevelopertools`.
## 0.3.6 - 2019-11-07
### Added
- Nothing.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#27](https://github.com/laminas/laminas-zendframework-bridge/pull/27) adds a rewrite rule for zend-framework.flf => laminas-project.flf.
## 0.3.5 - 2019-11-06
### Added
- Nothing.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#25](https://github.com/laminas/laminas-zendframework-bridge/pull/25) adds entries for ZendHttp and ZendModule, which are file name segments in files from the zend-feed and zend-config-aggregator-module packages, respectively.
## 0.3.4 - 2019-11-06
### Added
- Nothing.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#24](https://github.com/laminas/laminas-zendframework-bridge/pull/24) adds a rule to never rewrite the string `Doctrine\Zend`.
- [#23](https://github.com/laminas/laminas-zendframework-bridge/pull/23) adds a missing map for each of ZendAcl and ZendRbac, which occur in the zend-expressive-authorization-acl and zend-expressive-authorization-rbac packages, respectively.
## 0.3.3 - 2019-11-06
### Added
- [#22](https://github.com/laminas/laminas-zendframework-bridge/pull/22) adds configuration post-processing features, exposed both as a laminas-config-aggregator post processor (for use with Expressive applications) and as a laminas-modulemanager `EVENT_MERGE_CONFIG` listener (for use with MVC applications). When registered, it will post-process the configuration, replacing known Zend Framework-specific strings with their Laminas replacements. A ruleset is provided that ensures dependency configuration is rewritten in a safe manner, routing configuration is skipped, and certain top-level configuration keys are matched exactly (instead of potentially as substrings or word stems). A later release of laminas-migration will auto-register these tools in applications when possible.
### Changed
- [#22](https://github.com/laminas/laminas-zendframework-bridge/pull/22) removes support for PHP versions prior to PHP 5.6. We have decided to only support supported PHP versions, whether that support is via php.net or commercial. The lowest supported PHP version we have found is 5.6. Users wishing to migrate to Laminas must at least update to PHP 5.6 before doing so.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- Nothing.
## 0.3.2 - 2019-10-30
### Added
- Nothing.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- [#21](https://github.com/laminas/laminas-zendframework-bridge/pull/21) removes rewriting of the Amazon library, as it is not moving to Laminas.
- [#21](https://github.com/laminas/laminas-zendframework-bridge/pull/21) removes rewriting of the GCM and APNS libraries, as they are not moving to Laminas.
### Fixed
- [#21](https://github.com/laminas/laminas-zendframework-bridge/pull/21) fixes how the recaptcha and twitter library package and namespaces are rewritten.
## 0.3.1 - 2019-04-25
### Added
- [#20](https://github.com/laminas/laminas-zendframework-bridge/pull/20) provides an additional autoloader that is _prepended_ to the autoloader
stack. This new autoloader will create class aliases for interfaces, classes,
and traits referenced in type hints and class declarations, ensuring PHP is
able to resolve them correctly during class_alias operations.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- Nothing.
## 0.3.0 - 2019-04-12
### Added
- Nothing.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- [#16](https://github.com/laminas/laminas-zendframework-bridge/pull/16) removes the `RewriteRules::classRewrite()` method, as it is no longer
needed due to internal refactoring.
### Fixed
- [#16](https://github.com/laminas/laminas-zendframework-bridge/pull/16) fixes how the rewrite rules detect the word `Zend` in subnamespaces and
class names to be both more robust and simpler.
## 0.2.5 - 2019-04-11
### Added
- [#12](https://github.com/laminas/laminas-zendframework-bridge/pull/12) adds functionality for ensuring we alias namespaces and classes that
include the word `Zend` in them; e.g., `Zend\Expressive\ZendView\ZendViewRendererFactory`
will now alias to `Expressive\LaminasView\LaminasViewRendererFactory`.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- Nothing.
## 0.2.4 - 2019-04-11
### Added
- [#11](https://github.com/laminas/laminas-zendframework-bridge/pull/11) adds maps for the Expressive router adapter packages.
- [#10](https://github.com/laminas/laminas-zendframework-bridge/pull/10) adds a map for the Psr7Bridge package, as it used `Zend` within a subnamespace.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- Nothing.
## 0.2.3 - 2019-04-10
### Added
- Nothing.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#9](https://github.com/laminas/laminas-zendframework-bridge/pull/9) fixes the mapping for the Problem Details package.
## 0.2.2 - 2019-04-10
### Added
- Nothing.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- Added a check that the discovered alias exists as a class, interface, or trait
before attempting to call `class_alias()`.
## 0.2.1 - 2019-04-10
### Added
- Nothing.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#8](https://github.com/laminas/laminas-zendframework-bridge/pull/8) fixes mappings for each of zend-expressive-authentication-zendauthentication,
zend-expressive-zendrouter, and zend-expressive-zendviewrenderer.
## 0.2.0 - 2019-04-01
### Added
- Nothing.
### Changed
- [#4](https://github.com/laminas/laminas-zendframework-bridge/pull/4) rewrites the autoloader to be class-based, via the class
`Laminas\ZendFrameworkBridge\Autoloader`. Additionally, the new approach
provides a performance boost by using a balanced tree algorithm, ensuring
matches occur faster.
### Deprecated
- Nothing.
### Removed
- [#4](https://github.com/laminas/laminas-zendframework-bridge/pull/4) removes function aliasing. Function aliasing will move to the packages that
provide functions.
### Fixed
- Nothing.
## 0.1.0 - 2019-03-27
### Added
- Adds an autoloader file that registers with `spl_autoload_register` a routine
for aliasing legacy ZF class/interface/trait names to Laminas Project
equivalents.
- Adds autoloader files for aliasing legacy ZF package functions to Laminas
Project equivalents.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- Nothing.

View File

@@ -0,0 +1 @@
Copyright (c) 2020 Laminas Project a Series of LF Projects, LLC. (https://getlaminas.org/)

View File

@@ -0,0 +1,26 @@
Copyright (c) 2020 Laminas Project a Series of LF Projects, LLC.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Laminas Foundation nor the names of its contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -0,0 +1,24 @@
# laminas-zendframework-bridge
[![Build Status](https://travis-ci.com/laminas/laminas-zendframework-bridge.svg?branch=master)](https://travis-ci.com/laminas/laminas-zendframework-bridge)
[![Coverage Status](https://coveralls.io/repos/github/laminas/laminas-zendframework-bridge/badge.svg?branch=master)](https://coveralls.io/github/laminas/laminas-zendframework-bridge?branch=master)
This library provides a custom autoloader that aliases legacy Zend Framework,
Apigility, and Expressive classes to their replacements under the Laminas
Project.
This package should be installed only if you are also using the composer plugin
that installs Laminas packages to replace ZF/Apigility/Expressive packages.
## Installation
Run the following to install this library:
```bash
$ composer require laminas/laminas-zendframework-bridge
```
## Support
* [Issues](https://github.com/laminas/laminas-zendframework-bridge/issues/)
* [Forum](https://discourse.laminas.dev/)

View File

@@ -0,0 +1,62 @@
{
"name": "laminas/laminas-zendframework-bridge",
"description": "Alias legacy ZF class names to Laminas Project equivalents.",
"license": "BSD-3-Clause",
"keywords": [
"autoloading",
"laminas",
"zf",
"zendframework"
],
"support": {
"issues": "https://github.com/laminas/laminas-zendframework-bridge/issues",
"source": "https://github.com/laminas/laminas-zendframework-bridge",
"rss": "https://github.com/laminas/laminas-zendframework-bridge/releases.atom",
"forum": "https://discourse.laminas.dev/"
},
"require": {
"php": "^5.6 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.1",
"squizlabs/php_codesniffer": "^3.5"
},
"autoload": {
"files": [
"src/autoload.php"
],
"psr-4": {
"Laminas\\ZendFrameworkBridge\\": "src//"
}
},
"autoload-dev": {
"files": [
"test/classes.php"
],
"psr-4": {
"LaminasTest\\ZendFrameworkBridge\\": "test/",
"LaminasTest\\ZendFrameworkBridge\\TestAsset\\": "test/TestAsset/classes/",
"Laminas\\ApiTools\\": "test/TestAsset/LaminasApiTools/",
"Mezzio\\": "test/TestAsset/Mezzio/",
"Laminas\\": "test/TestAsset/Laminas/"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev",
"dev-develop": "1.1.x-dev"
},
"laminas": {
"module": "Laminas\\ZendFrameworkBridge"
}
},
"config": {
"sort-packages": true
},
"scripts": {
"cs-check": "phpcs",
"cs-fix": "phpcbf",
"test": "phpunit --colors=always",
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml"
}
}

View File

@@ -0,0 +1,372 @@
<?php
return [
// NEVER REWRITE
'zendframework/zendframework' => 'zendframework/zendframework',
'zend-developer-tools/toolbar/bjy' => 'zend-developer-tools/toolbar/bjy',
'zend-developer-tools/toolbar/doctrine' => 'zend-developer-tools/toolbar/doctrine',
// NAMESPACES
// Zend Framework components
'Zend\\AuraDi\\Config' => 'Laminas\\AuraDi\\Config',
'Zend\\Authentication' => 'Laminas\\Authentication',
'Zend\\Barcode' => 'Laminas\\Barcode',
'Zend\\Cache' => 'Laminas\\Cache',
'Zend\\Captcha' => 'Laminas\\Captcha',
'Zend\\Code' => 'Laminas\\Code',
'ZendCodingStandard\\Sniffs' => 'LaminasCodingStandard\\Sniffs',
'ZendCodingStandard\\Utils' => 'LaminasCodingStandard\\Utils',
'Zend\\ComponentInstaller' => 'Laminas\\ComponentInstaller',
'Zend\\Config' => 'Laminas\\Config',
'Zend\\ConfigAggregator' => 'Laminas\\ConfigAggregator',
'Zend\\ConfigAggregatorModuleManager' => 'Laminas\\ConfigAggregatorModuleManager',
'Zend\\ConfigAggregatorParameters' => 'Laminas\\ConfigAggregatorParameters',
'Zend\\Console' => 'Laminas\\Console',
'Zend\\ContainerConfigTest' => 'Laminas\\ContainerConfigTest',
'Zend\\Crypt' => 'Laminas\\Crypt',
'Zend\\Db' => 'Laminas\\Db',
'ZendDeveloperTools' => 'Laminas\\DeveloperTools',
'Zend\\Di' => 'Laminas\\Di',
'Zend\\Diactoros' => 'Laminas\\Diactoros',
'ZendDiagnostics\\Check' => 'Laminas\\Diagnostics\\Check',
'ZendDiagnostics\\Result' => 'Laminas\\Diagnostics\\Result',
'ZendDiagnostics\\Runner' => 'Laminas\\Diagnostics\\Runner',
'Zend\\Dom' => 'Laminas\\Dom',
'Zend\\Escaper' => 'Laminas\\Escaper',
'Zend\\EventManager' => 'Laminas\\EventManager',
'Zend\\Feed' => 'Laminas\\Feed',
'Zend\\File' => 'Laminas\\File',
'Zend\\Filter' => 'Laminas\\Filter',
'Zend\\Form' => 'Laminas\\Form',
'Zend\\Http' => 'Laminas\\Http',
'Zend\\HttpHandlerRunner' => 'Laminas\\HttpHandlerRunner',
'Zend\\Hydrator' => 'Laminas\\Hydrator',
'Zend\\I18n' => 'Laminas\\I18n',
'Zend\\InputFilter' => 'Laminas\\InputFilter',
'Zend\\Json' => 'Laminas\\Json',
'Zend\\Ldap' => 'Laminas\\Ldap',
'Zend\\Loader' => 'Laminas\\Loader',
'Zend\\Log' => 'Laminas\\Log',
'Zend\\Mail' => 'Laminas\\Mail',
'Zend\\Math' => 'Laminas\\Math',
'Zend\\Memory' => 'Laminas\\Memory',
'Zend\\Mime' => 'Laminas\\Mime',
'Zend\\ModuleManager' => 'Laminas\\ModuleManager',
'Zend\\Mvc' => 'Laminas\\Mvc',
'Zend\\Navigation' => 'Laminas\\Navigation',
'Zend\\Paginator' => 'Laminas\\Paginator',
'Zend\\Permissions' => 'Laminas\\Permissions',
'Zend\\Pimple\\Config' => 'Laminas\\Pimple\\Config',
'Zend\\ProblemDetails' => 'Mezzio\\ProblemDetails',
'Zend\\ProgressBar' => 'Laminas\\ProgressBar',
'Zend\\Psr7Bridge' => 'Laminas\\Psr7Bridge',
'Zend\\Router' => 'Laminas\\Router',
'Zend\\Serializer' => 'Laminas\\Serializer',
'Zend\\Server' => 'Laminas\\Server',
'Zend\\ServiceManager' => 'Laminas\\ServiceManager',
'ZendService\\ReCaptcha' => 'Laminas\\ReCaptcha',
'ZendService\\Twitter' => 'Laminas\\Twitter',
'Zend\\Session' => 'Laminas\\Session',
'Zend\\SkeletonInstaller' => 'Laminas\\SkeletonInstaller',
'Zend\\Soap' => 'Laminas\\Soap',
'Zend\\Stdlib' => 'Laminas\\Stdlib',
'Zend\\Stratigility' => 'Laminas\\Stratigility',
'Zend\\Tag' => 'Laminas\\Tag',
'Zend\\Test' => 'Laminas\\Test',
'Zend\\Text' => 'Laminas\\Text',
'Zend\\Uri' => 'Laminas\\Uri',
'Zend\\Validator' => 'Laminas\\Validator',
'Zend\\View' => 'Laminas\\View',
'ZendXml' => 'Laminas\\Xml',
'Zend\\Xml2Json' => 'Laminas\\Xml2Json',
'Zend\\XmlRpc' => 'Laminas\\XmlRpc',
'ZendOAuth' => 'Laminas\\OAuth',
// class ZendAcl in zend-expressive-authorization-acl
'ZendAcl' => 'LaminasAcl',
'Zend\\Expressive\\Authorization\\Acl\\ZendAcl' => 'Mezzio\\Authorization\\Acl\\LaminasAcl',
// class ZendHttpClientDecorator in zend-feed
'ZendHttp' => 'LaminasHttp',
// class ZendModuleProvider in zend-config-aggregator-modulemanager
'ZendModule' => 'LaminasModule',
// class ZendRbac in zend-expressive-authorization-rbac
'ZendRbac' => 'LaminasRbac',
'Zend\\Expressive\\Authorization\\Rbac\\ZendRbac' => 'Mezzio\\Authorization\\Rbac\\LaminasRbac',
// class ZendRouter in zend-expressive-router-zendrouter
'ZendRouter' => 'LaminasRouter',
'Zend\\Expressive\\Router\\ZendRouter' => 'Mezzio\\Router\\LaminasRouter',
// class ZendViewRenderer in zend-expressive-zendviewrenderer
'ZendViewRenderer' => 'LaminasViewRenderer',
'Zend\\Expressive\\ZendView\\ZendViewRenderer' => 'Mezzio\\LaminasView\\LaminasViewRenderer',
'a\\Zend' => 'a\\Zend',
'b\\Zend' => 'b\\Zend',
'c\\Zend' => 'c\\Zend',
'd\\Zend' => 'd\\Zend',
'e\\Zend' => 'e\\Zend',
'f\\Zend' => 'f\\Zend',
'g\\Zend' => 'g\\Zend',
'h\\Zend' => 'h\\Zend',
'i\\Zend' => 'i\\Zend',
'j\\Zend' => 'j\\Zend',
'k\\Zend' => 'k\\Zend',
'l\\Zend' => 'l\\Zend',
'm\\Zend' => 'm\\Zend',
'n\\Zend' => 'n\\Zend',
'o\\Zend' => 'o\\Zend',
'p\\Zend' => 'p\\Zend',
'q\\Zend' => 'q\\Zend',
'r\\Zend' => 'r\\Zend',
's\\Zend' => 's\\Zend',
't\\Zend' => 't\\Zend',
'u\\Zend' => 'u\\Zend',
'v\\Zend' => 'v\\Zend',
'w\\Zend' => 'w\\Zend',
'x\\Zend' => 'x\\Zend',
'y\\Zend' => 'y\\Zend',
'z\\Zend' => 'z\\Zend',
// Expressive
'Zend\\Expressive' => 'Mezzio',
'ZendAuthentication' => 'LaminasAuthentication',
'ZendAcl' => 'LaminasAcl',
'ZendRbac' => 'LaminasRbac',
'ZendRouter' => 'LaminasRouter',
'ExpressiveUrlGenerator' => 'MezzioUrlGenerator',
'ExpressiveInstaller' => 'MezzioInstaller',
// Apigility
'ZF\\Apigility' => 'Laminas\\ApiTools',
'ZF\\ApiProblem' => 'Laminas\\ApiTools\\ApiProblem',
'ZF\\AssetManager' => 'Laminas\\ApiTools\\AssetManager',
'ZF\\ComposerAutoloading' => 'Laminas\\ComposerAutoloading',
'ZF\\Configuration' => 'Laminas\\ApiTools\\Configuration',
'ZF\\ContentNegotiation' => 'Laminas\\ApiTools\\ContentNegotiation',
'ZF\\ContentValidation' => 'Laminas\\ApiTools\\ContentValidation',
'ZF\\DevelopmentMode' => 'Laminas\\DevelopmentMode',
'ZF\\Doctrine\\QueryBuilder' => 'Laminas\\ApiTools\\Doctrine\\QueryBuilder',
'ZF\\Hal' => 'Laminas\\ApiTools\\Hal',
'ZF\\HttpCache' => 'Laminas\\ApiTools\\HttpCache',
'ZF\\MvcAuth' => 'Laminas\\ApiTools\\MvcAuth',
'ZF\\OAuth2' => 'Laminas\\ApiTools\\OAuth2',
'ZF\\Rest' => 'Laminas\\ApiTools\\Rest',
'ZF\\Rpc' => 'Laminas\\ApiTools\\Rpc',
'ZF\\Versioning' => 'Laminas\\ApiTools\\Versioning',
'a\\ZF' => 'a\\ZF',
'b\\ZF' => 'b\\ZF',
'c\\ZF' => 'c\\ZF',
'd\\ZF' => 'd\\ZF',
'e\\ZF' => 'e\\ZF',
'f\\ZF' => 'f\\ZF',
'g\\ZF' => 'g\\ZF',
'h\\ZF' => 'h\\ZF',
'i\\ZF' => 'i\\ZF',
'j\\ZF' => 'j\\ZF',
'k\\ZF' => 'k\\ZF',
'l\\ZF' => 'l\\ZF',
'm\\ZF' => 'm\\ZF',
'n\\ZF' => 'n\\ZF',
'o\\ZF' => 'o\\ZF',
'p\\ZF' => 'p\\ZF',
'q\\ZF' => 'q\\ZF',
'r\\ZF' => 'r\\ZF',
's\\ZF' => 's\\ZF',
't\\ZF' => 't\\ZF',
'u\\ZF' => 'u\\ZF',
'v\\ZF' => 'v\\ZF',
'w\\ZF' => 'w\\ZF',
'x\\ZF' => 'x\\ZF',
'y\\ZF' => 'y\\ZF',
'z\\ZF' => 'z\\ZF',
'ApigilityModuleInterface' => 'ApiToolsModuleInterface',
'ApigilityProviderInterface' => 'ApiToolsProviderInterface',
'ApigilityVersionController' => 'ApiToolsVersionController',
// PACKAGES
// ZF components, MVC
'zendframework/skeleton-application' => 'laminas/skeleton-application',
'zendframework/zend-auradi-config' => 'laminas/laminas-auradi-config',
'zendframework/zend-authentication' => 'laminas/laminas-authentication',
'zendframework/zend-barcode' => 'laminas/laminas-barcode',
'zendframework/zend-cache' => 'laminas/laminas-cache',
'zendframework/zend-captcha' => 'laminas/laminas-captcha',
'zendframework/zend-code' => 'laminas/laminas-code',
'zendframework/zend-coding-standard' => 'laminas/laminas-coding-standard',
'zendframework/zend-component-installer' => 'laminas/laminas-component-installer',
'zendframework/zend-composer-autoloading' => 'laminas/laminas-composer-autoloading',
'zendframework/zend-config-aggregator' => 'laminas/laminas-config-aggregator',
'zendframework/zend-config' => 'laminas/laminas-config',
'zendframework/zend-console' => 'laminas/laminas-console',
'zendframework/zend-container-config-test' => 'laminas/laminas-container-config-test',
'zendframework/zend-crypt' => 'laminas/laminas-crypt',
'zendframework/zend-db' => 'laminas/laminas-db',
'zendframework/zend-developer-tools' => 'laminas/laminas-developer-tools',
'zendframework/zend-diactoros' => 'laminas/laminas-diactoros',
'zendframework/zenddiagnostics' => 'laminas/laminas-diagnostics',
'zendframework/zend-di' => 'laminas/laminas-di',
'zendframework/zend-dom' => 'laminas/laminas-dom',
'zendframework/zend-escaper' => 'laminas/laminas-escaper',
'zendframework/zend-eventmanager' => 'laminas/laminas-eventmanager',
'zendframework/zend-feed' => 'laminas/laminas-feed',
'zendframework/zend-file' => 'laminas/laminas-file',
'zendframework/zend-filter' => 'laminas/laminas-filter',
'zendframework/zend-form' => 'laminas/laminas-form',
'zendframework/zend-httphandlerrunner' => 'laminas/laminas-httphandlerrunner',
'zendframework/zend-http' => 'laminas/laminas-http',
'zendframework/zend-hydrator' => 'laminas/laminas-hydrator',
'zendframework/zend-i18n' => 'laminas/laminas-i18n',
'zendframework/zend-i18n-resources' => 'laminas/laminas-i18n-resources',
'zendframework/zend-inputfilter' => 'laminas/laminas-inputfilter',
'zendframework/zend-json' => 'laminas/laminas-json',
'zendframework/zend-json-server' => 'laminas/laminas-json-server',
'zendframework/zend-ldap' => 'laminas/laminas-ldap',
'zendframework/zend-loader' => 'laminas/laminas-loader',
'zendframework/zend-log' => 'laminas/laminas-log',
'zendframework/zend-mail' => 'laminas/laminas-mail',
'zendframework/zend-math' => 'laminas/laminas-math',
'zendframework/zend-memory' => 'laminas/laminas-memory',
'zendframework/zend-mime' => 'laminas/laminas-mime',
'zendframework/zend-modulemanager' => 'laminas/laminas-modulemanager',
'zendframework/zend-mvc' => 'laminas/laminas-mvc',
'zendframework/zend-navigation' => 'laminas/laminas-navigation',
'zendframework/zend-oauth' => 'laminas/laminas-oauth',
'zendframework/zend-paginator' => 'laminas/laminas-paginator',
'zendframework/zend-permissions-acl' => 'laminas/laminas-permissions-acl',
'zendframework/zend-permissions-rbac' => 'laminas/laminas-permissions-rbac',
'zendframework/zend-pimple-config' => 'laminas/laminas-pimple-config',
'zendframework/zend-progressbar' => 'laminas/laminas-progressbar',
'zendframework/zend-psr7bridge' => 'laminas/laminas-psr7bridge',
'zendframework/zend-recaptcha' => 'laminas/laminas-recaptcha',
'zendframework/zend-router' => 'laminas/laminas-router',
'zendframework/zend-serializer' => 'laminas/laminas-serializer',
'zendframework/zend-server' => 'laminas/laminas-server',
'zendframework/zend-servicemanager' => 'laminas/laminas-servicemanager',
'zendframework/zendservice-recaptcha' => 'laminas/laminas-recaptcha',
'zendframework/zendservice-twitter' => 'laminas/laminas-twitter',
'zendframework/zend-session' => 'laminas/laminas-session',
'zendframework/zend-skeleton-installer' => 'laminas/laminas-skeleton-installer',
'zendframework/zend-soap' => 'laminas/laminas-soap',
'zendframework/zend-stdlib' => 'laminas/laminas-stdlib',
'zendframework/zend-stratigility' => 'laminas/laminas-stratigility',
'zendframework/zend-tag' => 'laminas/laminas-tag',
'zendframework/zend-test' => 'laminas/laminas-test',
'zendframework/zend-text' => 'laminas/laminas-text',
'zendframework/zend-uri' => 'laminas/laminas-uri',
'zendframework/zend-validator' => 'laminas/laminas-validator',
'zendframework/zend-view' => 'laminas/laminas-view',
'zendframework/zend-xml2json' => 'laminas/laminas-xml2json',
'zendframework/zend-xml' => 'laminas/laminas-xml',
'zendframework/zend-xmlrpc' => 'laminas/laminas-xmlrpc',
// Expressive packages
'zendframework/zend-expressive' => 'mezzio/mezzio',
'zendframework/zend-expressive-zendrouter' => 'mezzio/mezzio-laminasrouter',
'zendframework/zend-problem-details' => 'mezzio/mezzio-problem-details',
'zendframework/zend-expressive-zendviewrenderer' => 'mezzio/mezzio-laminasviewrenderer',
// Apigility packages
'zfcampus/apigility-documentation' => 'laminas-api-tools/documentation',
'zfcampus/statuslib-example' => 'laminas-api-tools/statuslib-example',
'zfcampus/zf-apigility' => 'laminas-api-tools/api-tools',
'zfcampus/zf-api-problem' => 'laminas-api-tools/api-tools-api-problem',
'zfcampus/zf-asset-manager' => 'laminas-api-tools/api-tools-asset-manager',
'zfcampus/zf-configuration' => 'laminas-api-tools/api-tools-configuration',
'zfcampus/zf-content-negotiation' => 'laminas-api-tools/api-tools-content-negotiation',
'zfcampus/zf-content-validation' => 'laminas-api-tools/api-tools-content-validation',
'zfcampus/zf-development-mode' => 'laminas/laminas-development-mode',
'zfcampus/zf-doctrine-querybuilder' => 'laminas-api-tools/api-tools-doctrine-querybuilder',
'zfcampus/zf-hal' => 'laminas-api-tools/api-tools-hal',
'zfcampus/zf-http-cache' => 'laminas-api-tools/api-tools-http-cache',
'zfcampus/zf-mvc-auth' => 'laminas-api-tools/api-tools-mvc-auth',
'zfcampus/zf-oauth2' => 'laminas-api-tools/api-tools-oauth2',
'zfcampus/zf-rest' => 'laminas-api-tools/api-tools-rest',
'zfcampus/zf-rpc' => 'laminas-api-tools/api-tools-rpc',
'zfcampus/zf-versioning' => 'laminas-api-tools/api-tools-versioning',
// CONFIG KEYS, SCRIPT NAMES, ETC
// ZF components
'::fromZend' => '::fromLaminas', // psr7bridge
'::toZend' => '::toLaminas', // psr7bridge
'use_zend_loader' => 'use_laminas_loader', // zend-modulemanager
'zend-config' => 'laminas-config',
'zend-developer-tools/' => 'laminas-developer-tools/',
'zend-tag-cloud' => 'laminas-tag-cloud',
'zenddevelopertools' => 'laminas-developer-tools',
'zendbarcode' => 'laminasbarcode',
'ZendBarcode' => 'LaminasBarcode',
'zendcache' => 'laminascache',
'ZendCache' => 'LaminasCache',
'zendconfig' => 'laminasconfig',
'ZendConfig' => 'LaminasConfig',
'zendfeed' => 'laminasfeed',
'ZendFeed' => 'LaminasFeed',
'zendfilter' => 'laminasfilter',
'ZendFilter' => 'LaminasFilter',
'zendform' => 'laminasform',
'ZendForm' => 'LaminasForm',
'zendi18n' => 'laminasi18n',
'ZendI18n' => 'LaminasI18n',
'zendinputfilter' => 'laminasinputfilter',
'ZendInputFilter' => 'LaminasInputFilter',
'zendlog' => 'laminaslog',
'ZendLog' => 'LaminasLog',
'zendmail' => 'laminasmail',
'ZendMail' => 'LaminasMail',
'zendmvc' => 'laminasmvc',
'ZendMvc' => 'LaminasMvc',
'zendpaginator' => 'laminaspaginator',
'ZendPaginator' => 'LaminasPaginator',
'zendserializer' => 'laminasserializer',
'ZendSerializer' => 'LaminasSerializer',
'zendtag' => 'laminastag',
'ZendTag' => 'LaminasTag',
'zendtext' => 'laminastext',
'ZendText' => 'LaminasText',
'zendvalidator' => 'laminasvalidator',
'ZendValidator' => 'LaminasValidator',
'zendview' => 'laminasview',
'ZendView' => 'LaminasView',
'zend-framework.flf' => 'laminas-project.flf',
// Expressive-related
"'zend-expressive'" => "'mezzio'",
'"zend-expressive"' => '"mezzio"',
'zend-expressive.' => 'mezzio.',
'zend-expressive-authorization' => 'mezzio-authorization',
'zend-expressive-hal' => 'mezzio-hal',
'zend-expressive-session' => 'mezzio-session',
'zend-expressive-swoole' => 'mezzio-swoole',
'zend-expressive-tooling' => 'mezzio-tooling',
// Apigility-related
"'zf-apigility'" => "'api-tools'",
'"zf-apigility"' => '"api-tools"',
'zf-apigility/' => 'api-tools/',
'zf-apigility-admin' => 'api-tools-admin',
'zf-content-negotiation' => 'api-tools-content-negotiation',
'zf-hal' => 'api-tools-hal',
'zf-rest' => 'api-tools-rest',
'zf-rpc' => 'api-tools-rpc',
'zf-content-validation' => 'api-tools-content-validation',
'zf-apigility-ui' => 'api-tools-ui',
'zf-apigility-documentation-blueprint' => 'api-tools-documentation-blueprint',
'zf-apigility-documentation-swagger' => 'api-tools-documentation-swagger',
'zf-apigility-welcome' => 'api-tools-welcome',
'zf-api-problem' => 'api-tools-api-problem',
'zf-configuration' => 'api-tools-configuration',
'zf-http-cache' => 'api-tools-http-cache',
'zf-mvc-auth' => 'api-tools-mvc-auth',
'zf-oauth2' => 'api-tools-oauth2',
'zf-versioning' => 'api-tools-versioning',
'ZfApigilityDoctrineQueryProviderManager' => 'LaminasApiToolsDoctrineQueryProviderManager',
'ZfApigilityDoctrineQueryCreateFilterManager' => 'LaminasApiToolsDoctrineQueryCreateFilterManager',
'zf-apigility-doctrine' => 'api-tools-doctrine',
'zf-development-mode' => 'laminas-development-mode',
'zf-doctrine-querybuilder' => 'api-tools-doctrine-querybuilder',
// 3rd party Apigility packages
'api-skeletons/zf-' => 'api-skeletons/zf-', // api-skeletons packages
'zf-oauth2-' => 'zf-oauth2-', // api-skeletons OAuth2-related packages
'ZF\\OAuth2\\Client' => 'ZF\\OAuth2\\Client', // api-skeletons/zf-oauth2-client
'ZF\\OAuth2\\Doctrine' => 'ZF\\OAuth2\\Doctrine', // api-skeletons/zf-oauth2-doctrine
];

View File

@@ -0,0 +1,168 @@
<?php
/**
* @see https://github.com/laminas/laminas-zendframework-bridge for the canonical source repository
* @copyright https://github.com/laminas/laminas-zendframework-bridge/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-zendframework-bridge/blob/master/LICENSE.md New BSD License
*/
namespace Laminas\ZendFrameworkBridge;
use ArrayObject;
use Composer\Autoload\ClassLoader;
use RuntimeException;
use function array_values;
use function class_alias;
use function class_exists;
use function explode;
use function file_exists;
use function interface_exists;
use function spl_autoload_register;
use function strlen;
use function strtr;
use function substr;
use function trait_exists;
/**
* Alias legacy Zend Framework project classes/interfaces/traits to Laminas equivalents.
*/
class Autoloader
{
/**
* Attach autoloaders for managing legacy ZF artifacts.
*
* We attach two autoloaders:
*
* - The first is _prepended_ to handle new classes and add aliases for
* legacy classes. PHP expects any interfaces implemented, classes
* extended, or traits used when declaring class_alias() to exist and/or
* be autoloadable already at the time of declaration. If not, it will
* raise a fatal error. This autoloader helps mitigate errors in such
* situations.
*
* - The second is _appended_ in order to create aliases for legacy
* classes.
*/
public static function load()
{
$loaded = new ArrayObject([]);
spl_autoload_register(self::createPrependAutoloader(
RewriteRules::namespaceReverse(),
self::getClassLoader(),
$loaded
), true, true);
spl_autoload_register(self::createAppendAutoloader(
RewriteRules::namespaceRewrite(),
$loaded
));
}
/**
* @return ClassLoader
* @throws RuntimeException
*/
private static function getClassLoader()
{
if (file_exists(__DIR__ . '/../../../autoload.php')) {
return include __DIR__ . '/../../../autoload.php';
}
if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
return include __DIR__ . '/../vendor/autoload.php';
}
throw new RuntimeException('Cannot detect composer autoload. Please run composer install');
}
/**
* @return callable
*/
private static function createPrependAutoloader(array $namespaces, ClassLoader $classLoader, ArrayObject $loaded)
{
/**
* @param string $class Class name to autoload
* @return void
*/
return static function ($class) use ($namespaces, $classLoader, $loaded) {
if (isset($loaded[$class])) {
return;
}
$segments = explode('\\', $class);
$i = 0;
$check = '';
while (isset($segments[$i + 1], $namespaces[$check . $segments[$i] . '\\'])) {
$check .= $segments[$i] . '\\';
++$i;
}
if ($check === '') {
return;
}
if ($classLoader->loadClass($class)) {
$legacy = $namespaces[$check]
. strtr(substr($class, strlen($check)), [
'ApiTools' => 'Apigility',
'Mezzio' => 'Expressive',
'Laminas' => 'Zend',
]);
class_alias($class, $legacy);
}
};
}
/**
* @return callable
*/
private static function createAppendAutoloader(array $namespaces, ArrayObject $loaded)
{
/**
* @param string $class Class name to autoload
* @return void
*/
return static function ($class) use ($namespaces, $loaded) {
$segments = explode('\\', $class);
if ($segments[0] === 'ZendService' && isset($segments[1])) {
$segments[0] .= '\\' . $segments[1];
unset($segments[1]);
$segments = array_values($segments);
}
$i = 0;
$check = '';
// We are checking segments of the namespace to match quicker
while (isset($segments[$i + 1], $namespaces[$check . $segments[$i] . '\\'])) {
$check .= $segments[$i] . '\\';
++$i;
}
if ($check === '') {
return;
}
$alias = $namespaces[$check]
. strtr(substr($class, strlen($check)), [
'Apigility' => 'ApiTools',
'Expressive' => 'Mezzio',
'Zend' => 'Laminas',
'AbstractZendServer' => 'AbstractZendServer',
'ZendServerDisk' => 'ZendServerDisk',
'ZendServerShm' => 'ZendServerShm',
'ZendMonitor' => 'ZendMonitor',
]);
$loaded[$alias] = true;
if (class_exists($alias) || interface_exists($alias) || trait_exists($alias)) {
class_alias($alias, $class);
}
};
}
}

View File

@@ -0,0 +1,434 @@
<?php
/**
* @see https://github.com/laminas/laminas-zendframework-bridge for the canonical source repository
* @copyright https://github.com/laminas/laminas-zendframework-bridge/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-zendframework-bridge/blob/master/LICENSE.md New BSD License
*/
namespace Laminas\ZendFrameworkBridge;
use function array_intersect_key;
use function array_key_exists;
use function array_pop;
use function array_push;
use function count;
use function in_array;
use function is_array;
use function is_callable;
use function is_int;
use function is_string;
class ConfigPostProcessor
{
/** @internal */
const SERVICE_MANAGER_KEYS_OF_INTEREST = [
'aliases' => true,
'factories' => true,
'invokables' => true,
'services' => true,
];
/** @var array String keys => string values */
private $exactReplacements = [
'zend-expressive' => 'mezzio',
'zf-apigility' => 'api-tools',
];
/** @var Replacements */
private $replacements;
/** @var callable[] */
private $rulesets;
public function __construct()
{
$this->replacements = new Replacements();
/* Define the rulesets for replacements.
*
* Each ruleset has the following signature:
*
* @param mixed $value
* @param string[] $keys Full nested key hierarchy leading to the value
* @return null|callable
*
* If no match is made, a null is returned, allowing it to fallback to
* the next ruleset in the list. If a match is made, a callback is returned,
* and that will be used to perform the replacement on the value.
*
* The callback should have the following signature:
*
* @param mixed $value
* @param string[] $keys
* @return mixed The transformed value
*/
$this->rulesets = [
// Exact values
function ($value) {
return is_string($value) && isset($this->exactReplacements[$value])
? [$this, 'replaceExactValue']
: null;
},
// Router (MVC applications)
// We do not want to rewrite these.
function ($value, array $keys) {
$key = array_pop($keys);
// Only worried about a top-level "router" key.
return $key === 'router' && count($keys) === 0 && is_array($value)
? [$this, 'noopReplacement']
: null;
},
// service- and pluginmanager handling
function ($value) {
return is_array($value) && array_intersect_key(self::SERVICE_MANAGER_KEYS_OF_INTEREST, $value) !== []
? [$this, 'replaceDependencyConfiguration']
: null;
},
// Array values
function ($value, array $keys) {
return 0 !== count($keys) && is_array($value)
? [$this, '__invoke']
: null;
},
];
}
/**
* @param string[] $keys Hierarchy of keys, for determining location in
* nested configuration.
* @return array
*/
public function __invoke(array $config, array $keys = [])
{
$rewritten = [];
foreach ($config as $key => $value) {
// Determine new key from replacements
$newKey = is_string($key) ? $this->replace($key, $keys) : $key;
// Keep original values with original key, if the key has changed, but only at the top-level.
if (empty($keys) && $newKey !== $key) {
$rewritten[$key] = $value;
}
// Perform value replacements, if any
$newValue = $this->replace($value, $keys, $newKey);
// Key does not already exist and/or is not an array value
if (! array_key_exists($newKey, $rewritten) || ! is_array($rewritten[$newKey])) {
// Do not overwrite existing values with null values
$rewritten[$newKey] = array_key_exists($newKey, $rewritten) && null === $newValue
? $rewritten[$newKey]
: $newValue;
continue;
}
// New value is null; nothing to do.
if (null === $newValue) {
continue;
}
// Key already exists as an array value, but $value is not an array
if (! is_array($newValue)) {
$rewritten[$newKey][] = $newValue;
continue;
}
// Key already exists as an array value, and $value is also an array
$rewritten[$newKey] = static::merge($rewritten[$newKey], $newValue);
}
return $rewritten;
}
/**
* Perform substitutions as needed on an individual value.
*
* The $key is provided to allow fine-grained selection of rewrite rules.
*
* @param mixed $value
* @param string[] $keys Key hierarchy
* @param null|int|string $key
* @return mixed
*/
private function replace($value, array $keys, $key = null)
{
// Add new key to the list of keys.
// We do not need to remove it later, as we are working on a copy of the array.
array_push($keys, $key);
// Identify rewrite strategy and perform replacements
$rewriteRule = $this->replacementRuleMatch($value, $keys);
return $rewriteRule($value, $keys);
}
/**
* Merge two arrays together.
*
* If an integer key exists in both arrays, the value from the second array
* will be appended to the first array. If both values are arrays, they are
* merged together, else the value of the second array overwrites the one
* of the first array.
*
* Based on zend-stdlib Zend\Stdlib\ArrayUtils::merge
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
*
* @return array
*/
public static function merge(array $a, array $b)
{
foreach ($b as $key => $value) {
if (! isset($a[$key]) && ! array_key_exists($key, $a)) {
$a[$key] = $value;
continue;
}
if (null === $value && array_key_exists($key, $a)) {
// Leave as-is if value from $b is null
continue;
}
if (is_int($key)) {
$a[] = $value;
continue;
}
if (is_array($value) && is_array($a[$key])) {
$a[$key] = static::merge($a[$key], $value);
continue;
}
$a[$key] = $value;
}
return $a;
}
/**
* @param mixed $value
* @param null|int|string $key
* @return callable Callable to invoke with value
*/
private function replacementRuleMatch($value, $key = null)
{
foreach ($this->rulesets as $ruleset) {
$result = $ruleset($value, $key);
if (is_callable($result)) {
return $result;
}
}
return [$this, 'fallbackReplacement'];
}
/**
* Replace a value using the translation table, if the value is a string.
*
* @param mixed $value
* @return mixed
*/
private function fallbackReplacement($value)
{
return is_string($value)
? $this->replacements->replace($value)
: $value;
}
/**
* Replace a value matched exactly.
*
* @param mixed $value
* @return mixed
*/
private function replaceExactValue($value)
{
return $this->exactReplacements[$value];
}
private function replaceDependencyConfiguration(array $config)
{
$aliases = isset($config['aliases']) && is_array($config['aliases'])
? $this->replaceDependencyAliases($config['aliases'])
: [];
if ($aliases) {
$config['aliases'] = $aliases;
}
$config = $this->replaceDependencyInvokables($config);
$config = $this->replaceDependencyFactories($config);
$config = $this->replaceDependencyServices($config);
$keys = self::SERVICE_MANAGER_KEYS_OF_INTEREST;
foreach ($config as $key => $data) {
if (isset($keys[$key])) {
continue;
}
$config[$key] = is_array($data) ? $this->__invoke($data, [$key]) : $data;
}
return $config;
}
/**
* Rewrite dependency aliases array
*
* In this case, we want to keep the alias as-is, but rewrite the target.
*
* We need also provide an additional alias if the alias key is a legacy class.
*
* @return array
*/
private function replaceDependencyAliases(array $aliases)
{
foreach ($aliases as $alias => $target) {
if (! is_string($alias) || ! is_string($target)) {
continue;
}
$newTarget = $this->replacements->replace($target);
$newAlias = $this->replacements->replace($alias);
$notIn = [$newTarget];
$name = $newTarget;
while (isset($aliases[$name])) {
$notIn[] = $aliases[$name];
$name = $aliases[$name];
}
if ($newAlias === $alias && ! in_array($alias, $notIn, true)) {
$aliases[$alias] = $newTarget;
continue;
}
if (isset($aliases[$newAlias])) {
continue;
}
if (! in_array($newAlias, $notIn, true)) {
$aliases[$alias] = $newAlias;
$aliases[$newAlias] = $newTarget;
}
}
return $aliases;
}
/**
* Rewrite dependency invokables array
*
* In this case, we want to keep the alias as-is, but rewrite the target.
*
* We need also provide an additional alias if invokable is defined with
* an alias which is a legacy class.
*
* @return array
*/
private function replaceDependencyInvokables(array $config)
{
if (empty($config['invokables']) || ! is_array($config['invokables'])) {
return $config;
}
foreach ($config['invokables'] as $alias => $target) {
if (! is_string($alias)) {
continue;
}
$newTarget = $this->replacements->replace($target);
$newAlias = $this->replacements->replace($alias);
if ($alias === $target || isset($config['aliases'][$newAlias])) {
$config['invokables'][$alias] = $newTarget;
continue;
}
$config['invokables'][$newAlias] = $newTarget;
if ($newAlias === $alias) {
continue;
}
$config['aliases'][$alias] = $newAlias;
unset($config['invokables'][$alias]);
}
return $config;
}
/**
* @param mixed $value
* @return mixed Returns $value verbatim.
*/
private function noopReplacement($value)
{
return $value;
}
private function replaceDependencyFactories(array $config)
{
if (empty($config['factories']) || ! is_array($config['factories'])) {
return $config;
}
foreach ($config['factories'] as $service => $factory) {
if (! is_string($service)) {
continue;
}
$replacedService = $this->replacements->replace($service);
$factory = is_string($factory) ? $this->replacements->replace($factory) : $factory;
$config['factories'][$replacedService] = $factory;
if ($replacedService === $service) {
continue;
}
unset($config['factories'][$service]);
if (isset($config['aliases'][$service])) {
continue;
}
$config['aliases'][$service] = $replacedService;
}
return $config;
}
private function replaceDependencyServices(array $config)
{
if (empty($config['services']) || ! is_array($config['services'])) {
return $config;
}
foreach ($config['services'] as $service => $serviceInstance) {
if (! is_string($service)) {
continue;
}
$replacedService = $this->replacements->replace($service);
$serviceInstance = is_array($serviceInstance) ? $this->__invoke($serviceInstance) : $serviceInstance;
$config['services'][$replacedService] = $serviceInstance;
if ($service === $replacedService) {
continue;
}
unset($config['services'][$service]);
if (isset($config['aliases'][$service])) {
continue;
}
$config['aliases'][$service] = $replacedService;
}
return $config;
}
}

View File

@@ -0,0 +1,54 @@
<?php
/**
* @see https://github.com/laminas/laminas-zendframework-bridge for the canonical source repository
* @copyright https://github.com/laminas/laminas-zendframework-bridge/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-zendframework-bridge/blob/master/LICENSE.md New BSD License
*/
namespace Laminas\ZendFrameworkBridge;
use Laminas\ModuleManager\Listener\ConfigMergerInterface;
use Laminas\ModuleManager\ModuleEvent;
use Laminas\ModuleManager\ModuleManager;
class Module
{
/**
* Initialize the module.
*
* Type-hinting deliberately omitted to allow unit testing
* without dependencies on packages that do not exist yet.
*
* @param ModuleManager $moduleManager
*/
public function init($moduleManager)
{
$moduleManager
->getEventManager()
->attach('mergeConfig', [$this, 'onMergeConfig']);
}
/**
* Perform substitutions in the merged configuration.
*
* Rewrites keys and values matching known ZF classes, namespaces, and
* configuration keys to their Laminas equivalents.
*
* Type-hinting deliberately omitted to allow unit testing
* without dependencies on packages that do not exist yet.
*
* @param ModuleEvent $event
*/
public function onMergeConfig($event)
{
/** @var ConfigMergerInterface */
$configMerger = $event->getConfigListener();
$processor = new ConfigPostProcessor();
$configMerger->setMergedConfig(
$processor(
$configMerger->getMergedConfig($returnAsObject = false)
)
);
}
}

View File

@@ -0,0 +1,46 @@
<?php
/**
* @see https://github.com/laminas/laminas-zendframework-bridge for the canonical source repository
* @copyright https://github.com/laminas/laminas-zendframework-bridge/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-zendframework-bridge/blob/master/LICENSE.md New BSD License
*/
namespace Laminas\ZendFrameworkBridge;
use function array_merge;
use function str_replace;
use function strpos;
use function strtr;
class Replacements
{
/** @var string[] */
private $replacements;
public function __construct(array $additionalReplacements = [])
{
$this->replacements = array_merge(
require __DIR__ . '/../config/replacements.php',
$additionalReplacements
);
// Provide multiple variants of strings containing namespace separators
foreach ($this->replacements as $original => $replacement) {
if (false === strpos($original, '\\')) {
continue;
}
$this->replacements[str_replace('\\', '\\\\', $original)] = str_replace('\\', '\\\\', $replacement);
$this->replacements[str_replace('\\', '\\\\\\\\', $original)] = str_replace('\\', '\\\\\\\\', $replacement);
}
}
/**
* @param string $value
* @return string
*/
public function replace($value)
{
return strtr($value, $this->replacements);
}
}

View File

@@ -0,0 +1,79 @@
<?php
/**
* @see https://github.com/laminas/laminas-zendframework-bridge for the canonical source repository
* @copyright https://github.com/laminas/laminas-zendframework-bridge/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-zendframework-bridge/blob/master/LICENSE.md New BSD License
*/
namespace Laminas\ZendFrameworkBridge;
class RewriteRules
{
/**
* @return array
*/
public static function namespaceRewrite()
{
return [
// Expressive
'Zend\\ProblemDetails\\' => 'Mezzio\\ProblemDetails\\',
'Zend\\Expressive\\' => 'Mezzio\\',
// Laminas
'Zend\\' => 'Laminas\\',
'ZF\\ComposerAutoloading\\' => 'Laminas\\ComposerAutoloading\\',
'ZF\\DevelopmentMode\\' => 'Laminas\\DevelopmentMode\\',
// Apigility
'ZF\\Apigility\\' => 'Laminas\\ApiTools\\',
'ZF\\' => 'Laminas\\ApiTools\\',
// ZendXml, API wrappers, zend-http OAuth support, zend-diagnostics, ZendDeveloperTools
'ZendXml\\' => 'Laminas\\Xml\\',
'ZendOAuth\\' => 'Laminas\\OAuth\\',
'ZendDiagnostics\\' => 'Laminas\\Diagnostics\\',
'ZendService\\ReCaptcha\\' => 'Laminas\\ReCaptcha\\',
'ZendService\\Twitter\\' => 'Laminas\\Twitter\\',
'ZendDeveloperTools\\' => 'Laminas\\DeveloperTools\\',
];
}
/**
* @return array
*/
public static function namespaceReverse()
{
return [
// ZendXml, ZendOAuth, ZendDiagnostics, ZendDeveloperTools
'Laminas\\Xml\\' => 'ZendXml\\',
'Laminas\\OAuth\\' => 'ZendOAuth\\',
'Laminas\\Diagnostics\\' => 'ZendDiagnostics\\',
'Laminas\\DeveloperTools\\' => 'ZendDeveloperTools\\',
// Zend Service
'Laminas\\ReCaptcha\\' => 'ZendService\\ReCaptcha\\',
'Laminas\\Twitter\\' => 'ZendService\\Twitter\\',
// Zend
'Laminas\\' => 'Zend\\',
// Expressive
'Mezzio\\ProblemDetails\\' => 'Zend\\ProblemDetails\\',
'Mezzio\\' => 'Zend\\Expressive\\',
// Laminas to ZfCampus
'Laminas\\ComposerAutoloading\\' => 'ZF\\ComposerAutoloading\\',
'Laminas\\DevelopmentMode\\' => 'ZF\\DevelopmentMode\\',
// Apigility
'Laminas\\ApiTools\\Admin\\' => 'ZF\\Apigility\\Admin\\',
'Laminas\\ApiTools\\Doctrine\\' => 'ZF\\Apigility\\Doctrine\\',
'Laminas\\ApiTools\\Documentation\\' => 'ZF\\Apigility\\Documentation\\',
'Laminas\\ApiTools\\Example\\' => 'ZF\\Apigility\\Example\\',
'Laminas\\ApiTools\\Provider\\' => 'ZF\\Apigility\\Provider\\',
'Laminas\\ApiTools\\Welcome\\' => 'ZF\\Apiglity\\Welcome\\',
'Laminas\\ApiTools\\' => 'ZF\\',
];
}
}

View File

@@ -0,0 +1,9 @@
<?php
/**
* @see https://github.com/laminas/laminas-zendframework-bridge for the canonical source repository
* @copyright https://github.com/laminas/laminas-zendframework-bridge/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-zendframework-bridge/blob/master/LICENSE.md New BSD License
*/
Laminas\ZendFrameworkBridge\Autoloader::load();

View File

@@ -134,7 +134,7 @@ class Url
{
$path = $this->getPath();
return empty($path) || $path{0}
return empty($path) || $path[0]
!== '/';
}

View File

@@ -4,8 +4,8 @@ namespace PicoFeed\Parser;
use DOMDocument;
use SimpleXMLElement;
use ZendXml\Exception\RuntimeException;
use ZendXml\Security;
use Laminas\Xml\Exception\RuntimeException;
use Laminas\Xml\Security;
/**
* XML parser class.
@@ -17,6 +17,8 @@ use ZendXml\Security;
*/
class XmlParser
{
protected static $errors = [];
/**
* Get a SimpleXmlElement instance or return false.
*
@@ -53,7 +55,7 @@ class XmlParser
}
/**
* Small wrapper around ZendXml to turn their exceptions into PicoFeed exceptions
* Small wrapper around Laminas Xml to turn their exceptions into PicoFeed exceptions
*
* @static
* @access private
@@ -95,6 +97,18 @@ class XmlParser
$dom->loadHTML($input);
}
self::$errors = [];
foreach (libxml_get_errors() as $error) {
self::$errors[] = sprintf('XML error: %s (Line: %d - Column: %d - Code: %d)',
$error->message,
$error->line,
$error->column,
$error->code
);
}
libxml_use_internal_errors(false);
return $dom;
}
@@ -121,18 +135,7 @@ class XmlParser
*/
public static function getErrors()
{
$errors = array();
foreach (libxml_get_errors() as $error) {
$errors[] = sprintf('XML error: %s (Line: %d - Column: %d - Code: %d)',
$error->message,
$error->line,
$error->column,
$error->code
);
}
return implode(', ', $errors);
return implode(', ', self::$errors);
}
/**

View File

@@ -31,7 +31,7 @@
"ext-ctype": "*"
},
"require-dev": {
"squizlabs/php_codesniffer": "~2.5",
"squizlabs/php_codesniffer": "~3.5",
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.3",
"twbs/bootstrap": "~4.3",
"zurb/foundation": "~6.5"

View File

@@ -22,13 +22,12 @@ use Exception;
* taking in account options that affects the result
*
* The cache manager is agnostic about data format and only the operation is expected to be described by string
*
*/
/**
* SCSS cache
*
* @author Cedric Morin
* @author Cedric Morin <cedric@yterium.com>
*/
class Cache
{
@@ -102,13 +101,13 @@ class Cache
) {
$cacheTime = filemtime($fileCache);
if ((is_null($lastModified) || $cacheTime > $lastModified) &&
if ((\is_null($lastModified) || $cacheTime > $lastModified) &&
$cacheTime + self::$gcLifetime > time()
) {
$c = file_get_contents($fileCache);
$c = unserialize($c);
if (is_array($c) && isset($c['value'])) {
if (\is_array($c) && isset($c['value'])) {
return $c['value'];
}
}
@@ -132,6 +131,7 @@ class Cache
$c = ['value' => $value];
$c = serialize($c);
file_put_contents($fileCache, $c);
if (self::$forceRefresh === 'once') {

View File

@@ -186,7 +186,7 @@ class Colors
*/
public static function colorNameToRGBa($colorName)
{
if (is_string($colorName) && isset(static::$cssColors[$colorName])) {
if (\is_string($colorName) && isset(static::$cssColors[$colorName])) {
$rgba = explode(',', static::$cssColors[$colorName]);
// only case with opacity is transparent, with opacity=0, so we can intval on opacity also
@@ -217,28 +217,23 @@ class Colors
}
if ($a < 1) {
# specific case we dont' revert according to spec
#if (! $a && ! $r && ! $g && ! $b) {
# return 'transparent';
#}
return null;
}
if (is_null($reverseColorTable)) {
if (\is_null($reverseColorTable)) {
$reverseColorTable = [];
foreach (static::$cssColors as $name => $rgb_str) {
$rgb_str = explode(',', $rgb_str);
if (count($rgb_str) == 3) {
$reverseColorTable[intval($rgb_str[0])][intval($rgb_str[1])][intval($rgb_str[2])] = $name;
if (\count($rgb_str) == 3) {
$reverseColorTable[\intval($rgb_str[0])][\intval($rgb_str[1])][\intval($rgb_str[2])] = $name;
}
}
}
if (isset($reverseColorTable[intval($r)][intval($g)][intval($b)])) {
return $reverseColorTable[intval($r)][intval($g)][intval($b)];
if (isset($reverseColorTable[\intval($r)][\intval($g)][\intval($b)])) {
return $reverseColorTable[\intval($r)][\intval($g)][\intval($b)];
}
return null;

File diff suppressed because it is too large Load Diff

View File

@@ -142,8 +142,7 @@ abstract class Formatter
protected function blockLines(OutputBlock $block)
{
$inner = $this->indentStr();
$glue = $this->break . $inner;
$glue = $this->break . $inner;
$this->write($inner . implode($glue, $block->lines));
@@ -319,12 +318,12 @@ abstract class Formatter
);
$lines = explode("\n", $str);
$lineCount = count($lines);
$lineCount = \count($lines);
$this->currentLine += $lineCount-1;
$lastLine = array_pop($lines);
$this->currentColumn = ($lineCount === 1 ? $this->currentColumn : 0) + strlen($lastLine);
$this->currentColumn = ($lineCount === 1 ? $this->currentColumn : 0) + \strlen($lastLine);
}
echo $str;

View File

@@ -58,8 +58,7 @@ class Nested extends Formatter
protected function blockLines(OutputBlock $block)
{
$inner = $this->indentStr();
$glue = $this->break . $inner;
$glue = $this->break . $inner;
foreach ($block->lines as $index => $line) {
if (substr($line, 0, 2) === '/*') {
@@ -90,7 +89,7 @@ class Nested extends Formatter
$previousHasSelector = false;
}
$isMediaOrDirective = in_array($block->type, [Type::T_DIRECTIVE, Type::T_MEDIA]);
$isMediaOrDirective = \in_array($block->type, [Type::T_DIRECTIVE, Type::T_MEDIA]);
$isSupport = ($block->type === Type::T_DIRECTIVE
&& $block->selectors && strpos(implode('', $block->selectors), '@supports') !== false);
@@ -119,10 +118,12 @@ class Nested extends Formatter
if ($block->depth > end($depths)) {
if (! $previousEmpty || $this->depth < 1) {
$this->depth++;
$depths[] = $block->depth;
} else {
// keep the current depth unchanged but take the block depth as a new reference for following blocks
array_pop($depths);
$depths[] = $block->depth;
}
}

View File

@@ -31,14 +31,14 @@ class Number extends Node implements \ArrayAccess
/**
* @var integer
*/
static public $precision = 10;
public static $precision = 10;
/**
* @see http://www.w3.org/TR/2012/WD-css3-values-20120308/
*
* @var array
*/
static protected $unitTable = [
protected static $unitTable = [
'in' => [
'in' => 1,
'pc' => 6,
@@ -89,7 +89,7 @@ class Number extends Node implements \ArrayAccess
{
$this->type = Type::T_NUMBER;
$this->dimension = $dimension;
$this->units = is_array($initialUnit)
$this->units = \is_array($initialUnit)
? $initialUnit
: ($initialUnit ? [$initialUnit => 1]
: []);
@@ -110,7 +110,7 @@ class Number extends Node implements \ArrayAccess
$dimension = $this->dimension;
if (count($units)) {
if (\count($units)) {
$baseUnit = array_keys($units);
$baseUnit = reset($baseUnit);
$baseUnit = $this->findBaseUnit($baseUnit);
@@ -148,11 +148,11 @@ class Number extends Node implements \ArrayAccess
public function offsetExists($offset)
{
if ($offset === -3) {
return ! is_null($this->sourceColumn);
return ! \is_null($this->sourceColumn);
}
if ($offset === -2) {
return ! is_null($this->sourceLine);
return ! \is_null($this->sourceLine);
}
if ($offset === -1 ||
@@ -239,9 +239,10 @@ class Number extends Node implements \ArrayAccess
}
/**
* Test if a number can be normalized in a baseunit
* ie if it's units are homogeneous
* @return bool
* Test if a number can be normalized in a base unit
* ie if its units are homogeneous
*
* @return boolean
*/
public function isNormalizable()
{
@@ -250,15 +251,19 @@ class Number extends Node implements \ArrayAccess
}
$baseUnit = null;
foreach ($this->units as $unit => $exp) {
$b = $this->findBaseUnit($unit);
if (is_null($baseUnit)) {
if (\is_null($baseUnit)) {
$baseUnit = $b;
}
if (is_null($b) or $b !== $baseUnit) {
if (\is_null($b) or $b !== $baseUnit) {
return false;
}
}
return $baseUnit;
}
@@ -274,17 +279,17 @@ class Number extends Node implements \ArrayAccess
foreach ($this->units as $unit => $unitSize) {
if ($unitSize > 0) {
$numerators = array_pad($numerators, count($numerators) + $unitSize, $unit);
$numerators = array_pad($numerators, \count($numerators) + $unitSize, $unit);
continue;
}
if ($unitSize < 0) {
$denominators = array_pad($denominators, count($denominators) - $unitSize, $unit);
$denominators = array_pad($denominators, \count($denominators) - $unitSize, $unit);
continue;
}
}
return implode('*', $numerators) . (count($denominators) ? '/' . implode('*', $denominators) : '');
return implode('*', $numerators) . (\count($denominators) ? '/' . implode('*', $denominators) : '');
}
/**
@@ -302,7 +307,7 @@ class Number extends Node implements \ArrayAccess
return $unitSize;
});
if (count($units) > 1 && array_sum($units) === 0) {
if (\count($units) > 1 && array_sum($units) === 0) {
$dimension = $this->dimension;
$units = [];
@@ -316,7 +321,7 @@ class Number extends Node implements \ArrayAccess
$unitSize = array_sum($units);
if ($compiler && ($unitSize > 1 || $unitSize < 0 || count($units) > 1)) {
if ($compiler && ($unitSize > 1 || $unitSize < 0 || \count($units) > 1)) {
$this->units = $units;
$unit = $this->unitStr();
} else {
@@ -350,9 +355,10 @@ class Number extends Node implements \ArrayAccess
$units = [];
foreach ($this->units as $unit => $exp) {
if (!$baseUnit) {
if (! $baseUnit) {
$baseUnit = $this->findBaseUnit($unit);
}
if ($baseUnit && isset(static::$unitTable[$baseUnit][$unit])) {
$factor = pow(static::$unitTable[$baseUnit][$unit], $exp);
@@ -366,7 +372,9 @@ class Number extends Node implements \ArrayAccess
/**
* Find the base unit family for a given unit
* @param $unit
*
* @param string $unit
*
* @return string|null
*/
private function findBaseUnit($unit)
@@ -376,6 +384,7 @@ class Number extends Node implements \ArrayAccess
return $baseUnit;
}
}
return null;
}
}

View File

@@ -173,7 +173,7 @@ class Parser
];
$v = $this->cache->getCache("parse", $cacheKey, $parseOptions);
if (! is_null($v)) {
if (! \is_null($v)) {
return $v;
}
}
@@ -201,7 +201,7 @@ class Parser
;
}
if ($this->count !== strlen($this->buffer)) {
if ($this->count !== \strlen($this->buffer)) {
$this->throwParseError();
}
@@ -359,6 +359,7 @@ class Parser
if ($this->cssOnly) {
$this->throwParseError("SCSS syntax not allowed in CSS file");
}
$atRoot = $this->pushSpecialBlock(Type::T_AT_ROOT, $s);
$atRoot->selector = $selector;
$atRoot->with = $with;
@@ -385,6 +386,7 @@ class Parser
if ($this->cssOnly) {
$this->throwParseError("SCSS syntax not allowed in CSS file");
}
$mixin = $this->pushSpecialBlock(Type::T_MIXIN, $s);
$mixin->name = $mixinName;
$mixin->args = $args;
@@ -408,6 +410,7 @@ class Parser
if ($this->cssOnly) {
$this->throwParseError("SCSS syntax not allowed in CSS file");
}
$child = [
Type::T_INCLUDE,
$mixinName,
@@ -435,6 +438,7 @@ class Parser
if ($this->cssOnly) {
$this->throwParseError("SCSS syntax not allowed in CSS file");
}
$this->append([Type::T_SCSSPHP_IMPORT_ONCE, $importPath], $s);
return true;
@@ -460,6 +464,7 @@ class Parser
if ($this->cssOnly) {
$this->throwParseError("SCSS syntax not allowed in CSS file");
}
$this->append([Type::T_IMPORT, $importPath], $s);
return true;
@@ -474,6 +479,7 @@ class Parser
if ($this->cssOnly) {
$this->throwParseError("SCSS syntax not allowed in CSS file");
}
// check for '!flag'
$optional = $this->stripOptionalFlag($selectors);
$this->append([Type::T_EXTEND, $selectors, $optional], $s);
@@ -491,6 +497,7 @@ class Parser
if ($this->cssOnly) {
$this->throwParseError("SCSS syntax not allowed in CSS file");
}
$func = $this->pushSpecialBlock(Type::T_FUNCTION, $s);
$func->name = $fnName;
$func->args = $args;
@@ -504,6 +511,7 @@ class Parser
if ($this->cssOnly) {
$this->throwParseError("SCSS syntax not allowed in CSS file");
}
$this->append([Type::T_BREAK], $s);
return true;
@@ -515,6 +523,7 @@ class Parser
if ($this->cssOnly) {
$this->throwParseError("SCSS syntax not allowed in CSS file");
}
$this->append([Type::T_CONTINUE], $s);
return true;
@@ -526,6 +535,7 @@ class Parser
if ($this->cssOnly) {
$this->throwParseError("SCSS syntax not allowed in CSS file");
}
$this->append([Type::T_RETURN, isset($retVal) ? $retVal : [Type::T_NULL]], $s);
return true;
@@ -542,6 +552,7 @@ class Parser
if ($this->cssOnly) {
$this->throwParseError("SCSS syntax not allowed in CSS file");
}
$each = $this->pushSpecialBlock(Type::T_EACH, $s);
foreach ($varNames[2] as $varName) {
@@ -562,6 +573,7 @@ class Parser
if ($this->cssOnly) {
$this->throwParseError("SCSS syntax not allowed in CSS file");
}
$while = $this->pushSpecialBlock(Type::T_WHILE, $s);
$while->cond = $cond;
@@ -582,6 +594,7 @@ class Parser
if ($this->cssOnly) {
$this->throwParseError("SCSS syntax not allowed in CSS file");
}
$for = $this->pushSpecialBlock(Type::T_FOR, $s);
$for->var = $varName[1];
$for->start = $start;
@@ -597,13 +610,16 @@ class Parser
if ($this->cssOnly) {
$this->throwParseError("SCSS syntax not allowed in CSS file");
}
$if = $this->pushSpecialBlock(Type::T_IF, $s);
while ($cond[0] === Type::T_LIST
&& !empty($cond['enclosing'])
&& ! empty($cond['enclosing'])
&& $cond['enclosing'] === 'parent'
&& count($cond[2]) == 1) {
&& \count($cond[2]) == 1) {
$cond = reset($cond[2]);
}
$if->cond = $cond;
$if->cases = [];
@@ -619,6 +635,7 @@ class Parser
if ($this->cssOnly) {
$this->throwParseError("SCSS syntax not allowed in CSS file");
}
$this->append([Type::T_DEBUG, $value], $s);
return true;
@@ -633,6 +650,7 @@ class Parser
if ($this->cssOnly) {
$this->throwParseError("SCSS syntax not allowed in CSS file");
}
$this->append([Type::T_WARN, $value], $s);
return true;
@@ -647,6 +665,7 @@ class Parser
if ($this->cssOnly) {
$this->throwParseError("SCSS syntax not allowed in CSS file");
}
$this->append([Type::T_ERROR, $value], $s);
return true;
@@ -654,17 +673,17 @@ class Parser
$this->seek($s);
#if ($this->literal('@content', 8))
if ($this->literal('@content', 8) &&
($this->end() ||
$this->matchChar('(') &&
$this->argValues($argContent) &&
$this->matchChar(')') &&
$this->end())) {
$this->argValues($argContent) &&
$this->matchChar(')') &&
$this->end())
) {
if ($this->cssOnly) {
$this->throwParseError("SCSS syntax not allowed in CSS file");
}
$this->append([Type::T_MIXIN_CONTENT, isset($argContent) ? $argContent : null], $s);
return true;
@@ -770,34 +789,44 @@ class Parser
// custom properties : right part is static
if (($this->customProperty($name) || ($this->cssOnly && $this->propertyName($name))) &&
$this->matchChar(':', false)) {
$this->matchChar(':', false)
) {
$start = $this->count;
// but can be complex and finish with ; or }
foreach ([';','}'] as $ending) {
if ($this->openString($ending, $stringValue, '(', ')', false)
&& $this->end()) {
if ($this->openString($ending, $stringValue, '(', ')', false) &&
$this->end()
) {
$end = $this->count;
$value = $stringValue;
// check if we have only a partial value due to nested [] or { } to take in account
$nestingPairs = [['[', ']'], ['{', '}']];
foreach ($nestingPairs as $nestingPair) {
$p = strpos($this->buffer, $nestingPair[0], $start);
if ($p && $p < $end) {
$this->seek($start);
if ($this->openString($ending, $stringValue, $nestingPair[0], $nestingPair[1], false)
&& $this->end()) {
if ($this->count > $end) {
$end = $this->count;
$value = $stringValue;
}
if ($this->openString($ending, $stringValue, $nestingPair[0], $nestingPair[1], false) &&
$this->end() &&
$this->count > $end
) {
$end = $this->count;
$value = $stringValue;
}
}
}
$this->seek($end);
$this->append([Type::T_CUSTOM_PROPERTY, $name, $value], $s);
return true;
}
}
// TODO: output an error here if nothing found according to sass spec
}
@@ -827,6 +856,7 @@ class Parser
if ($this->cssOnly) {
$this->throwParseError("SCSS syntax not allowed in CSS file");
}
// check for '!flag'
$assignmentFlags = $this->stripAssignmentFlags($value);
$this->append([Type::T_ASSIGN, $name, $value, $assignmentFlags], $s);
@@ -844,10 +874,11 @@ class Parser
// opening css block
if ($this->selectors($selectors) && $this->matchChar('{', false)) {
if ($this->cssOnly) {
if (!empty($this->env->parent)) {
if (! empty($this->env->parent)) {
$this->throwParseError("SCSS syntax not allowed in CSS file");
}
}
$this->pushBlock($selectors, $s);
if ($this->eatWhiteDefault) {
@@ -877,6 +908,7 @@ class Parser
if ($this->cssOnly) {
$this->throwParseError("SCSS syntax not allowed in CSS file");
}
$propBlock = $this->pushSpecialBlock(Type::T_NESTED_PROPERTY, $s);
$propBlock->prefix = $name;
$propBlock->hasValue = $foundSomething;
@@ -1076,7 +1108,7 @@ class Parser
{
$token = null;
$end = strlen($this->buffer);
$end = \strlen($this->buffer);
// look for either ending delim, escape, or string interpolation
foreach (['#{', '\\', $delim] as $lookahead) {
@@ -1098,7 +1130,7 @@ class Parser
$match,
$token
];
$this->count = $end + strlen($token);
$this->count = $end + \strlen($token);
return true;
}
@@ -1120,7 +1152,7 @@ class Parser
return false;
}
$this->count += strlen($out[0]);
$this->count += \strlen($out[0]);
if (! isset($eatWhitespace)) {
$eatWhitespace = $this->eatWhiteDefault;
@@ -1202,7 +1234,7 @@ class Parser
// comment that are kept in the output CSS
$comment = [];
$startCommentCount = $this->count;
$endCommentCount = $this->count + strlen($m[1]);
$endCommentCount = $this->count + \strlen($m[1]);
// find interpolations in comment
$p = strpos($this->buffer, '#{', $this->count);
@@ -1249,7 +1281,7 @@ class Parser
$this->count = $endCommentCount;
} else {
// comment that are ignored and not kept in the output css
$this->count += strlen($m[0]);
$this->count += \strlen($m[0]);
}
$gotWhite = true;
@@ -1267,13 +1299,15 @@ class Parser
{
if (! $this->discardComments) {
if ($comment[0] === Type::T_COMMENT) {
if (is_string($comment[1])) {
if (\is_string($comment[1])) {
$comment[1] = substr(preg_replace(['/^\s+/m', '/^(.)/m'], ['', ' \1'], $comment[1]), 1);
}
if (isset($comment[2]) and is_array($comment[2]) and $comment[2][0] === Type::T_STRING) {
if (isset($comment[2]) and \is_array($comment[2]) and $comment[2][0] === Type::T_STRING) {
foreach ($comment[2][2] as $k => $v) {
if (is_string($v)) {
if (\is_string($v)) {
$p = strpos($v, "\n");
if ($p !== false) {
$comment[2][2][$k] = substr($v, 0, $p + 1)
. preg_replace(['/^\s+/m', '/^(.)/m'], ['', ' \1'], substr($v, $p+1));
@@ -1295,8 +1329,8 @@ class Parser
*/
protected function append($statement, $pos = null)
{
if (! is_null($statement)) {
if (! is_null($pos)) {
if (! \is_null($statement)) {
if (! \is_null($pos)) {
list($line, $column) = $this->getSourcePosition($pos);
$statement[static::SOURCE_LINE] = $line;
@@ -1322,7 +1356,7 @@ class Parser
*/
protected function last()
{
$i = count($this->env->children) - 1;
$i = \count($this->env->children) - 1;
if (isset($this->env->children[$i])) {
return $this->env->children[$i];
@@ -1369,7 +1403,7 @@ class Parser
$media = [Type::T_LIST, '', []];
foreach ((array) $mediaType as $type) {
if (is_array($type)) {
if (\is_array($type)) {
$media[2][] = $type;
} else {
$media[2][] = [Type::T_KEYWORD, $type];
@@ -1383,7 +1417,7 @@ class Parser
if (empty($parts) || $this->literal('and', 3)) {
$this->genericList($expressions, 'mediaExpression', 'and', false);
if (is_array($expressions)) {
if (\is_array($expressions)) {
$parts = array_merge($parts, $expressions[2]);
}
}
@@ -1415,7 +1449,7 @@ class Parser
$this->literal(': ', 2) &&
$this->valueList($value) &&
$this->matchChar(')')
) {
) {
$support = [Type::T_STRING, '', [[Type::T_KEYWORD, ($not ? 'not ' : '') . '(']]];
$support[2][] = $property;
$support[2][] = [Type::T_KEYWORD, ': '];
@@ -1459,7 +1493,7 @@ class Parser
$compound = [Type::T_STRING, '', []];
foreach ($sc as $scp) {
if (is_array($scp)) {
if (\is_array($scp)) {
$compound[2][] = $scp;
} else {
$compound[2][] = [Type::T_KEYWORD, $scp];
@@ -1468,6 +1502,7 @@ class Parser
$selectorList[2][] = $compound;
}
$support[2][] = $selectorList;
$support[2][] = [Type::T_KEYWORD, ')'];
$parts[] = $support;
@@ -1503,7 +1538,7 @@ class Parser
$this->seek($s);
}
if (count($parts)) {
if (\count($parts)) {
if ($this->eatWhiteDefault) {
$this->whitespace();
}
@@ -1603,18 +1638,22 @@ class Parser
/**
* Parse directive value list that considers $vars as keyword
* @param array $out
* @param bool|string $endChar
* @return bool
*
* @param array $out
* @param boolean|string $endChar
*
* @return boolean
*/
protected function directiveValue(&$out, $endChar = false)
{
$s = $this->count;
if ($this->variable($out)) {
if ($endChar && $this->matchChar($endChar, false)) {
return true;
}
if (!$endChar && $this->end()) {
if (! $endChar && $this->end()) {
return true;
}
}
@@ -1631,7 +1670,7 @@ class Parser
$allowVars = $this->allowVars;
$this->allowVars = false;
//$res = $this->valueList($out);
$res = $this->genericList($out, 'spaceList', ',');
$this->allowVars = $allowVars;
@@ -1639,7 +1678,8 @@ class Parser
if ($endChar && $this->matchChar($endChar, false)) {
return true;
}
if (!$endChar && $this->end()) {
if (! $endChar && $this->end()) {
return true;
}
}
@@ -1703,9 +1743,10 @@ class Parser
$items[] = $value;
if ($delim) {
if (! $this->literal($delim, strlen($delim))) {
if (! $this->literal($delim, \strlen($delim))) {
break;
}
$trailing_delim = true;
}
}
@@ -1719,7 +1760,8 @@ class Parser
if ($trailing_delim) {
$items[] = [Type::T_NULL];
}
if ($flatten && count($items) === 1) {
if ($flatten && \count($items) === 1) {
$out = $items[0];
} else {
$out = [Type::T_LIST, $delim, $items];
@@ -1731,9 +1773,9 @@ class Parser
/**
* Parse expression
*
* @param array $out
* @param bool $listOnly
* @param bool $lookForExp
* @param array $out
* @param boolean $listOnly
* @param boolean $lookForExp
*
* @return boolean
*/
@@ -1760,13 +1802,14 @@ class Parser
$this->seek($s);
}
if (in_array(Type::T_LIST, $allowedTypes) && $this->matchChar('[')) {
if (\in_array(Type::T_LIST, $allowedTypes) && $this->matchChar('[')) {
if ($this->enclosedExpression($lhs, $s, "]", [Type::T_LIST])) {
if ($lookForExp) {
$out = $this->expHelper($lhs, 0);
} else {
$out = $lhs;
}
$this->discardComments = $discard;
return true;
@@ -1775,7 +1818,7 @@ class Parser
$this->seek($s);
}
if (!$listOnly && $this->value($lhs)) {
if (! $listOnly && $this->value($lhs)) {
if ($lookForExp) {
$out = $this->expHelper($lhs, 0);
} else {
@@ -1788,6 +1831,7 @@ class Parser
}
$this->discardComments = $discard;
return false;
}
@@ -1803,39 +1847,46 @@ class Parser
*/
protected function enclosedExpression(&$out, $s, $closingParen = ")", $allowedTypes = [Type::T_LIST, Type::T_MAP])
{
if ($this->matchChar($closingParen) && in_array(Type::T_LIST, $allowedTypes)) {
if ($this->matchChar($closingParen) && \in_array(Type::T_LIST, $allowedTypes)) {
$out = [Type::T_LIST, '', []];
switch ($closingParen) {
case ")":
$out['enclosing'] = 'parent'; // parenthesis list
break;
case "]":
$out['enclosing'] = 'bracket'; // bracketed list
break;
}
return true;
}
if ($this->valueList($out) && $this->matchChar($closingParen)
&& in_array($out[0], [Type::T_LIST, Type::T_KEYWORD])
&& in_array(Type::T_LIST, $allowedTypes)) {
if ($this->valueList($out) && $this->matchChar($closingParen) &&
\in_array($out[0], [Type::T_LIST, Type::T_KEYWORD]) &&
\in_array(Type::T_LIST, $allowedTypes)
) {
if ($out[0] !== Type::T_LIST || ! empty($out['enclosing'])) {
$out = [Type::T_LIST, '', [$out]];
}
switch ($closingParen) {
case ")":
$out['enclosing'] = 'parent'; // parenthesis list
break;
case "]":
$out['enclosing'] = 'bracket'; // bracketed list
break;
}
return true;
}
$this->seek($s);
if (in_array(Type::T_MAP, $allowedTypes) && $this->map($out)) {
if (\in_array(Type::T_MAP, $allowedTypes) && $this->map($out)) {
return true;
}
@@ -2006,6 +2057,7 @@ class Parser
if ($follow_white) {
$out = [Type::T_KEYWORD, $char];
return true;
}
@@ -2021,11 +2073,15 @@ class Parser
if ($this->interpolation($out) || $this->color($out)) {
return true;
}
$this->count++;
if ($this->keyword($keyword)) {
$out = [Type::T_KEYWORD, "#" . $keyword];
return true;
}
$this->count--;
}
@@ -2272,6 +2328,7 @@ class Parser
}
$arg[2] = true;
$this->seek($sss);
} else {
$this->seek($ss);
@@ -2347,12 +2404,14 @@ class Parser
$s = $this->count;
if ($this->match('(#([0-9a-f]+))', $m)) {
if (in_array(strlen($m[2]), [3,4,6,8])) {
if (\in_array(\strlen($m[2]), [3,4,6,8])) {
$out = [Type::T_KEYWORD, $m[0]];
return true;
}
$this->seek($s);
return false;
}
@@ -2371,7 +2430,7 @@ class Parser
$s = $this->count;
if ($this->match('([0-9]*(\.)?[0-9]+)([%a-zA-Z]+)?', $m, false)) {
if (strlen($this->buffer) === $this->count || ! ctype_digit($this->buffer[$this->count])) {
if (\strlen($this->buffer) === $this->count || ! ctype_digit($this->buffer[$this->count])) {
$this->whitespace();
$unit = new Node\Number($m[1], empty($m[3]) ? '' : $m[3]);
@@ -2415,13 +2474,13 @@ class Parser
}
if ($m[2] === '#{') {
$this->count -= strlen($m[2]);
$this->count -= \strlen($m[2]);
if ($this->interpolation($inter, false)) {
$content[] = $inter;
$hasInterpolation = true;
} else {
$this->count += strlen($m[2]);
$this->count += \strlen($m[2]);
$content[] = '#{'; // ignore it
}
} elseif ($m[2] === '\\') {
@@ -2432,23 +2491,23 @@ class Parser
} elseif ($this->literal("\\", 1, false)) {
$content[] = $m[2] . "\\";
} elseif ($this->literal("\r\n", 2, false) ||
$this->matchChar("\r", false) ||
$this->matchChar("\n", false) ||
$this->matchChar("\f", false)
$this->matchChar("\r", false) ||
$this->matchChar("\n", false) ||
$this->matchChar("\f", false)
) {
// this is a continuation escaping, to be ignored
} else {
$content[] = $m[2];
}
} else {
$this->count -= strlen($delim);
$this->count -= \strlen($delim);
break; // delim
}
}
$this->eatWhiteDefault = $oldWhite;
if ($this->literal($delim, strlen($delim))) {
if ($this->literal($delim, \strlen($delim))) {
if ($hasInterpolation) {
$delim = '"';
@@ -2520,11 +2579,11 @@ class Parser
/**
* Parse an unbounded string stopped by $end
*
* @param string $end
* @param array $out
* @param string $nestingOpen
* @param string $nestingClose
* @param bool $trimEnd
* @param string $end
* @param array $out
* @param string $nestingOpen
* @param string $nestingClose
* @param boolean $trimEnd
*
* @return boolean
*/
@@ -2533,7 +2592,7 @@ class Parser
$oldWhite = $this->eatWhiteDefault;
$this->eatWhiteDefault = false;
if ($nestingOpen && !$nestingClose) {
if ($nestingOpen && ! $nestingClose) {
$nestingClose = $end;
}
@@ -2557,7 +2616,7 @@ class Parser
$tok = $m[2];
$this->count-= strlen($tok);
$this->count-= \strlen($tok);
if ($tok === $end && ! $nestingLevel) {
break;
@@ -2578,7 +2637,7 @@ class Parser
}
$content[] = $tok;
$this->count+= strlen($tok);
$this->count+= \strlen($tok);
}
$this->eatWhiteDefault = $oldWhite;
@@ -2588,8 +2647,8 @@ class Parser
}
// trim the end
if ($trimEnd && is_string(end($content))) {
$content[count($content) - 1] = rtrim(end($content));
if ($trimEnd && \is_string(end($content))) {
$content[\count($content) - 1] = rtrim(end($content));
}
$out = [Type::T_STRING, '', $content];
@@ -2687,16 +2746,10 @@ class Parser
}
// match comment hack
if (preg_match(
static::$whitePattern,
$this->buffer,
$m,
null,
$this->count
)) {
if (preg_match(static::$whitePattern, $this->buffer, $m, null, $this->count)) {
if (! empty($m[0])) {
$parts[] = $m[0];
$this->count += strlen($m[0]);
$this->count += \strlen($m[0]);
}
}
@@ -2748,7 +2801,7 @@ class Parser
$this->eatWhiteDefault = $oldWhite;
if (count($parts) == 1) {
if (\count($parts) == 1) {
$this->seek($s);
return false;
@@ -2813,7 +2866,7 @@ class Parser
$s = $this->count;
if ($this->match('[>+~]+', $m, true)) {
if ($subSelector && is_string($subSelector) && strpos($subSelector, 'nth-') === 0 &&
if ($subSelector && \is_string($subSelector) && strpos($subSelector, 'nth-') === 0 &&
$m[0] === '+' && $this->match("(\d+|n\b)", $counter)
) {
$this->seek($s);
@@ -2959,8 +3012,8 @@ class Parser
$nameParts === ['nth-of-type'] || $nameParts == ['nth-last-of-type']
) {
if ($this->matchChar('(', true) &&
($this->selectors($subs, reset($nameParts)) || true) &&
$this->matchChar(')')
($this->selectors($subs, reset($nameParts)) || true) &&
$this->matchChar(')')
) {
$parts[] = '(';
@@ -2970,12 +3023,12 @@ class Parser
$parts[] = $p;
}
if (count($sub) && reset($sub)) {
if (\count($sub) && reset($sub)) {
$parts[] = ' ';
}
}
if (count($subs) && reset($subs)) {
if (\count($subs) && reset($subs)) {
$parts[] = ', ';
}
}
@@ -2986,8 +3039,8 @@ class Parser
}
} else {
if ($this->matchChar('(') &&
($this->openString(')', $str, '(') || true) &&
$this->matchChar(')')
($this->openString(')', $str, '(') || true) &&
$this->matchChar(')')
) {
$parts[] = '(';
@@ -3008,7 +3061,7 @@ class Parser
$this->seek($s);
// 2n+1
if ($subSelector && is_string($subSelector) && strpos($subSelector, 'nth-') === 0) {
if ($subSelector && \is_string($subSelector) && strpos($subSelector, 'nth-') === 0) {
if ($this->match("(\s*(\+\s*|\-\s*)?(\d+|n|\d+n))+", $counter)) {
$parts[] = $counter[0];
//$parts[] = str_replace(' ', '', $counter[0]);
@@ -3124,7 +3177,7 @@ class Parser
{
$s = $this->count;
if ($this->keyword($word, $eatWhitespace) && (ord($word[0]) > 57 || ord($word[0]) < 48)) {
if ($this->keyword($word, $eatWhitespace) && (\ord($word[0]) > 57 || \ord($word[0]) < 48)) {
return true;
}
@@ -3189,7 +3242,7 @@ class Parser
return true;
}
if ($this->count === strlen($this->buffer) || $this->buffer[$this->count] === '}') {
if ($this->count === \strlen($this->buffer) || $this->buffer[$this->count] === '}') {
// if there is end of file or a closing block next then we don't need a ;
return true;
}
@@ -3208,10 +3261,10 @@ class Parser
{
$flags = [];
for ($token = &$value; $token[0] === Type::T_LIST && ($s = count($token[2])); $token = &$lastNode) {
for ($token = &$value; $token[0] === Type::T_LIST && ($s = \count($token[2])); $token = &$lastNode) {
$lastNode = &$token[2][$s - 1];
while ($lastNode[0] === Type::T_KEYWORD && in_array($lastNode[1], ['!default', '!global'])) {
while ($lastNode[0] === Type::T_KEYWORD && \in_array($lastNode[1], ['!default', '!global'])) {
array_pop($token[2]);
$node = end($token[2]);
@@ -3238,7 +3291,7 @@ class Parser
$part = end($selector);
if ($part === ['!optional']) {
array_pop($selectors[count($selectors) - 1]);
array_pop($selectors[\count($selectors) - 1]);
$optional = true;
}
@@ -3255,57 +3308,13 @@ class Parser
*/
protected function flattenList($value)
{
if ($value[0] === Type::T_LIST && count($value[2]) === 1) {
if ($value[0] === Type::T_LIST && \count($value[2]) === 1) {
return $this->flattenList($value[2][0]);
}
return $value;
}
/**
* @deprecated
*
* {@internal
* advance counter to next occurrence of $what
* $until - don't include $what in advance
* $allowNewline, if string, will be used as valid char set
* }}
*/
protected function to($what, &$out, $until = false, $allowNewline = false)
{
if (is_string($allowNewline)) {
$validChars = $allowNewline;
} else {
$validChars = $allowNewline ? '.' : "[^\n]";
}
$m = null;
if (! $this->match('(' . $validChars . '*?)' . $this->pregQuote($what), $m, ! $until)) {
return false;
}
if ($until) {
$this->count -= strlen($what); // give back $what
}
$out = $m[1];
return true;
}
/**
* @deprecated
*/
protected function show()
{
if ($this->peek("(.*?)(\n|$)", $m, $this->count)) {
return $m[1];
}
return '';
}
/**
* Quote regular expression
*
@@ -3333,10 +3342,10 @@ class Parser
$prev = $pos + 1;
}
$this->sourcePositions[] = strlen($buffer);
$this->sourcePositions[] = \strlen($buffer);
if (substr($buffer, -1) !== "\n") {
$this->sourcePositions[] = strlen($buffer) + 1;
$this->sourcePositions[] = \strlen($buffer) + 1;
}
}
@@ -3350,7 +3359,7 @@ class Parser
private function getSourcePosition($pos)
{
$low = 0;
$high = count($this->sourcePositions);
$high = \count($this->sourcePositions);
while ($low < $high) {
$mid = (int) (($high + $low) / 2);
@@ -3376,7 +3385,7 @@ class Parser
*/
private function saveEncoding()
{
if (extension_loaded('mbstring')) {
if (\extension_loaded('mbstring')) {
$this->encoding = mb_internal_encoding();
mb_internal_encoding('iso-8859-1');
@@ -3388,7 +3397,7 @@ class Parser
*/
private function restoreEncoding()
{
if (extension_loaded('mbstring') && $this->encoding) {
if (\extension_loaded('mbstring') && $this->encoding) {
mb_internal_encoding($this->encoding);
}
}

View File

@@ -61,7 +61,9 @@ class Base64VLQ
do {
$digit = $vlq & self::VLQ_BASE_MASK;
$vlq >>= self::VLQ_BASE_SHIFT;
//$vlq >>>= self::VLQ_BASE_SHIFT; // unsigned right shift
$vlq = (($vlq >> 1) & PHP_INT_MAX) >> (self::VLQ_BASE_SHIFT - 1);
if ($vlq > 0) {
$digit |= self::VLQ_CONTINUATION_BIT;
@@ -130,7 +132,9 @@ class Base64VLQ
private static function fromVLQSigned($value)
{
$negate = ($value & 1) === 1;
$value = ($value >> 1) & ~(1<<(8 * PHP_INT_SIZE - 1)); // unsigned right shift
//$value >>>= 1; // unsigned right shift
$value = ($value >> 1) & PHP_INT_MAX;
if (! $negate) {
return $value;

View File

@@ -132,7 +132,7 @@ class SourceMapGenerator
public function saveMap($content)
{
$file = $this->options['sourceMapWriteTo'];
$dir = dirname($file);
$dir = \dirname($file);
// directory does not exist
if (! is_dir($dir)) {
@@ -201,7 +201,7 @@ class SourceMapGenerator
}
// less.js compat fixes
if (count($sourceMap['sources']) && empty($sourceMap['sourceRoot'])) {
if (\count($sourceMap['sources']) && empty($sourceMap['sourceRoot'])) {
unset($sourceMap['sourceRoot']);
}
@@ -235,7 +235,7 @@ class SourceMapGenerator
*/
public function generateMappings()
{
if (! count($this->mappings)) {
if (! \count($this->mappings)) {
return '';
}
@@ -249,6 +249,7 @@ class SourceMapGenerator
}
ksort($groupedMap);
$lastGeneratedLine = $lastOriginalIndex = $lastOriginalLine = $lastOriginalColumn = 0;
foreach ($groupedMap as $lineNumber => $lineMap) {
@@ -313,8 +314,8 @@ class SourceMapGenerator
$basePath = $this->options['sourceMapBasepath'];
// "Trim" the 'sourceMapBasepath' from the output filename.
if (strlen($basePath) && strpos($filename, $basePath) === 0) {
$filename = substr($filename, strlen($basePath));
if (\strlen($basePath) && strpos($filename, $basePath) === 0) {
$filename = substr($filename, \strlen($basePath));
}
// Remove extra leading path separators.

View File

@@ -18,5 +18,5 @@ namespace ScssPhp\ScssPhp;
*/
class Version
{
const VERSION = 'v1.0.9';
const VERSION = '1.1.1';
}

View File

@@ -1,12 +0,0 @@
<?php
/**
* @see https://github.com/zendframework/ZendXml for the canonical source repository
* @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://github.com/zendframework/ZendXml/blob/master/LICENSE.md New BSD License
*/
namespace ZendXml\Exception;
interface ExceptionInterface
{
}

View File

@@ -1,15 +0,0 @@
<?php
/**
* @see https://github.com/zendframework/ZendXml for the canonical source repository
* @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://github.com/zendframework/ZendXml/blob/master/LICENSE.md New BSD License
*/
namespace ZendXml\Exception;
/**
* Invalid argument exception
*/
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
{
}

View File

@@ -1,15 +0,0 @@
<?php
/**
* @see https://github.com/zendframework/ZendXml for the canonical source repository
* @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://github.com/zendframework/ZendXml/blob/master/LICENSE.md New BSD License
*/
namespace ZendXml\Exception;
/**
* Runtime exception
*/
class RuntimeException extends \RuntimeException implements ExceptionInterface
{
}