Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Draft] Remove all uses of the Magic Methods by regenerating our classes to have concrete implementations instead #265

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
fbfc04c
Update the codegenerator to actually function under PHP 8.2
Garethp Aug 20, 2024
3832097
Update PHPUnit
Garethp Aug 20, 2024
ef83634
Add concrete methods for is* methods instead of dynamic properties
Garethp Aug 20, 2024
98ce494
Simplifying is* implementation for concrete methods
Garethp Aug 20, 2024
7f373e9
Generate concrete methods for getters rather than using the MagicMeth…
Garethp Aug 20, 2024
3f680e0
Update workflows to only test in PHP8
Garethp Aug 20, 2024
e3d21a9
Generate concrete methods for setters rather than using the MagicMeth…
Garethp Aug 23, 2024
53b4fda
Regenerate code after rebasing onto newer master
Garethp Aug 23, 2024
1f0e202
Add @autogenerated tag to get* and is* methods so that we can mark th…
Garethp Aug 23, 2024
ad24ca0
Adding a concrete method for is* methods
Garethp Aug 23, 2024
9cf5523
Split Type up into an XmlObject that extends from \stdClass for dynam…
Garethp Aug 23, 2024
1142596
Removing more deprecation
Garethp Aug 23, 2024
7fb665b
Removing more deprecation
Garethp Aug 23, 2024
b833ec9
Removing more deprecation
Garethp Aug 24, 2024
0ab2182
Removing more deprecation
Garethp Aug 24, 2024
cfd9de6
Update dataProviders in the tests
Garethp Aug 24, 2024
1bf9703
Update PHPUnit config
Garethp Aug 24, 2024
20b3b63
Update gitignore and add local scrutinizer config
Garethp Aug 24, 2024
852a54c
Change PHPUnit versions and test on more PHP versions
Garethp Aug 24, 2024
0c6f4f1
Widen the allowed versions of laminas-code
Garethp Aug 24, 2024
79ada8b
Try widening PHPUnit versions even further so that we can attempt to …
Garethp Aug 24, 2024
4dd5f37
Stick to PHP 8.1+
Garethp Aug 24, 2024
245c1e8
Document (most of) the ClassGenerator
Garethp Aug 25, 2024
702216b
Document (most of) ConvertToPHP.php
Garethp Aug 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '7.2', '7.3', '7.4', '8.0', '8.1' ]
php: [ '8.1', '8.2', '8.3' ]
name: PHP ${{ matrix.php }}
steps:
- name: Checkout
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ vendor
build/
Resources/auth.json
.vagrant
.phpunit.result.cache
.phpunit.cache/
27 changes: 27 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
filter:
excluded_paths:
- 'tests/*'
- 'src/API/Type/*'
- 'src/API/Message/*'
- 'src/Generator/*'
- 'examples/*'
tools:
external_code_coverage: true
checks:
php:
code_rating: true
duplication: true
coding_style:
php:
indentation:
general:
size: 1

build:
environment:
php: 8.3.1
nodes:
analysis:
tests:
override:
- php-scrutinizer-run
15 changes: 8 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
"calendar",
"contacts",
"push notification"
],
],
"require": {
"garethp/http-playback": "^2.0",
"ext-curl": "*",
"ext-soap": "*",
"ext-libxml": "*",
"ext-dom": "*",
"ext-simplexml": "*"
"ext-simplexml": "*",
"laminas/laminas-code": "4.*"
},
"scripts": {
"cs": "./vendor/bin/phpcs --standard=ruleset.xml -np src/ tests/ examples/",
Expand All @@ -40,10 +41,10 @@
]
},
"require-dev": {
"phpunit/phpunit": "^9.4 || ^8.5",
"squizlabs/php_codesniffer": "~3.6.0",
"mockery/mockery": "^1.3",
"goetas/xsd2php": "^2.1",
"goetas/xsd-reader": "^2.0-dev"
"squizlabs/php_codesniffer": "3.6.*",
"mockery/mockery": "1.3.*",
"goetas/xsd2php": "2.1.*",
"goetas/xsd-reader": "2.0.x-dev",
"phpunit/phpunit": "11.*|10.*"
}
}
52 changes: 25 additions & 27 deletions phpunit.live.xml
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
<?xml version="1.0" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.7/phpunit.xsd"
bootstrap="tests/bootstrap.php">
<php>
<env name="HttpPlayback" value="live" />
</php>
<testsuites>
<testsuite name="PHP EWS Test Suite">
<directory>tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
<exclude>
<directory>Type</directory>
<directory>Enumeration</directory>
</exclude>
</whitelist>
<blacklist>
<directory>tests</directory>
<directory>vendor</directory>
<directory>src/Type</directory>
<directory>src/Enumeration</directory>
</blacklist>
</filter>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.3/phpunit.xsd"
bootstrap="tests/bootstrap.php"
cacheDirectory=".phpunit.cache">
<php>
<env name="HttpPlayback" value="live"/>
</php>
<testsuites>
<testsuite name="PHP EWS Test Suite">
<directory>tests/</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
<exclude>
<directory>src/API/Type/</directory>
<directory>src/API/Message/</directory>
<directory>src/API/Enumeration/</directory>
<directory>src/Generator/</directory>
<directory>src/API/Exception/</directory>
</exclude>
</source>
</phpunit>
52 changes: 25 additions & 27 deletions phpunit.record.xml
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
<?xml version="1.0" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.7/phpunit.xsd"
bootstrap="tests/bootstrap.php">
<php>
<env name="HttpPlayback" value="record" />
</php>
<testsuites>
<testsuite name="PHP EWS Test Suite">
<directory>tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
<exclude>
<directory>Type</directory>
<directory>Enumeration</directory>
</exclude>
</whitelist>
<blacklist>
<directory>tests</directory>
<directory>vendor</directory>
<directory>src/Type</directory>
<directory>src/Enumeration</directory>
</blacklist>
</filter>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.3/phpunit.xsd"
bootstrap="tests/bootstrap.php"
cacheDirectory=".phpunit.cache">
<php>
<env name="HttpPlayback" value="record"/>
</php>
<testsuites>
<testsuite name="PHP EWS Test Suite">
<directory>tests/</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
<exclude>
<directory>src/API/Type/</directory>
<directory>src/API/Message/</directory>
<directory>src/API/Enumeration/</directory>
<directory>src/Generator/</directory>
<directory>src/API/Exception/</directory>
</exclude>
</source>
</phpunit>
24 changes: 16 additions & 8 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
<?xml version="1.0" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.7/phpunit.xsd"
bootstrap="tests/bootstrap.php">
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.3/phpunit.xsd"
bootstrap="tests/bootstrap.php"
cacheDirectory=".phpunit.cache">
<php>
<env name="HttpPlayback" value="playback" />
<env name="HttpPlayback" value="playback"/>
</php>
<testsuites>
<testsuite name="PHP EWS Test Suite">
<directory>tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<source>
<include>
<directory>src/</directory>
</whitelist>
</filter>
</include>
<exclude>
<directory>src/API/Type/</directory>
<directory>src/API/Message/</directory>
<directory>src/API/Enumeration/</directory>
<directory>src/Generator/</directory>
<directory>src/API/Exception/</directory>
</exclude>
</source>
</phpunit>
5 changes: 2 additions & 3 deletions src/API/ClassMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

class ClassMap
{

protected static $classMap = array(
protected static $classMap = [
'AddDelegateType' => '\\garethp\\ews\\API\\Message\\AddDelegateType',
'AddDelegateResponseMessageType' => '\\garethp\\ews\\API\\Message\\AddDelegateResponseMessageType',
'ApplyConversationActionType' => '\\garethp\\ews\\API\\Message\\ApplyConversationActionType',
Expand Down Expand Up @@ -438,7 +437,7 @@ class ClassMap
'WorkingHours' => '\\garethp\\ews\\API\\Type\\WorkingHoursType',
'WorkingPeriod' => '\\garethp\\ews\\API\\Type\\WorkingPeriodType',
'YearlyRegeneratingPatternType' => '\\garethp\\ews\\API\\Type\\YearlyRegeneratingPatternType',
);
];

public static function getClassMap()
{
Expand Down
4 changes: 0 additions & 4 deletions src/API/Enumeration/AffectedTaskOccurrencesType.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?php
/**
* Contains \garethp\ews\API\Enumeration\AffectedTaskOccurrencesType.
*/


namespace garethp\ews\API\Enumeration;

Expand Down
4 changes: 0 additions & 4 deletions src/API/Enumeration/AvailabilityProxyRequestType.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?php
/**
* Contains \garethp\ews\API\Enumeration\AvailabilityProxyRequestType.
*/


namespace garethp\ews\API\Enumeration;

Expand Down
4 changes: 0 additions & 4 deletions src/API/Enumeration/BodyTypeResponseType.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?php
/**
* Contains \garethp\ews\API\Enumeration\BodyTypeResponseType.
*/


namespace garethp\ews\API\Enumeration;

Expand Down
4 changes: 0 additions & 4 deletions src/API/Enumeration/BodyTypeType.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?php
/**
* Contains \garethp\ews\API\Enumeration\BodyTypeType.
*/


namespace garethp\ews\API\Enumeration;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?php
/**
* Contains \garethp\ews\API\Enumeration\CalendarItemCreateOrDeleteOperationType.
*/


namespace garethp\ews\API\Enumeration;

Expand Down
4 changes: 0 additions & 4 deletions src/API/Enumeration/CalendarItemTypeType.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?php
/**
* Contains \garethp\ews\API\Enumeration\CalendarItemTypeType.
*/


namespace garethp\ews\API\Enumeration;

Expand Down
4 changes: 0 additions & 4 deletions src/API/Enumeration/CalendarItemUpdateOperationType.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?php
/**
* Contains \garethp\ews\API\Enumeration\CalendarItemUpdateOperationType.
*/


namespace garethp\ews\API\Enumeration;

Expand Down
4 changes: 0 additions & 4 deletions src/API/Enumeration/CalendarPermissionLevelType.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?php
/**
* Contains \garethp\ews\API\Enumeration\CalendarPermissionLevelType.
*/


namespace garethp\ews\API\Enumeration;

Expand Down
4 changes: 0 additions & 4 deletions src/API/Enumeration/CalendarPermissionReadAccessType.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?php
/**
* Contains \garethp\ews\API\Enumeration\CalendarPermissionReadAccessType.
*/


namespace garethp\ews\API\Enumeration;

Expand Down
4 changes: 0 additions & 4 deletions src/API/Enumeration/ConflictResolutionType.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?php
/**
* Contains \garethp\ews\API\Enumeration\ConflictResolutionType.
*/


namespace garethp\ews\API\Enumeration;

Expand Down
4 changes: 0 additions & 4 deletions src/API/Enumeration/ConnectionFailureCauseType.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?php
/**
* Contains \garethp\ews\API\EnumerationConnectionFailureCauseType.
*/


namespace garethp\ews\API\Enumeration;

Expand Down
4 changes: 0 additions & 4 deletions src/API/Enumeration/ConnectionStatusType.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?php
/**
* Contains \garethp\ews\API\Enumeration\ConnectionStatusType.
*/


namespace garethp\ews\API\Enumeration;

Expand Down
4 changes: 0 additions & 4 deletions src/API/Enumeration/ContactSourceType.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?php
/**
* Contains \garethp\ews\API\Enumeration\ContactSourceType.
*/


namespace garethp\ews\API\Enumeration;

Expand Down
4 changes: 0 additions & 4 deletions src/API/Enumeration/ContainmentComparisonType.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?php
/**
* Contains \garethp\ews\API\Enumeration\ContainmentComparisonType.
*/


namespace garethp\ews\API\Enumeration;

Expand Down
4 changes: 0 additions & 4 deletions src/API/Enumeration/ContainmentModeType.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?php
/**
* Contains \garethp\ews\API\Enumeration\ContainmentModeType.
*/


namespace garethp\ews\API\Enumeration;

Expand Down
4 changes: 0 additions & 4 deletions src/API/Enumeration/ConversationActionTypeType.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?php
/**
* Contains \garethp\ews\API\Enumeration\ConversationActionTypeType.
*/


namespace garethp\ews\API\Enumeration;

Expand Down
4 changes: 0 additions & 4 deletions src/API/Enumeration/CreateActionType.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?php
/**
* Contains \garethp\ews\API\Enumeration\CreateActionType.
*/


namespace garethp\ews\API\Enumeration;

Expand Down
Loading
Loading