Skip to content

Commit

Permalink
[REFACTOR] PHP 8 Syntax, Add Types
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasWeinert committed Oct 21, 2023
1 parent 22ee563 commit d2ea9cd
Show file tree
Hide file tree
Showing 128 changed files with 87,499 additions and 51,914 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@ jobs:
fail-fast: false
matrix:
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
dependencies:
- highest
experimental:
- false

include:
- php-version: "8.1"
- php-version: "8.3"
dependencies: highest
experimental: true

Expand Down
43 changes: 21 additions & 22 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
8.0.0
-----

- [!BC] Minimum PHP Version 7.2.0
- [!BC] Minimum PHP Version 8.0.0
- [!BC] \FluentDOM\Loadable::load() now always returns
\FluentDOM\Loader\Result instance (or NULL)
- [!BC] Define Return Type For \FluentDOM\Loadable::load()
- [!BC] Define Return Type For \FluentDOM\Loadable::loadFragment()
- [!BC] Define Appendable::appendTo() Return Value
as "void"
- [!BC] Define Argument/Return Types
- [!BC] Change Method Signatures Of DOM L3 Methods To Match PHP
- [!BC] Declare FluentDOM::setLoader() Argument As A Nullable
Of Loadable
- [!BC] Throw UndeclaredPropertyError for unknown properties
- [!BC] Throw ReadOnlyPropertyError blocking write on read only properties
- [FEATURE] #90 Throw Exception If File Can Not Be Loaded
- [REFACTOR] Define Argument And Return Types
- [REFACTOR] Reference Loaders By Class Constants
Expand Down Expand Up @@ -118,7 +117,7 @@
- Added: JsonDOM loader supports a callback for mapping keys to tag names
The callback can be set using an option or JsonDOM::onMapKey().
- Changed: string arguments to methods like FluentDOM\Query::append() are now parsed as
HTML fragments if the content type of the FluentDOM\Query instance is a HTML type.
HTML fragments if the content type of the FluentDOM\Query instance is an HTML type.
- Changed: NULL values can now be set using FluentDOM\Query::attr(), FluentDOM\Query::css()
and FluentDOM\Query::data() methods.
- Changed: FluentDOM\Nodes()/FluentDOM\Query() now keeps the content type used to load the
Expand Down Expand Up @@ -178,7 +177,7 @@
-----

- Changed: All DOMNode descendants (FluentDOM\Document, FluentDOM\Element,
FluentDOM\Text, ...) are now functors, allowing to evaluate an
FluentDOM\Text, ...) are now functors, allowing to evaluate a
Xpath expression relative to them
- Changed: FluentDOM\Xpath is now a functor.
- Changed: FluentDOM\Element::append() is now longer restricted to
Expand Down Expand Up @@ -217,7 +216,7 @@
-----

Complete Rewrite!
- PHP Namespaces, PSR-4 comatible, Composer support
- PHP Namespaces, PSR-4 compatible, Composer support
- Original FluentDOM functionality is now merged in FluentDOM\Query.
- FluentDOM() function creates an FluentDOM\Query instance
- FluentDOM\Query has a new loader concept
Expand Down Expand Up @@ -247,7 +246,7 @@ Complete Rewrite!

For css() and attr() now property access is possible. HTML 5 data attributes are supported, too.

In PHP 5.3 an third argument was introduced to DOMXPath::evaluate(). This allows to disable the
In PHP 5.3 a third argument was introduced to DOMXPath::evaluate(). This allows to disable the
automatic namespace registration. Because it is broken and completely wrong in the first place it
is disabled if possible. This improves performance, too.

Expand All @@ -269,12 +268,12 @@ is disabled if possible. This improves performance, too.
This version has been restructured because the class had grown to large. The new structure allows
better testing and inheritance.

It brings compatiblity to the jQuery 1.4 API changes. A callback argument is supported by many
It brings compatibility to the jQuery 1.4 API changes. A callback argument is supported by many
methods.

- Implemented: FluentDOMLoader implementations now return a DOMNode or NULL,
DOMDocument inherits from DOMNode
- Implemented: make the $contentType argument of FluentDOMLoader an reference,
- Implemented: make the $contentType argument of FluentDOMLoader a reference,
so the loader can change it, set the changed version
- Changed: Moved source files into subdirectory src
- Changed: Splitting changelog.txt from readme.txt
Expand All @@ -290,8 +289,8 @@ methods.
- Added: FluentDOM::index()
- Added: FluentDOM::has()
- Added: FluentDOM::nextUntil(), FluentDOM::prevUntil(), FluentDOM::parentsUntil()
- Implemented: FluentDOM::children() now matches only elements (no text nodes any more)
- Added: FluentDOM::contents() matches all childnodes including textnodes
- Implemented: FluentDOM::children() now matches only elements (no text nodes anymore)
- Added: FluentDOM::contents() matches all child nodes including textnodes
- Added: FluentDOM::last()
- Added: FluentDOM::first()
- Fixed: FluentDOMHandler::insertChildrenBefore(), new nodes had wrong order
Expand All @@ -311,8 +310,8 @@ methods.
- Implemented: $context for FluentDOMCore::_test() ist now optional
- Added: FluentDOMCore::_isNodeList()
- Implemented: FluentDOMIterator now works for FluentDOMCore
- Implemented: FluentDOMCore::_spawn() is now publich and renamed to spawn()
- Implemented: FluentDOMCore::_push() is now publich and renamed to push()
- Implemented: FluentDOMCore::_spawn() is now public and renamed to spawn()
- Implemented: FluentDOMCore::_push() is now public and renamed to push()
- Implemented: splitting FluentDOMCore from FluentDOM
- Implemented: support additional parameter $attr in FluentDOM::node()
- Implemented: FluentDOM::append() supports function argument
Expand Down Expand Up @@ -352,7 +351,7 @@ methods.
- Implemented: removed defined, but never used variables
- Implemented: closest() needs to match the current node, too
- Tested: closest() needs to match the current node, too
- Implemented: improved the closest() example, explaning a possible problem
- Implemented: improved the closest() example, explaining a possible problem
- Implemented: jQuery 1.3 traversing method: closest
added links to jQuery and schlitt.info - corrected misspelled words
- Documented: added description from webpage
Expand All @@ -379,23 +378,23 @@ methods.
- Tested: removeAttr() with array parameter
- Tested: removeAttr() with asterisk (*) parameter
- Fixed: DOMDocument are child classes from DOMNode
but are invalid sources for the FluentDOMLoaderDOMNode, check DOMNode for an valid
but are invalid sources for the FluentDOMLoaderDOMNode, check DOMNode for a valid
ownerDocument property
- Fixed: simple atom reader sample has to use the FluentDOM function an not the class directly
- Fixed: simple atom reader sample has to use the FluentDOM function a not the class directly
- changed FluentDOMTestCase should be an abstract class
- patch by Sebastian Bergmann

2.0.0
-----
- added: FluentDOMIterator
- added: FluentDOM now implements IteratorAggregate
- removed: FluentDOM does not implement RecursiveIterator any more
- removed: FluentDOM does not implement SeekableIterator any more
- removed: FluentDOM does not implement RecursiveIterator anymore
- removed: FluentDOM does not implement SeekableIterator anymore
- removed: suffix "Siblings" from FluentDOM::next()
- removed: suffix "Siblings" from FluentDOM::nextAll()
- removed: suffix "Siblings" from FluentDOM::prev()
- removed: suffix "Siblings" from FluentDOM::prevAll()
- changed: FluentDOM::__construct() has no parameters any more
- changed: FluentDOM::__construct() has no parameters anymore
- changed: FluentDOM::append() now works on an empty document and returns new
elements
- added: FluentDOM::load() to load document content
Expand All @@ -408,7 +407,7 @@ methods.
- added: FluentDOMLoaderDOMDocument - attach dom document
- added: FluentDOMLoaderDOMNode - attach owner document and select node
- added: FluentDOMLoaderSimpleXMLElement - import SimpleXML element
- added: Example for custom loader (example/iniloader)
- added: Example for custom loader (examples/Loader)
- added: Example attributes with namespace
- added: FluentDOM::contentType - content type property for input and output
- fixed: attribute name check allowed invalid attribute names
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
"xmlwriter"
],
"license": "MIT",
"homepage": "http://fluentdom.org",
"homepage": "https://thomas.weinert.info/FluentDOM",
"authors": [
{
"name": "FluentDOM Contributors",
"homepage": "https://github.com/FluentDOM/FluentDOM/contributors"
}
],
"require": {
"php": "~7.2 || ~8.0",
"php": "~8.0",
"ext-dom": "*",
"ext-libxml": "*"
},
Expand All @@ -32,6 +32,7 @@
"fluentdom/css-selector": "Allows to use css selectors.",
"ext-xmlreader": "XMLReader, XML pull parser, read large XMLs",
"ext-xmlwriter": "XMLWriter, Write large XMLs",
"simplexml": "SimpleXML, to use SimpleXML loader",
"ext-json": "JSON support, needed for several loaders/serializers"
},
"autoload": {
Expand Down
6 changes: 3 additions & 3 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions phive.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
~ FluentDOM
~
~ @link https://thomas.weinert.info/FluentDOM/
~ @copyright Copyright 2009-2021 FluentDOM Contributors
~ @copyright Copyright 2009-2023 FluentDOM Contributors
~ @license http://www.opensource.org/licenses/mit-license.php The MIT License
~
-->

<phive xmlns="https://phar.io/phive">
<phar name="composer" version="^2.0.11" location="./tools/phpunit" installed="2.0.11" copy="true"/>
<phar name="phpunit" version="^8.0.0" location="./tools/phpunit" installed="8.5.14" copy="true"/>
<phar name="composer" version="^2.0.11" location="./tools/composer" installed="2.0.11"
copy="true"/>
<phar name="phpunit" version="^9.0.0" location="./tools/phpunit" installed="9.6.4" copy="true"/>
<phar name="phpmd" version="^2.9.1" installed="2.9.1" location="./tools/phpmd" copy="true"/>
<phar name="phpdox" version="^0.12.0" installed="0.12.0" location="./tools/phpdox" copy="true"/>
<phar name="phploc" version="^7.0.2" installed="7.0.2" location="./tools/phploc" copy="true"/>
Expand Down
23 changes: 13 additions & 10 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,25 @@
~ FluentDOM
~
~ @link https://thomas.weinert.info/FluentDOM/
~ @copyright Copyright 2009-2021 FluentDOM Contributors
~ @copyright Copyright 2009-2023 FluentDOM Contributors
~ @license http://www.opensource.org/licenses/mit-license.php The MIT License
~
-->

<phpunit backupGlobals="false"
backupStaticAttributes="false"
extensionsDirectory="C:/Projects/FluentDOM/FluentDOM/tools/phpunit.d">
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
backupStaticAttributes="false"
convertDeprecationsToExceptions="true"
extensionsDirectory="tools/phpunit.d"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage includeUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="FluentDOM">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</phpunit>
Loading

0 comments on commit d2ea9cd

Please sign in to comment.