diff --git a/README_DE.md b/README_DE.md index 164c875ac..acf6f2a01 100644 --- a/README_DE.md +++ b/README_DE.md @@ -1,192 +1,192 @@ -[Nederlands](README_NL.md) [Français](README_FR.md) [English](README.md) [Español](README_ES.md) - -![Mollie](https://www.mollie.com/files/Mollie-Logo-Style-Small.png) - -# PrestaShop-Zahlungsdienstleister [Mollie](https://www.mollie.com/). # - -Laden Sie das [Mollie](https://www.mollie.com/)-Modul für PrestaShop herunter. Mollie ist ein Zahlungsdienstleister, welcher Ihren Online-Shop mit den beliebtesten Online-Zahlungsmethoden zur Verfügung stellt. - -Empfangen Sie einfach Zahlungen von europäischen Kunden. Mollie stellt Zahlungsmethoden zu sehr wettbewerbsfähigen Preisen zur Verfügung. Zahlen Sie ausschließlich per Transaktion, keine versteckten Gebühren. - -Wählen Sie den besten verfügbaren Zahlungsanbieter für Ihren PrestaShop Online-Shop. Erstellen Sie bei [Mollie.com](https://www.mollie.com/) Ihr Händlerkonto. -Laden Sie das Mollie PrestaShop-Zahlungsmodul herunter, installieren Sie es und fangen Sie jetzt an, Online-Zahlungen zu erhalten! - - - - -## Von [Invertus](https://www.invertus.eu) erstellt und betrieben. ## - -## Mit PrestaShop 1.5 bis 1.7 kompatibel ## - -** Bitte beachten Sie: ** Für die Installation dieses Moduls kann ein FTP-Zugriff auf Ihren Web-Server erforderlich sein. -Sollten Sie damit keine Erfahrung haben, überlassen Sie die Installation dieses Moduls bitte Ihrem Website-Entwickler oder Ihrem Server-Administrator. - -## Installation PrestaShop 1.7 ## - -* Laden Sie über die [Versions-Seite](https://github.com/mollie/Prestashop/releases) die aktuellste Version des Moduls herunter (die '.zip'-Datei), die mit -PrestaShop 1.5 bis 1.7 kompatibel ist. -* Gehen Sie auf das Verwaltungs-Panel Ihres PrestaShop-Webshops -* Wählen Sie in Ihrem Verwaltungs-Panel den Reiter 'Modules' und wählen Sie anschließend 'upload a module' in der oberen rechten Ecke Ihres Bildschirms -* Wählen Sie 'select file' und laden Sie anschließend die '.zip'-Datei hoch, die Sie zuvor heruntergeladen haben -* Wählen Sie 'configure', nachdem das Modul installiert wurde -* Geben Sie Ihren _API-Schlüssel_ ein und sichern Sie die Daten. - -## Installation PrestaShop 1.5 und 1.6 ## - -* Laden Sie über die [Releases-Seite](https://github.com/mollie/Prestashop/releases) die aktuellste Version des Moduls herunter (die '.zip'-Datei) , die mit -PrestaShop 1.5 bis 1.7 kompatibel ist. -* Gehen Sie auf das Verwaltungs-Panel Ihres PrestaShop-Webshops -* Wählen Sie in Ihrem Verwaltungs-Panel den Reiter 'Modules' und wählen Sie anschließend 'upload a module' in der oberen rechten Ecke Ihres Bildschirms -* Wählen Sie 'select file' und laden Sie anschließend die '.zip'-Datei hoch, die Sie zuvor heruntergeladen haben -* Wählen Sie 'configure', nachdem das Modul installiert wurde -* Geben Sie Ihren _API-Schlüssel_ ein und sichern Sie die Daten. - -## oder ## - -* Laden Sie über die [Releases-Seite](https://github.com/mollie/Prestashop/releases) die aktuellste Version des Moduls herunter (die '.zip'-Datei) , die mit -PrestaShop 1.5 bis 1.7 kompatibel ist. -* Extrahieren Sie das Archiv -* Kopieren Sie über FTP den Ordner `mollie` in den Ordner `modules` in Ihrer PrestaShop-Installation -* Gehen Sie auf Ihrem Verwaltungs-Panel auf den Reiter 'Modules' und wählen Sie in der Liste 'Categories' 'Payments and Gateways'. -* Klicken Sie auf der rechten Seite des Mollie-Zahlungsmoduls auf die Schaltfläche 'install' -* Geben Sie Ihren _API-Schlüssel_ ein und sichern Sie die Daten. - -# Unterstützte Zahlungsmethoden - -### iDeal - -[iDEAL](https://www.mollie.com/en/payments/ideal) macht die Zahlungen für Ihre Online-Käufe sicher und einfach. -iDEAL ist ein niederländisches Zahlungssystem, welches Kunden bei einem Online-Kauf direkt mit ihrem Online-Banking-Programm verbindet. - -[Mollie](https://www.mollie.com/) macht eine Verbindung zu iDEAL einfach, ohne die üblichen technischen und administrativen Unannehmlichkeiten. -Mit Mollie können Sie jederzeit auf Ihre Transaktionsübersichten und andere Statistiken zugreifen. Sie können auch nach jeder erfolgreichen Zahlung eine Benachrichtigung per E-Mail oder SMS erhalten. - -[Mollie](https://www.mollie.com/) ist der perfekte Partner, um iDEAL-Zahlungen zu empfangen, und es ist keine Überraschung, dass [Mollie](https://www.mollie.com/) iDEAL-Zahlungen für -mehr als 40.000 Websites anbietet. - -### Kreditkarte -Die [Kreditkarte](https://www.mollie.com/en/payments/credit-card) ist die wahrscheinlich bekannteste Methode, um weltweit Zahlungen zu empfangen. - -Da [Mollie](https://www.mollie.com/) die größten Kreditkarten-Anbieter wie Mastercard, VISA und American Express unterstützt, wird Ihr Shop sehr viel mehr potenzielle Käufer anziehen. - -### Bancontact -[Bancontact](https://www.mollie.com/en/payments/bancontact) nutzt eine physische Karte, die mit einem Guthaben auf einem belgischen Bankkonto verbunden ist. Zahlungen über Bancontact / Mister Cash sind garantiert und weisen große Ähnlichkeit mit dem iDEAL-Zahlungssystem für die Niederlande auf. - -Da die Zahlungen garantiert sind, ist diese Zahlungsmethode ein großer Mehrwert für Ihren Online-Shop. - -### SOFORT Banking -[SOFORT Banking](https://www.mollie.com/en/payments/sofort) ist eine der beliebtesten Zahlungsmethoden in Deutschland und in 9 europäischen Ländern aktiv: - -Deutschland, Belgien, die Niederlande, Italien, Österreich, Polen, der Schweiz, Spanien und Großbritannien. - -Die Zahlungen sind direkt, unumkehrbar, und diese Zahlungsmethode eröffnet Ihrem Online-Shop einen riesigen Markt. - -### ING Home’Pay -[ING Home’Pay](https://www.mollie.com/de/payments/ing-homepay). Mit Mollie können Sie schnell und einfach Zahlungen mittels ING Home'Pay empfangen. - -Sie benötigen nur 10 Minuten, um Zahlungen empfangen zu können, und es existieren keine versteckten Gebühren, Sie zahlen nur für erfolgreiche Transaktionen. - -### Banküberweisungen -Im SEPA-Bereich empfangene [Banküberweisungen](https://www.mollie.com/en/payments/bank-transfer) mit [Mollie](https://www.mollie.com/). So können Sie Zahlungen sowohl von Einzelpersonen als auch von Geschäftskunden in mehr als 35 europäischen Ländern empfangen. - -### PayPal -[PayPal](https://www.mollie.com/en/payments/paypal) ist eine sehr beliebte Zahlungsmethode, die weltweit genutzt wird. Mit wenigen Klicks können Sie Zahlungen per Banküberweisung, Kreditkarte oder PayPal-Guthaben durchführen. - -### Bitcoin -[Bitcoin](https://www.mollie.com/en/payments/bitcoin) ist eine Art virtuelles Geld. Der Wechselkurs wird zum Zeitpunkt der Transaktion bestimmt, der Betrag und die Zahlung sind also garantiert. - -### paysafecard -[paysafecard](https://www.mollie.com/en/payments/paysafecard) ist die beliebteste Prepaid-Karte für Online-Zahlungen. Mit paysafecard können Sie Prepaid-Zahlungen aus 43 Ländern empfangen. - -### KBC/CBC-Zahlungsschaltfläche -Die [KBC / CBC-Zahlungsschaltfläche](https://www.mollie.com/en/payments/kbc-cbc) ist eine Online-Zahlungsmethode für KBC und CBC-Kunden, gemeinsam die größte Bank Belgiens. - -KBC konzentriert sich auf Flandern, CBC auf die Wallonie. - -### Belfius-Zahlungsschaltfläche -[Belfius](https://www.mollie.com/en/payments/belfius) ist eine der größten Banken Belgiens. Durch die Einführung der Belfius-Zahlungsschaltfläche bietet die Bank ihren Kunden ihre eigene Zahlungslösung. - -### CartaSi -[CartaSi](https://www.mollie.com/en/payments/cartasi) ist eine der am weitesten verbreiteten Zahlungsmethoden Italiens. - -Es sind über 13 Millionen CartaSi-Karten im Umlauf. - -### Cartes Bancaires -[Cartes Bancaires](https://www.mollie.com/en/payments/cartes-bancaires) sind die am häufigsten verwendeten Kreditkarten Frankreichs, es sind mehr als 64 Millionen Karten im Umlauf. - -Die Karten tragen ebenfalls das Markenzeichen von Visa. - -### EPS -[EPS](https://www.mollie.com/de/payments/eps). Electronic Payment Standard (EPS) ist eine von mehreren österreichischen Banken gemeinsam entwickelte Zahlungsmethode. - -Dies macht sie zur wichtigsten Zahlungsmethode in Österreich, die bei österreichischen Konsumenten hohe Beliebtheit genießt. - -### Giropay -[Giropay](https://www.mollie.com/de/payments/giropay). Giropay ist eine der beliebtesten Überweisungsmethoden Deutschlands. - -Deutsche Kunden schenken dieser Zahlungsmethode ihr Vertrauen, da sie von über 1.500 Banken landesweit unterstützt wird. - -### Klarna: Rechnung -[Klarna: Rechnung](https://www.mollie.com/de/payments/klarna-pay-later). Klarna ist eine flexible Zahlungslösung, die Ihren Kunden verschiedene, flexible Zahlungsmöglichkeiten zur Verfügung stellt. - -Der Empfang von Zahlungen durch Klarna: Rechnung dauert nur wenige Minuten und ist mit keinen zusätzlichen Gebühren verbunden. - -### Klarna: Ratenkauf -[Klarna: Ratenkauf](https://www.mollie.com/de/payments/klarna-slice-it). Klarna ist eine flexible Zahlungslösung, die Ihren Kunden verschiedene, flexible Zahlungsmöglichkeiten zur Verfügung stellt. - -Der Empfang von Zahlungen durch Klarna: Ratenkauf dauert nur wenige Minuten und ist mit keinen zusätzlichen Gebühren verbunden. - -# Häufig gestellte Fragen # - -**Das Modul kann in PrestaShop 1.7 nicht installiert werden.** - -* Gehen Sie über FTP in das Root-Verzeichnis Ihrer Website und öffnen Sie den Ordner 'modules'. -* Löschen Sie den Ordner 'mollie'. -* Installieren Sie das Mollie-Modul für PrestaShop 1.7 neu. - -**Ich habe das Modul installiert, aber das Modul erscheint während des Checkouts nicht.** - -* Prüfen Sie, ob das Modul eingeschaltet ist und ob der korrekte API-Schlüssel gesetzt ist. Lesen Sie die Installationsanweisungen. -* Prüfen Sie, ob als Währung in Ihrem Shop Euro eingestellt sind. Mollie unterstützt nur Euro. -* Prüfen Sie über "Advanced parameters" -> "Performance", ob "Minimize HTML" deaktiviert ist. - -**Muss ich auch eine Rückgabe- oder Webhook-URL setzen?** - -Es ist nicht notwendig, eine Weiterleitungs-URL oder einen Webhook zu setzen. Das Modul erledigt dies bei jeder Bestellung automatisch. - -**Nach einer erfolgreichen Zahlung sehen meine Kunden den Bestellverlauf statt der Bestellbestätigung.** - -Dies ist ein Fehler in PrestaShop, der mit der Version 1.6.0.7. behoben wurde. Um dieses Problem zu lösen, sollten Sie Ihre PrestaShop-Version aktualisieren. Wenn Sie dies nicht wünschen, können Sie den Fehler auch selbst beheben, indem Sie eine Codezeile anpassen. - -Der entsprechende [GitHub-Issue](https://github.com/mollie/Prestashop/issues/3) beschreibt genau, wie dies geht. - -**Der Bestellstatus wird nicht aktualisiert** - -Wenn sich der Status der Zahlung ändert, schickt Mollie eine Nachricht an Ihre Website. Es ist möglich, dass Mollie Ihre Website nicht erreichen konnte, oder dass Ihre Website den Status nicht verarbeiten konnte. - -* Prüfen Sie Ihr [Mollie-Management ](https://www.mollie.com/beheer/) auf fehlgeschlagene Berichte. -* Prüfen Sie, ob Ihre Website im 'Wartungsmodus' läuft. Mollie kann Ihre Website nicht erreichen, wenn diese im Wartungsmodus läuft und Sie Mollie 2.0 oder niedriger verwenden. -Ab Version 2.0.0. funktioniert das Mollie-Modul im Wartungsmodus. -* Etwas funktioniert bei der Erstellung einer Rechnung nicht. Prüfen Sie, ob die Option "Enable image for product" ausgeschaltet ist in "Orders" -> "Invoices" -> "Invoice options" (ab PrestaShop 1.6.1.0) oder in "Preferences" -> "Orders" -> "PDF settings" (in PrestaShop 1.6.0.12 bis 1.6.0.14). - -# Möchten Sie dabei helfen, dieses Modul zu verbessern? # - -Möchten Sie mithelfen, dieses Modul für PrestaShop noch besser zu machen? Wir sind jederzeit offen für [Pull-Requests](https://github.com/mollie/Prestashop/pulls?utf8=%E2%9C%93&q=is%3Apr). - -Und was halten Sie davon, für ein [technologie-betriebenes Unternehmen](https://jobs.mollie.com/) zu arbeiten? Mollie sucht immer nach Entwicklern und Systemingenieuren. [Werfen Sie einen Blick auf unsere offenen Stellen](https://jobs.mollie.com/) oder [sprechen Sie uns an](mailto:personeel@mollie.com). - -# Lizenz # -[BSD (Berkeley Software Distribution)-Lizenz](http://www.opensource.org/licenses/bsd-license.php). -Copyright (c) 2013-2019, Mollie B.V. - -# Support # - -Haben Sie Probleme bei der Installation, oder denken Sie, dass das Modul einen Bug enthält? Senden Sie eine E-Mail -an info@mollie.com mit einer genauen Beschreibung des Problems. +[Nederlands](README_NL.md) [Français](README_FR.md) [English](README.md) [Español](README_ES.md) + +![Mollie](https://www.mollie.com/files/Mollie-Logo-Style-Small.png) + +# PrestaShop-Zahlungsdienstleister [Mollie](https://www.mollie.com/). # + +Laden Sie das [Mollie](https://www.mollie.com/)-Modul für PrestaShop herunter. Mollie ist ein Zahlungsdienstleister, welcher Ihren Online-Shop mit den beliebtesten Online-Zahlungsmethoden zur Verfügung stellt. + +Empfangen Sie einfach Zahlungen von europäischen Kunden. Mollie stellt Zahlungsmethoden zu sehr wettbewerbsfähigen Preisen zur Verfügung. Zahlen Sie ausschließlich per Transaktion, keine versteckten Gebühren. + +Wählen Sie den besten verfügbaren Zahlungsanbieter für Ihren PrestaShop Online-Shop. Erstellen Sie bei [Mollie.com](https://www.mollie.com/) Ihr Händlerkonto. +Laden Sie das Mollie PrestaShop-Zahlungsmodul herunter, installieren Sie es und fangen Sie jetzt an, Online-Zahlungen zu erhalten! + + + + +## Von [Invertus](https://www.invertus.eu) erstellt und betrieben. ## + +## Mit PrestaShop 1.5 bis 1.7 kompatibel ## + +** Bitte beachten Sie: ** Für die Installation dieses Moduls kann ein FTP-Zugriff auf Ihren Web-Server erforderlich sein. +Sollten Sie damit keine Erfahrung haben, überlassen Sie die Installation dieses Moduls bitte Ihrem Website-Entwickler oder Ihrem Server-Administrator. + +## Installation PrestaShop 1.7 ## + +* Laden Sie über die [Versions-Seite](https://github.com/mollie/Prestashop/releases) die aktuellste Version des Moduls herunter (die '.zip'-Datei), die mit +PrestaShop 1.5 bis 1.7 kompatibel ist. +* Gehen Sie auf das Verwaltungs-Panel Ihres PrestaShop-Webshops +* Wählen Sie in Ihrem Verwaltungs-Panel den Reiter 'Modules' und wählen Sie anschließend 'upload a module' in der oberen rechten Ecke Ihres Bildschirms +* Wählen Sie 'select file' und laden Sie anschließend die '.zip'-Datei hoch, die Sie zuvor heruntergeladen haben +* Wählen Sie 'configure', nachdem das Modul installiert wurde +* Geben Sie Ihren _API-Schlüssel_ ein und sichern Sie die Daten. + +## Installation PrestaShop 1.5 und 1.6 ## + +* Laden Sie über die [Releases-Seite](https://github.com/mollie/Prestashop/releases) die aktuellste Version des Moduls herunter (die '.zip'-Datei) , die mit +PrestaShop 1.5 bis 1.7 kompatibel ist. +* Gehen Sie auf das Verwaltungs-Panel Ihres PrestaShop-Webshops +* Wählen Sie in Ihrem Verwaltungs-Panel den Reiter 'Modules' und wählen Sie anschließend 'upload a module' in der oberen rechten Ecke Ihres Bildschirms +* Wählen Sie 'select file' und laden Sie anschließend die '.zip'-Datei hoch, die Sie zuvor heruntergeladen haben +* Wählen Sie 'configure', nachdem das Modul installiert wurde +* Geben Sie Ihren _API-Schlüssel_ ein und sichern Sie die Daten. + +## oder ## + +* Laden Sie über die [Releases-Seite](https://github.com/mollie/Prestashop/releases) die aktuellste Version des Moduls herunter (die '.zip'-Datei) , die mit +PrestaShop 1.5 bis 1.7 kompatibel ist. +* Extrahieren Sie das Archiv +* Kopieren Sie über FTP den Ordner `mollie` in den Ordner `modules` in Ihrer PrestaShop-Installation +* Gehen Sie auf Ihrem Verwaltungs-Panel auf den Reiter 'Modules' und wählen Sie in der Liste 'Categories' 'Payments and Gateways'. +* Klicken Sie auf der rechten Seite des Mollie-Zahlungsmoduls auf die Schaltfläche 'install' +* Geben Sie Ihren _API-Schlüssel_ ein und sichern Sie die Daten. + +# Unterstützte Zahlungsmethoden + +### iDeal + +[iDEAL](https://www.mollie.com/en/payments/ideal) macht die Zahlungen für Ihre Online-Käufe sicher und einfach. +iDEAL ist ein niederländisches Zahlungssystem, welches Kunden bei einem Online-Kauf direkt mit ihrem Online-Banking-Programm verbindet. + +[Mollie](https://www.mollie.com/) macht eine Verbindung zu iDEAL einfach, ohne die üblichen technischen und administrativen Unannehmlichkeiten. +Mit Mollie können Sie jederzeit auf Ihre Transaktionsübersichten und andere Statistiken zugreifen. Sie können auch nach jeder erfolgreichen Zahlung eine Benachrichtigung per E-Mail oder SMS erhalten. + +[Mollie](https://www.mollie.com/) ist der perfekte Partner, um iDEAL-Zahlungen zu empfangen, und es ist keine Überraschung, dass [Mollie](https://www.mollie.com/) iDEAL-Zahlungen für +mehr als 40.000 Websites anbietet. + +### Kreditkarte +Die [Kreditkarte](https://www.mollie.com/en/payments/credit-card) ist die wahrscheinlich bekannteste Methode, um weltweit Zahlungen zu empfangen. + +Da [Mollie](https://www.mollie.com/) die größten Kreditkarten-Anbieter wie Mastercard, VISA und American Express unterstützt, wird Ihr Shop sehr viel mehr potenzielle Käufer anziehen. + +### Bancontact +[Bancontact](https://www.mollie.com/en/payments/bancontact) nutzt eine physische Karte, die mit einem Guthaben auf einem belgischen Bankkonto verbunden ist. Zahlungen über Bancontact / Mister Cash sind garantiert und weisen große Ähnlichkeit mit dem iDEAL-Zahlungssystem für die Niederlande auf. + +Da die Zahlungen garantiert sind, ist diese Zahlungsmethode ein großer Mehrwert für Ihren Online-Shop. + +### SOFORT Banking +[SOFORT Banking](https://www.mollie.com/en/payments/sofort) ist eine der beliebtesten Zahlungsmethoden in Deutschland und in 9 europäischen Ländern aktiv: + +Deutschland, Belgien, die Niederlande, Italien, Österreich, Polen, der Schweiz, Spanien und Großbritannien. + +Die Zahlungen sind direkt, unumkehrbar, und diese Zahlungsmethode eröffnet Ihrem Online-Shop einen riesigen Markt. + +### ING Home’Pay +[ING Home’Pay](https://www.mollie.com/de/payments/ing-homepay). Mit Mollie können Sie schnell und einfach Zahlungen mittels ING Home'Pay empfangen. + +Sie benötigen nur 10 Minuten, um Zahlungen empfangen zu können, und es existieren keine versteckten Gebühren, Sie zahlen nur für erfolgreiche Transaktionen. + +### Banküberweisungen +Im SEPA-Bereich empfangene [Banküberweisungen](https://www.mollie.com/en/payments/bank-transfer) mit [Mollie](https://www.mollie.com/). So können Sie Zahlungen sowohl von Einzelpersonen als auch von Geschäftskunden in mehr als 35 europäischen Ländern empfangen. + +### PayPal +[PayPal](https://www.mollie.com/en/payments/paypal) ist eine sehr beliebte Zahlungsmethode, die weltweit genutzt wird. Mit wenigen Klicks können Sie Zahlungen per Banküberweisung, Kreditkarte oder PayPal-Guthaben durchführen. + +### Bitcoin +[Bitcoin](https://www.mollie.com/en/payments/bitcoin) ist eine Art virtuelles Geld. Der Wechselkurs wird zum Zeitpunkt der Transaktion bestimmt, der Betrag und die Zahlung sind also garantiert. + +### paysafecard +[paysafecard](https://www.mollie.com/en/payments/paysafecard) ist die beliebteste Prepaid-Karte für Online-Zahlungen. Mit paysafecard können Sie Prepaid-Zahlungen aus 43 Ländern empfangen. + +### KBC/CBC-Zahlungsschaltfläche +Die [KBC / CBC-Zahlungsschaltfläche](https://www.mollie.com/en/payments/kbc-cbc) ist eine Online-Zahlungsmethode für KBC und CBC-Kunden, gemeinsam die größte Bank Belgiens. + +KBC konzentriert sich auf Flandern, CBC auf die Wallonie. + +### Belfius-Zahlungsschaltfläche +[Belfius](https://www.mollie.com/en/payments/belfius) ist eine der größten Banken Belgiens. Durch die Einführung der Belfius-Zahlungsschaltfläche bietet die Bank ihren Kunden ihre eigene Zahlungslösung. + +### CartaSi +[CartaSi](https://www.mollie.com/en/payments/cartasi) ist eine der am weitesten verbreiteten Zahlungsmethoden Italiens. + +Es sind über 13 Millionen CartaSi-Karten im Umlauf. + +### Cartes Bancaires +[Cartes Bancaires](https://www.mollie.com/en/payments/cartes-bancaires) sind die am häufigsten verwendeten Kreditkarten Frankreichs, es sind mehr als 64 Millionen Karten im Umlauf. + +Die Karten tragen ebenfalls das Markenzeichen von Visa. + +### EPS +[EPS](https://www.mollie.com/de/payments/eps). Electronic Payment Standard (EPS) ist eine von mehreren österreichischen Banken gemeinsam entwickelte Zahlungsmethode. + +Dies macht sie zur wichtigsten Zahlungsmethode in Österreich, die bei österreichischen Konsumenten hohe Beliebtheit genießt. + +### Giropay +[Giropay](https://www.mollie.com/de/payments/giropay). Giropay ist eine der beliebtesten Überweisungsmethoden Deutschlands. + +Deutsche Kunden schenken dieser Zahlungsmethode ihr Vertrauen, da sie von über 1.500 Banken landesweit unterstützt wird. + +### Klarna: Rechnung +[Klarna: Rechnung](https://www.mollie.com/de/payments/klarna-pay-later). Klarna ist eine flexible Zahlungslösung, die Ihren Kunden verschiedene, flexible Zahlungsmöglichkeiten zur Verfügung stellt. + +Der Empfang von Zahlungen durch Klarna: Rechnung dauert nur wenige Minuten und ist mit keinen zusätzlichen Gebühren verbunden. + +### Klarna: Ratenkauf +[Klarna: Ratenkauf](https://www.mollie.com/de/payments/klarna-slice-it). Klarna ist eine flexible Zahlungslösung, die Ihren Kunden verschiedene, flexible Zahlungsmöglichkeiten zur Verfügung stellt. + +Der Empfang von Zahlungen durch Klarna: Ratenkauf dauert nur wenige Minuten und ist mit keinen zusätzlichen Gebühren verbunden. + +# Häufig gestellte Fragen # + +**Das Modul kann in PrestaShop 1.7 nicht installiert werden.** + +* Gehen Sie über FTP in das Root-Verzeichnis Ihrer Website und öffnen Sie den Ordner 'modules'. +* Löschen Sie den Ordner 'mollie'. +* Installieren Sie das Mollie-Modul für PrestaShop 1.7 neu. + +**Ich habe das Modul installiert, aber das Modul erscheint während des Checkouts nicht.** + +* Prüfen Sie, ob das Modul eingeschaltet ist und ob der korrekte API-Schlüssel gesetzt ist. Lesen Sie die Installationsanweisungen. +* Prüfen Sie, ob als Währung in Ihrem Shop Euro eingestellt sind. Mollie unterstützt nur Euro. +* Prüfen Sie über "Advanced parameters" -> "Performance", ob "Minimize HTML" deaktiviert ist. + +**Muss ich auch eine Rückgabe- oder Webhook-URL setzen?** + +Es ist nicht notwendig, eine Weiterleitungs-URL oder einen Webhook zu setzen. Das Modul erledigt dies bei jeder Bestellung automatisch. + +**Nach einer erfolgreichen Zahlung sehen meine Kunden den Bestellverlauf statt der Bestellbestätigung.** + +Dies ist ein Fehler in PrestaShop, der mit der Version 1.6.0.7. behoben wurde. Um dieses Problem zu lösen, sollten Sie Ihre PrestaShop-Version aktualisieren. Wenn Sie dies nicht wünschen, können Sie den Fehler auch selbst beheben, indem Sie eine Codezeile anpassen. + +Der entsprechende [GitHub-Issue](https://github.com/mollie/Prestashop/issues/3) beschreibt genau, wie dies geht. + +**Der Bestellstatus wird nicht aktualisiert** + +Wenn sich der Status der Zahlung ändert, schickt Mollie eine Nachricht an Ihre Website. Es ist möglich, dass Mollie Ihre Website nicht erreichen konnte, oder dass Ihre Website den Status nicht verarbeiten konnte. + +* Prüfen Sie Ihr [Mollie-Management ](https://www.mollie.com/beheer/) auf fehlgeschlagene Berichte. +* Prüfen Sie, ob Ihre Website im 'Wartungsmodus' läuft. Mollie kann Ihre Website nicht erreichen, wenn diese im Wartungsmodus läuft und Sie Mollie 2.0 oder niedriger verwenden. +Ab Version 2.0.0. funktioniert das Mollie-Modul im Wartungsmodus. +* Etwas funktioniert bei der Erstellung einer Rechnung nicht. Prüfen Sie, ob die Option "Enable image for product" ausgeschaltet ist in "Orders" -> "Invoices" -> "Invoice options" (ab PrestaShop 1.6.1.0) oder in "Preferences" -> "Orders" -> "PDF settings" (in PrestaShop 1.6.0.12 bis 1.6.0.14). + +# Möchten Sie dabei helfen, dieses Modul zu verbessern? # + +Möchten Sie mithelfen, dieses Modul für PrestaShop noch besser zu machen? Wir sind jederzeit offen für [Pull-Requests](https://github.com/mollie/Prestashop/pulls?utf8=%E2%9C%93&q=is%3Apr). + +Und was halten Sie davon, für ein [technologie-betriebenes Unternehmen](https://jobs.mollie.com/) zu arbeiten? Mollie sucht immer nach Entwicklern und Systemingenieuren. [Werfen Sie einen Blick auf unsere offenen Stellen](https://jobs.mollie.com/) oder [sprechen Sie uns an](mailto:personeel@mollie.com). + +# Lizenz # +[BSD (Berkeley Software Distribution)-Lizenz](http://www.opensource.org/licenses/bsd-license.php). +Copyright (c) 2013-2019, Mollie B.V. + +# Support # + +Haben Sie Probleme bei der Installation, oder denken Sie, dass das Modul einen Bug enthält? Senden Sie eine E-Mail +an info@mollie.com mit einer genauen Beschreibung des Problems. diff --git a/composer.json b/composer.json index 9f380fbb8..4479f5fe9 100644 --- a/composer.json +++ b/composer.json @@ -1,33 +1,33 @@ -{ - "name": "mollie/prestashop", - "license": "BSD-2.0", - "description": "Mollie module for PrestaShop", - "require": { - "ext-curl": "*", - "ext-json": "*", - "ext-simplexml": "*", - "symfony/polyfill-mbstring": "^1.9", - "symfony/dependency-injection": "^3.4", - "symfony/config": "^3.4", - "symfony/expression-language": "^3.4", - "symfony/yaml": "^3.4", - "prestashop/decimal": "^1.3", - "mollie/mollie-api-php": "^2.17" - }, - "autoload": { - "psr-4": { - "Mollie\\": "src/" - }, - "classmap": [ - "vendor/", - "controllers/", - "src/Entity" - ] - }, - "config": { - "platform": { - "php": "5.6" - } - }, - "type": "prestashop-module" -} +{ + "name": "mollie/prestashop", + "license": "BSD-2.0", + "description": "Mollie module for PrestaShop", + "require": { + "ext-curl": "*", + "ext-json": "*", + "ext-simplexml": "*", + "symfony/polyfill-mbstring": "^1.9", + "symfony/dependency-injection": "^3.4", + "symfony/config": "^3.4", + "symfony/expression-language": "^3.4", + "symfony/yaml": "^3.4", + "prestashop/decimal": "^1.3", + "mollie/mollie-api-php": "^2.17" + }, + "autoload": { + "psr-4": { + "Mollie\\": "src/" + }, + "classmap": [ + "vendor/", + "controllers/", + "src/Entity" + ] + }, + "config": { + "platform": { + "php": "5.6" + } + }, + "type": "prestashop-module" +} diff --git a/config.xml b/config.xml index 6f1b26c83..79a93fdca 100644 --- a/config.xml +++ b/config.xml @@ -2,7 +2,7 @@ mollie - + diff --git a/config/builder.yml b/config/builder.yml index e809de93f..ef25ba2e2 100644 --- a/config/builder.yml +++ b/config/builder.yml @@ -1,12 +1,12 @@ -services: - Mollie\Builder\FormBuilder: - arguments: - - '@mollie' - - '@Mollie\Service\ApiService' - - '@Mollie\Service\CountryService' - - '@Mollie\Repository\CountryRepository' - - '@Mollie\Service\ConfigFieldService' - - '@Mollie\Service\MolCarrierInformationService' - - '@language' - - '@smarty' +services: + Mollie\Builder\FormBuilder: + arguments: + - '@mollie' + - '@Mollie\Service\ApiService' + - '@Mollie\Service\CountryService' + - '@Mollie\Repository\CountryRepository' + - '@Mollie\Service\ConfigFieldService' + - '@Mollie\Service\MolCarrierInformationService' + - '@language' + - '@smarty' - '@link' \ No newline at end of file diff --git a/config/context.yml b/config/context.yml index a47c7ef1a..3389ba0b5 100644 --- a/config/context.yml +++ b/config/context.yml @@ -1,32 +1,32 @@ -services: - context: - class: 'Context' - factory: ['Mollie\Factory\ContextFactory', 'getContext'] - - controller: - class: 'Controller' - factory: ['Mollie\Factory\ContextFactory', 'getController'] - - cookie: - class: 'Cookie' - factory: ['Mollie\Factory\ContextFactory', 'getCookie'] - - language: - class: 'Language' - factory: ['Mollie\Factory\ContextFactory', 'getLanguage'] - - currency: - class: 'Currency' - factory: ['Mollie\Factory\ContextFactory', 'getCurrency'] - - smarty: - class: 'Smarty' - factory: ['Mollie\Factory\ContextFactory', 'getSmarty'] - - shop: - class: 'Shop' - factory: ['Mollie\Factory\ContextFactory', 'getShop'] - - link: - class: 'Shop' +services: + context: + class: 'Context' + factory: ['Mollie\Factory\ContextFactory', 'getContext'] + + controller: + class: 'Controller' + factory: ['Mollie\Factory\ContextFactory', 'getController'] + + cookie: + class: 'Cookie' + factory: ['Mollie\Factory\ContextFactory', 'getCookie'] + + language: + class: 'Language' + factory: ['Mollie\Factory\ContextFactory', 'getLanguage'] + + currency: + class: 'Currency' + factory: ['Mollie\Factory\ContextFactory', 'getCurrency'] + + smarty: + class: 'Smarty' + factory: ['Mollie\Factory\ContextFactory', 'getSmarty'] + + shop: + class: 'Shop' + factory: ['Mollie\Factory\ContextFactory', 'getShop'] + + link: + class: 'Shop' factory: ['Mollie\Factory\ContextFactory', 'getLink'] \ No newline at end of file diff --git a/config/index.php b/config/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/config/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/config/repository.yml b/config/repository.yml index acd1b6e0e..e3b7afe23 100644 --- a/config/repository.yml +++ b/config/repository.yml @@ -1,14 +1,14 @@ -services: - Mollie\Repository\PaymentMethodRepository: - - Mollie\Repository\OrderFeeRepository: - - Mollie\Repository\CountryRepository: - - Mollie\Repository\OrderShipmentRepository: - - Mollie\Repository\MethodCountryRepository: - - Mollie\Repository\MolCarrierInformationRepository: - - Mollie\Repository\ModuleRepository: +services: + Mollie\Repository\PaymentMethodRepository: + + Mollie\Repository\OrderFeeRepository: + + Mollie\Repository\CountryRepository: + + Mollie\Repository\OrderShipmentRepository: + + Mollie\Repository\MethodCountryRepository: + + Mollie\Repository\MolCarrierInformationRepository: + + Mollie\Repository\ModuleRepository: diff --git a/config/service.yml b/config/service.yml index 007e53445..6db5d45e2 100644 --- a/config/service.yml +++ b/config/service.yml @@ -1,85 +1,83 @@ -services: - Mollie\Service\OrderFeeService: - - Mollie\Service\PaymentMethodService: - arguments: - - '@mollie' - - '@Mollie\Repository\PaymentMethodRepository' - - '@Mollie\Repository\MethodCountryRepository' - - '@Mollie\Service\CartLinesService' - - Mollie\Service\ApiService: - arguments: - - '@Mollie\Repository\PaymentMethodRepository' - - '@Mollie\Repository\CountryRepository' - - Mollie\Service\ConfigFieldService: - arguments: - - '@mollie' - - '@Mollie\Service\ApiService' - - '@Mollie\Repository\CountryRepository' - - Mollie\Service\UrlPathService: - arguments: - - '@mollie' - - Mollie\Service\IssuerService: - arguments: - - '@mollie' - - '@Mollie\Repository\PaymentMethodRepository' - - Mollie\Service\RefundService: - arguments: - - '@mollie' - - Mollie\Service\ShipService: - arguments: - - '@mollie' - - Mollie\Service\CancelService: - arguments: - - '@mollie' - - Mollie\Service\CarrierService: - - Mollie\Service\OrderStatusService: - - Mollie\Service\CountryService: - arguments: - - '@mollie' - - Mollie\Service\SettingsSaveService: - arguments: - - '@mollie' - - '@Mollie\Repository\CountryRepository' - - '@Mollie\Repository\PaymentMethodRepository' - - '@Mollie\Service\PaymentMethodService' - - '@Mollie\Service\ApiService' - - '@Mollie\Service\MolCarrierInformationService' - - Mollie\Service\ShipmentService: - arguments: - - '@Mollie\Repository\OrderShipmentRepository' - - '@Mollie\Repository\MolCarrierInformationRepository' - - Mollie\Service\CartLinesService: - arguments: - - '@mollie' - - Mollie\Service\MollieOrderInfoService: - arguments: - - '@mollie' - - '@Mollie\Repository\PaymentMethodRepository' - - '@Mollie\Service\RefundService' - - '@Mollie\Service\ShipService' - - '@Mollie\Service\CancelService' - - '@Mollie\Service\ShipmentService' - - '@Mollie\Service\ApiService' - - Mollie\Service\MolCarrierInformationService: - arguments: - - '@Mollie\Repository\MolCarrierInformationRepository' - - Mollie\Service\LanguageService: - arguments: +services: + Mollie\Service\OrderFeeService: + + Mollie\Service\PaymentMethodService: + arguments: + - '@mollie' + - '@Mollie\Repository\PaymentMethodRepository' + - '@Mollie\Repository\MethodCountryRepository' + - '@Mollie\Service\CartLinesService' + + Mollie\Service\ApiService: + arguments: + - '@Mollie\Repository\PaymentMethodRepository' + - '@Mollie\Repository\CountryRepository' + + Mollie\Service\ConfigFieldService: + arguments: + - '@mollie' + - '@Mollie\Service\ApiService' + - '@Mollie\Repository\CountryRepository' + + Mollie\Service\UrlPathService: + arguments: + - '@mollie' + + Mollie\Service\IssuerService: + arguments: + - '@mollie' + - '@Mollie\Repository\PaymentMethodRepository' + + Mollie\Service\RefundService: + arguments: + - '@mollie' + + Mollie\Service\ShipService: + arguments: + - '@mollie' + + Mollie\Service\CancelService: + arguments: + - '@mollie' + + Mollie\Service\OrderStatusService: + + Mollie\Service\CountryService: + arguments: + - '@mollie' + + Mollie\Service\SettingsSaveService: + arguments: + - '@mollie' + - '@Mollie\Repository\CountryRepository' + - '@Mollie\Repository\PaymentMethodRepository' + - '@Mollie\Service\PaymentMethodService' + - '@Mollie\Service\ApiService' + - '@Mollie\Service\MolCarrierInformationService' + + Mollie\Service\ShipmentService: + arguments: + - '@Mollie\Repository\OrderShipmentRepository' + - '@Mollie\Repository\MolCarrierInformationRepository' + + Mollie\Service\CartLinesService: + arguments: + - '@mollie' + + Mollie\Service\MollieOrderInfoService: + arguments: + - '@mollie' + - '@Mollie\Repository\PaymentMethodRepository' + - '@Mollie\Service\RefundService' + - '@Mollie\Service\ShipService' + - '@Mollie\Service\CancelService' + - '@Mollie\Service\ShipmentService' + - '@Mollie\Service\ApiService' + + Mollie\Service\MolCarrierInformationService: + arguments: + - '@Mollie\Repository\MolCarrierInformationRepository' + + Mollie\Service\LanguageService: + arguments: - '@mollie' \ No newline at end of file diff --git a/controllers/front/ajax.php b/controllers/front/ajax.php index 24ceb5a53..89b3035c2 100644 --- a/controllers/front/ajax.php +++ b/controllers/front/ajax.php @@ -1,7 +1,4 @@ module->getContainer(\Mollie\Repository\PaymentMethodRepository::class); - /** @var \Mollie\Service\PaymentMethodService $paymentMethodService */ - $paymentMethodService = $this->module->getContainer(\Mollie\Service\PaymentMethodService::class); + /** @var PaymentMethodRepository $paymentMethodRepo */ + $paymentMethodRepo = $this->module->getContainer(PaymentMethodRepository::class); + /** @var PaymentMethodService $paymentMethodService */ + $paymentMethodService = $this->module->getContainer(PaymentMethodService::class); $paymentMethodId = $paymentMethodRepo->getPaymentMethodIdByMethodId($method); $paymentMethodObj = new MolPaymentMethod($paymentMethodId); @@ -345,8 +349,8 @@ private function createOrder($method, $apiPayment, $cartId, $originalAmount, $se '{bankwire_address}' => $address, ]; } - /** @var \Mollie\Repository\PaymentMethodRepository $paymentMethodRepo */ - $paymentMethodRepo = $this->module->getContainer(\Mollie\Repository\PaymentMethodRepository::class); + /** @var PaymentMethodRepository $paymentMethodRepo */ + $paymentMethodRepo = $this->module->getContainer(PaymentMethodRepository::class); $orderFee = PaymentFeeUtility::getPaymentFee( new MolPaymentMethod($paymentMethodRepo->getPaymentMethodIdByMethodId($apiPayment->method)), diff --git a/controllers/front/qrcode.php b/controllers/front/qrcode.php index cd5a610e7..7eb9f57c2 100644 --- a/controllers/front/qrcode.php +++ b/controllers/front/qrcode.php @@ -39,7 +39,10 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Types\PaymentMethod; use _PhpScoper5ea00cc67502b\Mollie\Api\Types\PaymentStatus; use Mollie\Repository\PaymentMethodRepository; +use Mollie\Service\ApiService; +use Mollie\Service\PaymentMethodService; use Mollie\Utility\EnvironmentUtility; +use PrestaShop\PrestaShop\Adapter\CoreException; if (!defined('_PS_VERSION_')) { exit; @@ -142,10 +145,10 @@ protected function processNewQrCode() } /** @var PaymentMethodRepository $paymentMethodRepo */ $paymentMethodRepo = $this->module->getContainer(PaymentMethodRepository::class); - /** @var \Mollie\Service\ApiService $apiService */ - $apiService = $this->module->getContainer(\Mollie\Service\ApiService::class); - /** @var \Mollie\Service\PaymentMethodService $paymentMethodService */ - $paymentMethodService = $this->module->getContainer(\Mollie\Service\PaymentMethodService::class); + /** @var ApiService $apiService */ + $apiService = $this->module->getContainer(ApiService::class); + /** @var PaymentMethodService $paymentMethodService */ + $paymentMethodService = $this->module->getContainer(PaymentMethodService::class); $orderTotal = $cart->getOrderTotal(true); $paymentMethodId = $paymentMethodRepo->getPaymentMethodIdByMethodId(PaymentMethod::IDEAL); @@ -194,7 +197,7 @@ protected function processNewQrCode() * * @throws PrestaShopException * @throws Adapter_Exception - * @throws \PrestaShop\PrestaShop\Adapter\CoreException + * @throws CoreException * @throws SmartyException */ protected function processGetStatus() diff --git a/controllers/front/return.php b/controllers/front/return.php index d719369c8..295b40869 100644 --- a/controllers/front/return.php +++ b/controllers/front/return.php @@ -37,6 +37,7 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Types\PaymentStatus; use Mollie\Repository\PaymentMethodRepository; use Mollie\Service\OrderStatusService; +use PrestaShop\PrestaShop\Adapter\CoreException; if (!defined('_PS_VERSION_')) { exit; @@ -66,7 +67,7 @@ class MollieReturnModuleFrontController extends ModuleFrontController * Unset the cart id from cookie if the order exists * * @throws PrestaShopException - * @throws \PrestaShop\PrestaShop\Adapter\CoreException + * @throws CoreException */ public function init() { @@ -89,7 +90,7 @@ public function init() * @throws PrestaShopException * @throws Adapter_Exception * @throws SmartyException - * @throws \PrestaShop\PrestaShop\Adapter\CoreException + * @throws CoreException */ public function initContent() { @@ -215,7 +216,7 @@ protected function processAjax() * * @throws PrestaShopException * @throws Adapter_Exception - * @throws \PrestaShop\PrestaShop\Adapter\CoreException + * @throws CoreException * @throws SmartyException * * @since 3.3.2 @@ -363,8 +364,8 @@ protected function savePaymentStatus($transactionId, $status, $orderId) '`transaction_id` = \''.pSQL($transactionId).'\'' ); } catch (Exception $e) { - /** @var \Mollie\Repository\PaymentMethodRepository $paymentMethodRepo */ - $paymentMethodRepo = $this->module->getContainer(\Mollie\Repository\PaymentMethodRepository::class); + /** @var PaymentMethodRepository $paymentMethodRepo */ + $paymentMethodRepo = $this->module->getContainer(PaymentMethodRepository::class); $paymentMethodRepo->tryAddOrderReferenceColumn(); throw $e; } diff --git a/controllers/front/webhook.php b/controllers/front/webhook.php index 988e1dcb6..4bfef4d3f 100644 --- a/controllers/front/webhook.php +++ b/controllers/front/webhook.php @@ -43,6 +43,7 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Types\RefundStatus; use Mollie\Repository\PaymentMethodRepository; use Mollie\Service\OrderStatusService; +use PrestaShop\PrestaShop\Adapter\CoreException; if (!defined('_PS_VERSION_')) { exit; @@ -80,7 +81,7 @@ protected function displayMaintenancePage() * @throws PrestaShopDatabaseException * @throws PrestaShopException * @throws SmartyException - * @throws \PrestaShop\PrestaShop\Adapter\CoreException + * @throws CoreException * @throws ApiException */ public function initContent() @@ -99,7 +100,7 @@ public function initContent() * @throws PrestaShopDatabaseException * @throws PrestaShopException * @throws SmartyException - * @throws \PrestaShop\PrestaShop\Adapter\CoreException + * @throws CoreException * @throws ApiException */ protected function executeWebhook() @@ -132,7 +133,7 @@ protected function executeWebhook() * * @throws PrestaShopDatabaseException * @throws PrestaShopException - * @throws \PrestaShop\PrestaShop\Adapter\CoreException + * @throws CoreException * @throws ApiException * @since 3.3.0 * @since 3.3.2 Returns the ApiPayment / ApiOrder instead of OK string, NOT OK/NO ID stays the same @@ -342,8 +343,8 @@ protected function savePaymentStatus($transactionId, $status, $orderId) '`transaction_id` = \''.pSQL($transactionId).'\'' ); } catch (PrestaShopDatabaseException $e) { - /** @var \Mollie\Repository\PaymentMethodRepository $paymentMethodRepo */ - $paymentMethodRepo = $this->module->getContainer(\Mollie\Repository\PaymentMethodRepository::class); + /** @var PaymentMethodRepository $paymentMethodRepo */ + $paymentMethodRepo = $this->module->getContainer(PaymentMethodRepository::class); $paymentMethodRepo->tryAddOrderReferenceColumn(); throw $e; } @@ -360,7 +361,7 @@ protected function savePaymentStatus($transactionId, $status, $orderId) * @throws Adapter_Exception * @throws PrestaShopDatabaseException * @throws PrestaShopException - * @throws \PrestaShop\PrestaShop\Adapter\CoreException + * @throws CoreException */ protected function setCountryContextIfNotSet($payment) { diff --git a/mollie.php b/mollie.php index be5a65493..33dca068e 100644 --- a/mollie.php +++ b/mollie.php @@ -74,7 +74,7 @@ public function __construct() { $this->name = 'mollie'; $this->tab = 'payments_gateways'; - $this->version = '4.0.0'; + $this->version = '4.0.1'; $this->author = 'Mollie B.V.'; $this->need_instance = 1; $this->bootstrap = true; @@ -260,15 +260,6 @@ public function getContent() 'publicPath' => __PS_BASE_URI__ . 'modules/' . basename(__FILE__, '.php') . '/views/js/dist/', ]); - $updateMessage = ''; - if (!static::ADDONS) { - $updateMessage = defined('_TB_VERSION_') - ? $this->getUpdateMessage('https://github.com/mollie/thirtybees') - : $this->getUpdateMessage('https://github.com/mollie/PrestaShop'); - if ($updateMessage === 'updateAvailable') { - $updateMessage = $this->display(__FILE__, 'views/templates/admin/download_update.tpl'); - } - } $resultMessage = ''; $warningMessage = ''; @@ -287,7 +278,6 @@ public function getContent() /** @var Mollie\Service\LanguageService $langService */ $langService = $this->getContainer(Mollie\Service\LanguageService::class); $data = [ - 'update_message' => $updateMessage, 'title_status' => $this->l('%s statuses:'), 'title_visual' => $this->l('Visual settings:'), 'title_debug' => $this->l('Debug info:'), @@ -323,7 +313,6 @@ public function getContent() $this->context->smarty->assign($data); $html = ''; -// $html .= $updateMessage; $html .= $this->display(__FILE__, 'views/templates/admin/logo.tpl'); @@ -958,22 +947,6 @@ public function displayAjaxMollieMethodConfig() ]; } - /** - * @return array - * @throws PrestaShopException - * - * @since 3.3.0 - */ - public function displayAjaxMollieCarrierConfig() - { - header('Content-Type: application/json;charset=UTF-8'); - /** @var \Mollie\Service\CarrierService $carrierService */ - $carrierService = $this->getContainer(\Mollie\Service\CarrierService::class); - $dbConfig = @json_decode(Configuration::get(Mollie\Config\Config::MOLLIE_TRACKING_URLS), true); - - return ['success' => true, 'carriers' => $carrierService->carrierConfig($dbConfig)]; - } - /** * @return array * @throws Adapter_Exception diff --git a/src/Builder/FormBuilder.php b/src/Builder/FormBuilder.php index 7e19c4bea..e315dd277 100644 --- a/src/Builder/FormBuilder.php +++ b/src/Builder/FormBuilder.php @@ -1,573 +1,610 @@ -module = $module; - $this->apiService = $apiService; - $this->countryService = $countryService; - $this->lang = $lang; - $this->smarty = $smarty; - $this->link = $link; - $this->countryRepository = $countryRepository; - $this->configFieldService = $configFieldService; - $this->carrierInformationService = $carrierInformationService; - } - - public function buildSettingsForm() - { - $isApiKeyProvided = Configuration::get(Config::MOLLIE_API_KEY); - - $inputs = $this->getAccountSettingsSection($isApiKeyProvided); - - if ($isApiKeyProvided) { - $inputs = array_merge($inputs, $this->getAdvancedSettingsSection()); - } - - $fields = [ - 'form' => [ - 'tabs' => $this->getSettingTabs($isApiKeyProvided), - 'input' => $inputs, - 'submit' => [ - 'title' => $this->module->l('Save'), - 'class' => 'btn btn-default pull-right', - ], - ], - ]; - - $helper = new HelperForm(); - - $helper->show_toolbar = false; - $helper->table = $this->module->getTable(); - $helper->module = $this->module; - $helper->default_form_language = $this->module->getContext()->language->id; - $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG', 0); - - $helper->identifier = $this->module->getIdentifier(); - $helper->submit_action = 'submitmollie'; - $helper->currentIndex = $this->module->getContext()->link->getAdminLink('AdminModules', false) - . "&configure={$this->module->name}&tab_module={$this->module->tab}&module_name={$this->module->name}"; - $helper->token = Tools::getAdminTokenLite('AdminModules'); - - $helper->tpl_vars = [ - 'fields_value' => $this->configFieldService->getConfigFieldsValues(), - 'languages' => $this->module->getContext()->controller->getLanguages(), - 'id_language' => $this->module->getContext()->language->id, - ]; - - return $helper->generateForm([$fields]); - } - - protected function getAccountSettingsSection($isApiKeyProvided) - { - $generalSettings = 'general_settings'; - if ($isApiKeyProvided) { - $input = [ - [ - 'type' => 'text', - 'label' => $this->module->l('API Key'), - 'tab' => $generalSettings, - 'desc' => \Mollie\Utility\TagsUtility::ppTags( - $this->module->l('You can find your API key in your [1]Mollie Profile[/1]; it starts with test or live.'), - [$this->module->display($this->module->getPathUri(), 'views/templates/admin/profile.tpl')] - ), - 'name' => Config::MOLLIE_API_KEY, - 'required' => true, - 'class' => 'fixed-width-xxl', - ] - ]; - } else { - $input = [ - [ - 'type' => 'mollie-switch', - 'label' => $this->module->l('Do you already have a Mollie account?'), - 'name' => Config::MOLLIE_ACCOUNT_SWITCH, - 'tab' => $generalSettings, - 'is_bool' => true, - 'values' => [ - [ - 'id' => 'active_on', - 'value' => true, - 'label' => \Translate::getAdminTranslation('Enabled', 'AdminCarriers'), - ], - [ - 'id' => 'active_off', - 'value' => false, - 'label' => \Translate::getAdminTranslation('Disabled', 'AdminCarriers'), - ], - ], - 'desc' => $this->module->display( - $this->module->getPathUri() , 'views/templates/admin/create_new_account_link.tpl' - ), - ], - [ - 'type' => 'text', - 'label' => $this->module->l('API Key'), - 'tab' => $generalSettings, - 'desc' => \Mollie\Utility\TagsUtility::ppTags( - $this->module->l('You can find your API key in your [1]Mollie Profile[/1]; it starts with test or live.'), - [$this->module->display($this->module->getPathUri(), 'views/templates/admin/profile.tpl')] - ), - 'name' => Config::MOLLIE_API_KEY, - 'required' => true, - 'class' => 'fixed-width-xxl', - ] - ]; - } - if ($isApiKeyProvided) { - $input[] = [ - 'type' => 'switch', - 'label' => $this->module->l('Use IFrame for credit card'), - 'tab' => $generalSettings, - 'name' => Config::MOLLIE_IFRAME, - 'is_bool' => true, - 'values' => [ - [ - 'id' => 'active_on', - 'value' => true, - 'label' => \Translate::getAdminTranslation('Enabled', 'AdminCarriers'), - ], - [ - 'id' => 'active_off', - 'value' => false, - 'label' => \Translate::getAdminTranslation('Disabled', 'AdminCarriers'), - ], - ], - ]; - - $input[] = [ - 'type' => 'text', - 'label' => $this->module->l('Profile ID'), - 'tab' => $generalSettings, - 'desc' => \Mollie\Utility\TagsUtility::ppTags( - $this->module->l('You can find your API key in your [1]Mollie Profile[/1];'), - [$this->module->display($this->module->getPathUri(), 'views/templates/admin/profile.tpl')] - ), - 'name' => Config::MOLLIE_PROFILE_ID, - 'required' => true, - 'class' => 'fixed-width-xxl', - ]; - - $input = array_merge($input, [ - [ - 'type' => 'mollie-h3', - 'tab' => $generalSettings, - 'name' => '', - 'title' => $this->module->l('Orders API'), - ], - [ - 'type' => 'select', - 'label' => $this->module->l('Issuer list'), - 'tab' => $generalSettings, - 'desc' => $this->module->l('Some payment methods (eg. iDEAL) have an issuer list. This setting specifies where it is shown.'), - 'name' => Config::MOLLIE_ISSUERS, - 'options' => [ - 'query' => [ - [ - 'id' => Config::ISSUERS_ON_CLICK, - 'name' => $this->module->l('On click'), - ], - [ - 'id' => Config::ISSUERS_PAYMENT_PAGE, - 'name' => $this->module->l('Payment page'), - ], - ], - 'id' => 'id', - 'name' => 'name', - ], - ], - ] - ); - $input[] = [ - 'type' => 'mollie-h2', - 'tab' => $generalSettings, - 'name' => '', - 'title' => $this->module->l('Payment methods'), - ]; - - $input[] = [ - 'type' => 'mollie-methods', - 'name' => Config::METHODS_CONFIG, - 'paymentMethods' => $this->apiService->getMethodsForConfig($this->module->api, $this->module->getPathUri()), - 'countries' => $this->countryService->getActiveCountriesList(), - 'tab' => $generalSettings, - 'displayErrors' => Configuration::get(Mollie\Config\Config::MOLLIE_DISPLAY_ERRORS), - ]; - } - - return $input; - } - - protected function getAdvancedSettingsSection() - { - $advancedSettings = 'advanced_settings'; - $input = []; - $orderStatuses = []; - $orderStatuses = array_merge($orderStatuses, OrderState::getOrderStates($this->lang->id)); - $input[] = [ - 'type' => 'select', - 'label' => $this->module->l('Send locale for payment screen'), - 'tab' => $advancedSettings, - 'desc' => \Mollie\Utility\TagsUtility::ppTags( - $this->module->l('Should the plugin send the current webshop [1]locale[/1] to Mollie. Mollie payment screens will be in the same language as your webshop. Mollie can also detect the language based on the user\'s browser language.'), - [$this->module->display($this->module->getPathUri(), 'views/templates/admin/locale_wiki.tpl')] - ), - 'name' => Config::MOLLIE_PAYMENTSCREEN_LOCALE, - 'options' => [ - 'query' => [ - [ - 'id' => Config::PAYMENTSCREEN_LOCALE_BROWSER_LOCALE, - 'name' => $this->module->l('Do not send locale using browser language'), - ], - [ - 'id' => Config::PAYMENTSCREEN_LOCALE_SEND_WEBSITE_LOCALE, - 'name' => $this->module->l('Send locale for payment screen'), - ], - ], - 'id' => 'id', - 'name' => 'name', - ], - ]; - - $messageStatus = $this->module->l('Status for %s payments'); - $descriptionStatus = $this->module->l('`%s` payments get status `%s`'); - $messageMail = $this->module->l('Send mails when %s'); - $descriptionMail = $this->module->l('Send mails when transaction status becomes %s?'); - $allStatuses = array_merge([['id_order_state' => 0, 'name' => $this->module->l('Skip this status'), 'color' => '#565656']], OrderState::getOrderStates($this->lang->id)); - $statuses = []; - foreach (Config::getStatuses() as $name => $val) { - if ($name === PaymentStatus::STATUS_AUTHORIZED) { - continue; - } - - $val = (int)$val; - if ($val) { - $orderStatus = new OrderState($val); - $statusName = $orderStatus->getFieldByLang('name', $this->lang->id); - $desc = Tools::strtolower( - sprintf( - $descriptionStatus, - $this->module->lang($name), - $statusName - ) - ); - } else { - $desc = sprintf($this->module->l('`%s` payments do not get a status'), $this->module->lang($name)); - } - $statuses[] = [ - 'name' => $name, - 'key' => @constant('Mollie\Config\Config::MOLLIE_STATUS_' . Tools::strtoupper($name)), - 'value' => $val, - 'description' => $desc, - 'message' => sprintf($messageStatus, $this->module->lang($name)), - 'key_mail' => @constant('Mollie\Config\Config::MOLLIE_MAIL_WHEN_' . Tools::strtoupper($name)), - 'value_mail' => Configuration::get('MOLLIE_MAIL_WHEN_' . Tools::strtoupper($name)), - 'description_mail' => sprintf($descriptionMail, $this->module->lang($name)), - 'message_mail' => sprintf($messageMail, $this->module->lang($name)), - ]; - } - $input[] = [ - 'type' => 'mollie-h2', - 'name' => '', - 'tab' => $advancedSettings, - 'title' => $this->module->l('Order statuses'), - ]; - - foreach (array_filter($statuses, function ($status) { - return in_array($status['name'], [ - PaymentStatus::STATUS_PAID, - PaymentStatus::STATUS_AUTHORIZED, - PaymentStatus::STATUS_CANCELED, - PaymentStatus::STATUS_EXPIRED, - RefundStatus::STATUS_REFUNDED, - PaymentStatus::STATUS_OPEN, - \Mollie\Config\Config::PARTIAL_REFUND_CODE, - ]); - }) as $status) { - if (!in_array($status['name'], ['paid', \Mollie\Config\Config::PARTIAL_REFUND_CODE])) { - $input[] = [ - 'type' => 'switch', - 'label' => $status['message_mail'], - 'tab' => $advancedSettings, - 'name' => $status['key_mail'], - 'is_bool' => true, - 'values' => [ - [ - 'id' => 'active_on', - 'value' => true, - 'label' => \Translate::getAdminTranslation('Enabled', 'AdminCarriers'), - ], - [ - 'id' => 'active_off', - 'value' => false, - 'label' => \Translate::getAdminTranslation('Disabled', 'AdminCarriers'), - ], - ], - ]; - } - $input[] = [ - 'type' => 'select', - 'label' => $status['message'], - 'tab' => $advancedSettings, - 'desc' => $status['description'], - 'name' => $status['key'], - 'options' => [ - 'query' => $allStatuses, - 'id' => 'id_order_state', - 'name' => 'name', - ], - ]; - } - $input = array_merge($input, [ - [ - 'type' => 'mollie-h2', - 'name' => '', - 'tab' => $advancedSettings, - 'title' => $this->module->l('Visual Settings'), - ], - [ - 'type' => 'select', - 'label' => $this->module->l('Images'), - 'tab' => $advancedSettings, - 'desc' => $this->module->l('Show big, normal or no payment method logos on checkout.'), - 'name' => Config::MOLLIE_IMAGES, - 'options' => [ - 'query' => [ - [ - 'id' => Config::LOGOS_HIDE, - 'name' => $this->module->l('hide'), - ], - [ - 'id' => Config::LOGOS_NORMAL, - 'name' => $this->module->l('normal'), - ], - [ - 'id' => Config::LOGOS_BIG, - 'name' => $this->module->l('big'), - ], - ], - 'id' => 'id', - 'name' => 'name', - ], - ], - - [ - 'type' => 'text', - 'label' => $this->module->l('CSS file'), - 'tab' => $advancedSettings, - 'desc' => \Mollie\Utility\TagsUtility::ppTags( - $this->module->l('Leave empty for default stylesheet. Should include file path when set. Hint: You can use [1]{BASE}[/1], [1]{THEME}[/1], [1]{CSS}[/1], [1]{MOBILE}[/1], [1]{MOBILE_CSS}[/1] and [1]{OVERRIDE}[/1] for easy folder mapping.'), - [$this->module->display($this->module->getPathUri(), 'views/templates/front/kbd.tpl')] - ), - 'name' => Config::MOLLIE_CSS, - 'class' => 'long-text', - ], - ]); - $input[] = [ - 'type' => 'mollie-carriers', - 'label' => $this->module->l('Shipment information'), - 'tab' => $advancedSettings, - 'name' => Config::MOLLIE_TRACKING_URLS, - 'depends' => Config::MOLLIE_API, - 'depends_value' => Config::MOLLIE_ORDERS_API, - 'carriers' => $this->carrierInformationService->getAllCarriersInformation($this->lang->id) - ]; - $input[] = [ - 'type' => 'mollie-carrier-switch', - 'label' => $this->module->l('Automatically ship on marked statuses'), - 'tab' => $advancedSettings, - 'name' => Config::MOLLIE_AUTO_SHIP_MAIN, - 'desc' => $this->module->l('Enabling this feature will automatically send shipment information when an order gets marked status'), - 'is_bool' => true, - 'values' => [ - [ - 'id' => 'active_on', - 'value' => true, - 'label' => \Translate::getAdminTranslation('Enabled', 'AdminCarriers'), - ], - [ - 'id' => 'active_off', - 'value' => false, - 'label' => \Translate::getAdminTranslation('Disabled', 'AdminCarriers'), - ], - ], - 'depends' => Config::MOLLIE_API, - 'depends_value' => Config::MOLLIE_ORDERS_API, - ]; - $input[] = [ - 'type' => 'checkbox', - 'label' => $this->module->l('Automatically ship when one of these statuses is reached'), - 'tab' => $advancedSettings, - 'desc' => - $this->module->l('If an order reaches one of these statuses the module will automatically send shipment information'), - 'name' => Config::MOLLIE_AUTO_SHIP_STATUSES, - 'multiple' => true, - 'values' => [ - 'query' => $orderStatuses, - 'id' => 'id_order_state', - 'name' => 'name', - ], - 'expand' => (count($orderStatuses) > 10) ? [ - 'print_total' => count($orderStatuses), - 'default' => 'show', - 'show' => ['text' => $this->module->l('Show'), 'icon' => 'plus-sign-alt'], - 'hide' => ['text' => $this->module->l('Hide'), 'icon' => 'minus-sign-alt'], - ] : null, - 'depends' => Config::MOLLIE_API, - 'depends_value' => Config::MOLLIE_ORDERS_API, - ]; - $orderStatuses = [ - [ - 'name' => $this->module->l('Disable this status'), - 'id_order_state' => '0', - ], - ]; - $orderStatuses = array_merge($orderStatuses, OrderState::getOrderStates($this->lang->id)); - - for ($i = 0; $i < count($orderStatuses); $i++) { - $orderStatuses[$i]['name'] = $orderStatuses[$i]['id_order_state'] . ' - ' . $orderStatuses[$i]['name']; - } - - \Mollie\Utility\AssortUtility::aasort($orderStatuses, 'id_order_state'); - - $this->smarty->assign([ - 'logs' => $this->link->getAdminLink('AdminLogs') - ]); - $input = array_merge( - $input, - [ - [ - 'type' => 'mollie-h2', - 'name' => '', - 'title' => $this->module->l('Debug level'), - 'tab' => $advancedSettings, - ], - [ - 'type' => 'switch', - 'label' => $this->module->l('Display errors'), - 'tab' => $advancedSettings, - 'name' => Config::MOLLIE_DISPLAY_ERRORS, - 'desc' => $this->module->l('Enabling this feature will display error messages (if any) on the front page. Use for debug purposes only!'), - 'is_bool' => true, - 'values' => [ - [ - 'id' => 'active_on', - 'value' => true, - 'label' => \Translate::getAdminTranslation('Enabled', 'AdminCarriers'), - ], - [ - 'id' => 'active_off', - 'value' => false, - 'label' => \Translate::getAdminTranslation('Disabled', 'AdminCarriers'), - ], - ], - ], - [ - 'type' => 'select', - 'label' => $this->module->l('Log level'), - 'tab' => $advancedSettings, - 'desc' => \Mollie\Utility\TagsUtility::ppTags( - $this->module->l('Recommended level: Errors. Set to Everything to monitor incoming webhook requests. [1]View logs.[/1]'), - [ - $this->module->display($this->module->getPathUri(), 'views/templates/admin/view_logs.tpl') - ] - ), - 'name' => Config::MOLLIE_DEBUG_LOG, - 'options' => [ - 'query' => [ - [ - 'id' => Config::DEBUG_LOG_NONE, - 'name' => $this->module->l('Nothing'), - ], - [ - 'id' => Config::DEBUG_LOG_ERRORS, - 'name' => $this->module->l('Errors'), - ], - [ - 'id' => Config::DEBUG_LOG_ALL, - 'name' => $this->module->l('Everything'), - ], - ], - 'id' => 'id', - 'name' => 'name', - ], - ], - ] - ); - return $input; - } - - private function getSettingTabs($isApiKeyProvided) - { - $tabs = [ - 'general_settings' => $this->module->l('General settings'), - ]; - - if ($isApiKeyProvided) { - $tabs['advanced_settings'] = $this->module->l('Advanced settings'); - } - - return $tabs; - } + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Builder; + +use _PhpScoper5ea00cc67502b\Mollie\Api\Types\PaymentStatus; +use _PhpScoper5ea00cc67502b\Mollie\Api\Types\RefundStatus; +use Configuration; +use HelperForm; +use Mollie; +use Mollie\Config\Config; +use Mollie\Repository\CountryRepository; +use Mollie\Service\ApiService; +use Mollie\Service\ConfigFieldService; +use Mollie\Service\CountryService; +use Mollie\Service\MolCarrierInformationService; +use Mollie\Utility\AssortUtility; +use Mollie\Utility\TagsUtility; +use OrderState; +use Smarty; +use Tools; +use Translate; + +class FormBuilder +{ + + /** + * @var Mollie + */ + private $module; + /** + * @var ApiService + */ + private $apiService; + /** + * @var CountryService + */ + private $countryService; + + private $lang; + /** + * @var Smarty + */ + private $smarty; + + private $link; + /** + * @var CountryRepository + */ + private $countryRepository; + /** + * @var ConfigFieldService + */ + private $configFieldService; + /** + * @var MolCarrierInformationService + */ + private $carrierInformationService; + + public function __construct( + Mollie $module, + ApiService $apiService, + CountryService $countryService, + CountryRepository $countryRepository, + ConfigFieldService $configFieldService, + MolCarrierInformationService $carrierInformationService, + $lang, + Smarty $smarty, + $link + ) { + $this->module = $module; + $this->apiService = $apiService; + $this->countryService = $countryService; + $this->lang = $lang; + $this->smarty = $smarty; + $this->link = $link; + $this->countryRepository = $countryRepository; + $this->configFieldService = $configFieldService; + $this->carrierInformationService = $carrierInformationService; + } + + public function buildSettingsForm() + { + $isApiKeyProvided = Configuration::get(Config::MOLLIE_API_KEY); + + $inputs = $this->getAccountSettingsSection($isApiKeyProvided); + + if ($isApiKeyProvided) { + $inputs = array_merge($inputs, $this->getAdvancedSettingsSection()); + } + + $fields = [ + 'form' => [ + 'tabs' => $this->getSettingTabs($isApiKeyProvided), + 'input' => $inputs, + 'submit' => [ + 'title' => $this->module->l('Save'), + 'class' => 'btn btn-default pull-right', + ], + ], + ]; + + $helper = new HelperForm(); + + $helper->show_toolbar = false; + $helper->table = $this->module->getTable(); + $helper->module = $this->module; + $helper->default_form_language = $this->module->getContext()->language->id; + $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG', 0); + + $helper->identifier = $this->module->getIdentifier(); + $helper->submit_action = 'submitmollie'; + $helper->currentIndex = $this->module->getContext()->link->getAdminLink('AdminModules', false) + . "&configure={$this->module->name}&tab_module={$this->module->tab}&module_name={$this->module->name}"; + $helper->token = Tools::getAdminTokenLite('AdminModules'); + + $helper->tpl_vars = [ + 'fields_value' => $this->configFieldService->getConfigFieldsValues(), + 'languages' => $this->module->getContext()->controller->getLanguages(), + 'id_language' => $this->module->getContext()->language->id, + ]; + + return $helper->generateForm([$fields]); + } + + protected function getAccountSettingsSection($isApiKeyProvided) + { + $generalSettings = 'general_settings'; + if ($isApiKeyProvided) { + $input = [ + [ + 'type' => 'text', + 'label' => $this->module->l('API Key'), + 'tab' => $generalSettings, + 'desc' => TagsUtility::ppTags( + $this->module->l('You can find your API key in your [1]Mollie Profile[/1]; it starts with test or live.'), + [$this->module->display($this->module->getPathUri(), 'views/templates/admin/profile.tpl')] + ), + 'name' => Config::MOLLIE_API_KEY, + 'required' => true, + 'class' => 'fixed-width-xxl', + ] + ]; + } else { + $input = [ + [ + 'type' => 'mollie-switch', + 'label' => $this->module->l('Do you already have a Mollie account?'), + 'name' => Config::MOLLIE_ACCOUNT_SWITCH, + 'tab' => $generalSettings, + 'is_bool' => true, + 'values' => [ + [ + 'id' => 'active_on', + 'value' => true, + 'label' => Translate::getAdminTranslation('Enabled', 'AdminCarriers'), + ], + [ + 'id' => 'active_off', + 'value' => false, + 'label' => Translate::getAdminTranslation('Disabled', 'AdminCarriers'), + ], + ], + 'desc' => $this->module->display( + $this->module->getPathUri(), 'views/templates/admin/create_new_account_link.tpl' + ), + ], + [ + 'type' => 'text', + 'label' => $this->module->l('API Key'), + 'tab' => $generalSettings, + 'desc' => TagsUtility::ppTags( + $this->module->l('You can find your API key in your [1]Mollie Profile[/1]; it starts with test or live.'), + [$this->module->display($this->module->getPathUri(), 'views/templates/admin/profile.tpl')] + ), + 'name' => Config::MOLLIE_API_KEY, + 'required' => true, + 'class' => 'fixed-width-xxl', + ] + ]; + } + if ($isApiKeyProvided) { + $input[] = [ + 'type' => 'switch', + 'label' => $this->module->l('Use IFrame for credit card'), + 'tab' => $generalSettings, + 'name' => Config::MOLLIE_IFRAME, + 'is_bool' => true, + 'values' => [ + [ + 'id' => 'active_on', + 'value' => true, + 'label' => Translate::getAdminTranslation('Enabled', 'AdminCarriers'), + ], + [ + 'id' => 'active_off', + 'value' => false, + 'label' => Translate::getAdminTranslation('Disabled', 'AdminCarriers'), + ], + ], + ]; + + $input[] = [ + 'type' => 'text', + 'label' => $this->module->l('Profile ID'), + 'tab' => $generalSettings, + 'desc' => TagsUtility::ppTags( + $this->module->l('You can find your API key in your [1]Mollie Profile[/1];'), + [$this->module->display($this->module->getPathUri(), 'views/templates/admin/profile.tpl')] + ), + 'name' => Config::MOLLIE_PROFILE_ID, + 'required' => true, + 'class' => 'fixed-width-xxl', + ]; + + $input = array_merge($input, + [ + [ + 'type' => 'mollie-h3', + 'tab' => $generalSettings, + 'name' => '', + 'title' => $this->module->l('Orders API'), + ], + [ + 'type' => 'select', + 'label' => $this->module->l('Issuer list'), + 'tab' => $generalSettings, + 'desc' => $this->module->l('Some payment methods (eg. iDEAL) have an issuer list. This setting specifies where it is shown.'), + 'name' => Config::MOLLIE_ISSUERS, + 'options' => [ + 'query' => [ + [ + 'id' => Config::ISSUERS_ON_CLICK, + 'name' => $this->module->l('On click'), + ], + [ + 'id' => Config::ISSUERS_PAYMENT_PAGE, + 'name' => $this->module->l('Payment page'), + ], + ], + 'id' => 'id', + 'name' => 'name', + ], + ], + ] + ); + $input[] = [ + 'type' => 'mollie-h2', + 'tab' => $generalSettings, + 'name' => '', + 'title' => $this->module->l('Payment methods'), + ]; + + $input[] = [ + 'type' => 'mollie-methods', + 'name' => Config::METHODS_CONFIG, + 'paymentMethods' => $this->apiService->getMethodsForConfig($this->module->api, $this->module->getPathUri()), + 'countries' => $this->countryService->getActiveCountriesList(), + 'tab' => $generalSettings, + 'displayErrors' => Configuration::get(Config::MOLLIE_DISPLAY_ERRORS), + ]; + } + + return $input; + } + + protected function getAdvancedSettingsSection() + { + $advancedSettings = 'advanced_settings'; + $input = []; + $orderStatuses = []; + $orderStatuses = array_merge($orderStatuses, OrderState::getOrderStates($this->lang->id)); + $input[] = [ + 'type' => 'select', + 'label' => $this->module->l('Send locale for payment screen'), + 'tab' => $advancedSettings, + 'desc' => TagsUtility::ppTags( + $this->module->l('Should the plugin send the current webshop [1]locale[/1] to Mollie. Mollie payment screens will be in the same language as your webshop. Mollie can also detect the language based on the user\'s browser language.'), + [$this->module->display($this->module->getPathUri(), 'views/templates/admin/locale_wiki.tpl')] + ), + 'name' => Config::MOLLIE_PAYMENTSCREEN_LOCALE, + 'options' => [ + 'query' => [ + [ + 'id' => Config::PAYMENTSCREEN_LOCALE_BROWSER_LOCALE, + 'name' => $this->module->l('Do not send locale using browser language'), + ], + [ + 'id' => Config::PAYMENTSCREEN_LOCALE_SEND_WEBSITE_LOCALE, + 'name' => $this->module->l('Send locale for payment screen'), + ], + ], + 'id' => 'id', + 'name' => 'name', + ], + ]; + + $messageStatus = $this->module->l('Status for %s payments'); + $descriptionStatus = $this->module->l('`%s` payments get status `%s`'); + $messageMail = $this->module->l('Send mails when %s'); + $descriptionMail = $this->module->l('Send mails when transaction status becomes %s?'); + $allStatuses = array_merge([['id_order_state' => 0, 'name' => $this->module->l('Skip this status'), 'color' => '#565656']], OrderState::getOrderStates($this->lang->id)); + $statuses = []; + foreach (Config::getStatuses() as $name => $val) { + if ($name === PaymentStatus::STATUS_AUTHORIZED) { + continue; + } + + $val = (int)$val; + if ($val) { + $orderStatus = new OrderState($val); + $statusName = $orderStatus->getFieldByLang('name', $this->lang->id); + $desc = Tools::strtolower( + sprintf( + $descriptionStatus, + $this->module->lang($name), + $statusName + ) + ); + } else { + $desc = sprintf($this->module->l('`%s` payments do not get a status'), $this->module->lang($name)); + } + $statuses[] = [ + 'name' => $name, + 'key' => @constant('Mollie\Config\Config::MOLLIE_STATUS_' . Tools::strtoupper($name)), + 'value' => $val, + 'description' => $desc, + 'message' => sprintf($messageStatus, $this->module->lang($name)), + 'key_mail' => @constant('Mollie\Config\Config::MOLLIE_MAIL_WHEN_' . Tools::strtoupper($name)), + 'value_mail' => Configuration::get('MOLLIE_MAIL_WHEN_' . Tools::strtoupper($name)), + 'description_mail' => sprintf($descriptionMail, $this->module->lang($name)), + 'message_mail' => sprintf($messageMail, $this->module->lang($name)), + ]; + } + $input[] = [ + 'type' => 'mollie-h2', + 'name' => '', + 'tab' => $advancedSettings, + 'title' => $this->module->l('Order statuses'), + ]; + + foreach (array_filter($statuses, function ($status) { + return in_array($status['name'], [ + PaymentStatus::STATUS_PAID, + PaymentStatus::STATUS_AUTHORIZED, + PaymentStatus::STATUS_CANCELED, + PaymentStatus::STATUS_EXPIRED, + RefundStatus::STATUS_REFUNDED, + PaymentStatus::STATUS_OPEN, + Config::PARTIAL_REFUND_CODE, + ]); + }) as $status) { + if (!in_array($status['name'], ['paid', Config::PARTIAL_REFUND_CODE])) { + $input[] = [ + 'type' => 'switch', + 'label' => $status['message_mail'], + 'tab' => $advancedSettings, + 'name' => $status['key_mail'], + 'is_bool' => true, + 'values' => [ + [ + 'id' => 'active_on', + 'value' => true, + 'label' => Translate::getAdminTranslation('Enabled', 'AdminCarriers'), + ], + [ + 'id' => 'active_off', + 'value' => false, + 'label' => Translate::getAdminTranslation('Disabled', 'AdminCarriers'), + ], + ], + ]; + } + $input[] = [ + 'type' => 'select', + 'label' => $status['message'], + 'tab' => $advancedSettings, + 'desc' => $status['description'], + 'name' => $status['key'], + 'options' => [ + 'query' => $allStatuses, + 'id' => 'id_order_state', + 'name' => 'name', + ], + ]; + } + $input = array_merge($input, [ + [ + 'type' => 'mollie-h2', + 'name' => '', + 'tab' => $advancedSettings, + 'title' => $this->module->l('Visual Settings'), + ], + [ + 'type' => 'select', + 'label' => $this->module->l('Images'), + 'tab' => $advancedSettings, + 'desc' => $this->module->l('Show big, normal or no payment method logos on checkout.'), + 'name' => Config::MOLLIE_IMAGES, + 'options' => [ + 'query' => [ + [ + 'id' => Config::LOGOS_HIDE, + 'name' => $this->module->l('hide'), + ], + [ + 'id' => Config::LOGOS_NORMAL, + 'name' => $this->module->l('normal'), + ], + [ + 'id' => Config::LOGOS_BIG, + 'name' => $this->module->l('big'), + ], + ], + 'id' => 'id', + 'name' => 'name', + ], + ], + + [ + 'type' => 'text', + 'label' => $this->module->l('CSS file'), + 'tab' => $advancedSettings, + 'desc' => TagsUtility::ppTags( + $this->module->l('Leave empty for default stylesheet. Should include file path when set. Hint: You can use [1]{BASE}[/1], [1]{THEME}[/1], [1]{CSS}[/1], [1]{MOBILE}[/1], [1]{MOBILE_CSS}[/1] and [1]{OVERRIDE}[/1] for easy folder mapping.'), + [$this->module->display($this->module->getPathUri(), 'views/templates/front/kbd.tpl')] + ), + 'name' => Config::MOLLIE_CSS, + 'class' => 'long-text', + ], + ]); + $input[] = [ + 'type' => 'mollie-carriers', + 'label' => $this->module->l('Shipment information'), + 'tab' => $advancedSettings, + 'name' => Config::MOLLIE_TRACKING_URLS, + 'depends' => Config::MOLLIE_API, + 'depends_value' => Config::MOLLIE_ORDERS_API, + 'carriers' => $this->carrierInformationService->getAllCarriersInformation($this->lang->id) + ]; + $input[] = [ + 'type' => 'mollie-carrier-switch', + 'label' => $this->module->l('Automatically ship on marked statuses'), + 'tab' => $advancedSettings, + 'name' => Config::MOLLIE_AUTO_SHIP_MAIN, + 'desc' => $this->module->l('Enabling this feature will automatically send shipment information when an order gets marked status'), + 'is_bool' => true, + 'values' => [ + [ + 'id' => 'active_on', + 'value' => true, + 'label' => Translate::getAdminTranslation('Enabled', 'AdminCarriers'), + ], + [ + 'id' => 'active_off', + 'value' => false, + 'label' => Translate::getAdminTranslation('Disabled', 'AdminCarriers'), + ], + ], + 'depends' => Config::MOLLIE_API, + 'depends_value' => Config::MOLLIE_ORDERS_API, + ]; + $input[] = [ + 'type' => 'checkbox', + 'label' => $this->module->l('Automatically ship when one of these statuses is reached'), + 'tab' => $advancedSettings, + 'desc' => + $this->module->l('If an order reaches one of these statuses the module will automatically send shipment information'), + 'name' => Config::MOLLIE_AUTO_SHIP_STATUSES, + 'multiple' => true, + 'values' => [ + 'query' => $orderStatuses, + 'id' => 'id_order_state', + 'name' => 'name', + ], + 'expand' => (count($orderStatuses) > 10) ? [ + 'print_total' => count($orderStatuses), + 'default' => 'show', + 'show' => ['text' => $this->module->l('Show'), 'icon' => 'plus-sign-alt'], + 'hide' => ['text' => $this->module->l('Hide'), 'icon' => 'minus-sign-alt'], + ] : null, + 'depends' => Config::MOLLIE_API, + 'depends_value' => Config::MOLLIE_ORDERS_API, + ]; + $orderStatuses = [ + [ + 'name' => $this->module->l('Disable this status'), + 'id_order_state' => '0', + ], + ]; + $orderStatuses = array_merge($orderStatuses, OrderState::getOrderStates($this->lang->id)); + + for ($i = 0; $i < count($orderStatuses); $i++) { + $orderStatuses[$i]['name'] = $orderStatuses[$i]['id_order_state'] . ' - ' . $orderStatuses[$i]['name']; + } + + AssortUtility::aasort($orderStatuses, 'id_order_state'); + + $this->smarty->assign([ + 'logs' => $this->link->getAdminLink('AdminLogs') + ]); + $input = array_merge( + $input, + [ + [ + 'type' => 'mollie-h2', + 'name' => '', + 'title' => $this->module->l('Debug level'), + 'tab' => $advancedSettings, + ], + [ + 'type' => 'switch', + 'label' => $this->module->l('Display errors'), + 'tab' => $advancedSettings, + 'name' => Config::MOLLIE_DISPLAY_ERRORS, + 'desc' => $this->module->l('Enabling this feature will display error messages (if any) on the front page. Use for debug purposes only!'), + 'is_bool' => true, + 'values' => [ + [ + 'id' => 'active_on', + 'value' => true, + 'label' => Translate::getAdminTranslation('Enabled', 'AdminCarriers'), + ], + [ + 'id' => 'active_off', + 'value' => false, + 'label' => Translate::getAdminTranslation('Disabled', 'AdminCarriers'), + ], + ], + ], + [ + 'type' => 'select', + 'label' => $this->module->l('Log level'), + 'tab' => $advancedSettings, + 'desc' => TagsUtility::ppTags( + $this->module->l('Recommended level: Errors. Set to Everything to monitor incoming webhook requests. [1]View logs.[/1]'), + [ + $this->module->display($this->module->getPathUri(), 'views/templates/admin/view_logs.tpl') + ] + ), + 'name' => Config::MOLLIE_DEBUG_LOG, + 'options' => [ + 'query' => [ + [ + 'id' => Config::DEBUG_LOG_NONE, + 'name' => $this->module->l('Nothing'), + ], + [ + 'id' => Config::DEBUG_LOG_ERRORS, + 'name' => $this->module->l('Errors'), + ], + [ + 'id' => Config::DEBUG_LOG_ALL, + 'name' => $this->module->l('Everything'), + ], + ], + 'id' => 'id', + 'name' => 'name', + ], + ], + ] + ); + return $input; + } + + private function getSettingTabs($isApiKeyProvided) + { + $tabs = [ + 'general_settings' => $this->module->l('General settings'), + ]; + + if ($isApiKeyProvided) { + $tabs['advanced_settings'] = $this->module->l('Advanced settings'); + } + + return $tabs; + } } \ No newline at end of file diff --git a/views/templates/admin/download_update.tpl b/src/Builder/index.php similarity index 65% rename from views/templates/admin/download_update.tpl rename to src/Builder/index.php index 3e8204d26..9e462a606 100644 --- a/views/templates/admin/download_update.tpl +++ b/src/Builder/index.php @@ -1,5 +1,6 @@ -{** - * Copyright (c) 2012-2019, Mollie B.V. + {l s='Update this module' mod='mollie'} - +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/src/Config/Config.php b/src/Config/Config.php index ca09185ed..133ae9207 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -1,235 +1,268 @@ - ['eur'], - 'belfius' => ['eur'], - 'bitcoin' => ['eur'], - 'cartesbancaires' => ['eur'], - 'creditcard' => ['aud', 'bgn', 'cad', 'chf', 'czk', 'dkk', 'eur', 'gbp', 'hkd', 'hrk', 'huf', 'ils', 'isk', 'jpy', 'pln', 'ron', 'sek', 'usd'], - 'directdebit' => ['eur'], - 'eps' => ['eur'], - 'giftcard' => ['eur'], - 'giropay' => ['eur'], - 'ideal' => ['eur'], - 'applepay' => ['aud', 'bgn', 'cad', 'chf', 'czk', 'dkk', 'eur', 'gbp', 'hkd', 'hrk', 'huf', 'ils', 'isk', 'jpy', 'pln', 'ron', 'sek', 'usd'], - 'inghomepay' => ['eur'], - 'kbc' => ['eur'], - 'bancontact' => ['eur'], - 'paypal' => ['aud', 'brl', 'cad', 'chf', 'czk', 'dkk', 'eur', 'gbp', 'hkd', 'huf', 'ils', 'jpy', 'mxn', 'myr', 'nok', 'nzd', 'php', 'pln', 'rub', 'sek', 'sgd', 'thb', 'twd', 'usd'], - 'paysafecard' => ['eur'], - 'sofort' => ['eur'], - 'klarnapaylater' => ['eur'], - 'klarnasliceit' => ['eur'], - 'mybank' => ['eur'], - - ]; - - - /** - * Default payment method availability - * - * empty array is global availability - * - * @var array - * - * @since 3.3.2 - */ - public static $defaultMethodAvailability = [ - 'creditcard' => [], - 'klarnapaylater' => ['nl', 'de', 'at', 'fi'], - 'klarnasliceit' => ['de', 'at', 'fi'], - 'ideal' => ['nl'], - 'bancontact' => ['be'], - 'paypal' => [], - 'giropay' => ['de'], - 'eps' => ['at'], - 'belfius' => ['be'], - 'inghomepay' => ['be'], - 'kbc' => ['be'], - 'sofort' => ['de', 'at', 'ch', 'pl', 'it', 'es', 'be', 'nl'], - 'giftcard' => ['nl'], - 'bitcoin' => [], - 'paysafecard' => [], - 'banktransfer' => [], - 'cartesbancaires' => ['fr'], - 'directdebit' => [ - 'fi', 'at', 'pt', 'be', 'bg', 'es', 'hr', 'cy', 'cz', 'dk', 'ee', 'fr', 'gf', 'de', 'gi', 'gr', 'gp', 'gg', 'hu', - 'is', 'ie', 'im', 'it', 'je', 'lv', 'li', 'lt', 'lu', 'pt', 'mt', 'mq', 'yt', 'mc', 'nl', 'no', 'pl', 'pt', 're', - 'ro', 'bl', 'mf', 'pm', 'sm', 'sk', 'sl', 'es', 'se', 'ch', 'gb', 'uk', - ], - 'mybank' => [], - ]; - - const SUPPORTED_PHP_VERSION = '5.6'; - const NOTICE = 1; - const WARNING = 2; - const ERROR = 3; - const CRASH = 4; - - const NAME = 'mollie'; - - const PAYMENTSCREEN_LOCALE_BROWSER_LOCALE = 'browser_locale'; - const PAYMENTSCREEN_LOCALE_SEND_WEBSITE_LOCALE = 'website_locale'; - - const LOGOS_BIG = 'big'; - const LOGOS_NORMAL = 'normal'; - const LOGOS_HIDE = 'hide'; - - const ISSUERS_ON_CLICK = 'on-click'; - const ISSUERS_PAYMENT_PAGE = 'payment-page'; - const METHODS_CONFIG = 'MOLLIE_METHODS_CONFIG'; - - const DEBUG_LOG_NONE = 0; - const DEBUG_LOG_ERRORS = 1; - const DEBUG_LOG_ALL = 2; - - const MOLLIE_API_KEY = 'MOLLIE_API_KEY'; - const MOLLIE_PROFILE_ID = 'MOLLIE_PROFILE_ID'; - const MOLLIE_ACCOUNT_SWITCH = 'MOLLIE_ACCOUNT_SWITCH'; - const MOLLIE_PAYMENTSCREEN_LOCALE = 'MOLLIE_PAYMENTSCREEN_LOCALE'; - const MOLLIE_IFRAME = 'MOLLIE_IFRAME'; - const MOLLIE_IMAGES = 'MOLLIE_IMAGES'; - const MOLLIE_ISSUERS = 'MOLLIE_ISSUERS'; - const MOLLIE_CSS = 'MOLLIE_CSS'; - const MOLLIE_DEBUG_LOG = 'MOLLIE_DEBUG_LOG'; - const MOLLIE_QRENABLED = 'MOLLIE_QRENABLED'; - const MOLLIE_METHOD_COUNTRIES = 'MOLLIE_METHOD_COUNTRIES'; - const MOLLIE_METHOD_COUNTRIES_DISPLAY = 'MOLLIE_METHOD_COUNTRIES_DISPLAY'; - const MOLLIE_DISPLAY_ERRORS = 'MOLLIE_DISPLAY_ERRORS'; - const MOLLIE_TRACKING_URLS = 'MOLLIE_TRACKING_URLS_'; - const MOLLIE_AUTO_SHIP_MAIN = 'MOLLIE_AS_MAIN'; - const MOLLIE_AUTO_SHIP_STATUSES = 'MOLLIE_AS_STATUSES'; - const MOLLIE_STATUS_OPEN = 'MOLLIE_STATUS_OPEN'; - const MOLLIE_STATUS_PAID = 'MOLLIE_STATUS_PAID'; - const MOLLIE_STATUS_CANCELED = 'MOLLIE_STATUS_CANCELED'; - const MOLLIE_STATUS_EXPIRED = 'MOLLIE_STATUS_EXPIRED'; - const MOLLIE_STATUS_PARTIAL_REFUND = 'MOLLIE_STATUS_PARTIAL_REFUND'; - const MOLLIE_STATUS_REFUNDED = 'MOLLIE_STATUS_REFUNDED'; - const MOLLIE_MAIL_WHEN_OPEN = 'MOLLIE_MAIL_WHEN_OPEN'; - const MOLLIE_MAIL_WHEN_PAID = 'MOLLIE_MAIL_WHEN_PAID'; - const MOLLIE_MAIL_WHEN_CANCELED = 'MOLLIE_MAIL_WHEN_CANCELED'; - const MOLLIE_MAIL_WHEN_EXPIRED = 'MOLLIE_MAIL_WHEN_EXPIRED'; - const MOLLIE_MAIL_WHEN_REFUNDED = 'MOLLIE_MAIL_WHEN_REFUNDED'; - const PARTIAL_REFUND_CODE = 'partial_refund'; - - const MOLLIE_CARRIER_URL_SOURCE = 'MOLLIE_CARRIER_URL_SOURCE_'; - const MOLLIE_CARRIER_CUSTOM_URL = 'MOLLIE_CARRIER_CUSTOM_URL_'; - - const MOLLIE_METHOD_ENABLED = 'MOLLIE_METHOD_ENABLED_'; - const MOLLIE_METHOD_TITLE = 'MOLLIE_METHOD_TITLE_'; - const MOLLIE_METHOD_API = 'MOLLIE_METHOD_API_'; - const MOLLIE_METHOD_DESCRIPTION = 'MOLLIE_METHOD_DESCRIPTION_'; - const MOLLIE_METHOD_APPLICABLE_COUNTRIES = 'MOLLIE_METHOD_APPLICABLE_COUNTRIES_'; - const MOLLIE_METHOD_CERTAIN_COUNTRIES = 'MOLLIE_METHOD_CERTAIN_COUNTRIES_'; - const MOLLIE_METHOD_MINIMUM_ORDER_VALUE = 'MOLLIE_METHOD_MINIMUM_ORDER_VALUE_'; - const MOLLIE_METHOD_MAX_ORDER_VALUE = 'MOLLIE_METHOD_MAX_ORDER_VALUE_'; - const MOLLIE_METHOD_SURCHARGE_TYPE = 'MOLLIE_METHOD_SURCHARGE_TYPE_'; - const MOLLIE_METHOD_SURCHARGE_FIXED_AMOUNT = 'MOLLIE_METHOD_SURCHARGE_FIXED_AMOUNT_'; - const MOLLIE_METHOD_SURCHARGE_PERCENTAGE = 'MOLLIE_METHOD_SURCHARGE_PERCENTAGE_'; - const MOLLIE_METHOD_SURCHARGE_LIMIT = 'MOLLIE_METHOD_SURCHARGE_LIMIT_'; - - const MOLLIE_RESELLER_PARTNER_ID = 4602094; - const MOLLIE_RESELLER_PROFILE_KEY = 'B69C2D66'; - const MOLLIE_RESELLER_APP_SECRET = '49726EB7650EC592F732E7B82A4C1EFD6EE8A10F'; - - const MOLLIE_CARRIER_NO_TRACKING_INFO = 'no_tracking_info'; - const MOLLIE_CARRIER_MODULE = 'module'; - const MOLLIE_CARRIER_CARRIER = 'carrier_url'; - const MOLLIE_CARRIER_CUSTOM = 'custom_url'; - - const MOLLIE_API = 'MOLLIE_API'; - const MOLLIE_ORDERS_API = 'orders'; - const MOLLIE_PAYMENTS_API = 'payments'; - - const MOLLIE_METHODS_LAST_CHECK = 'MOLLIE_METHOD_CHECK_UPD'; - const MOLLIE_METHODS_CHECK_INTERVAL = 86400; //daily check - - const API_ROUNDING_PRECISION = 2; - - const STATUS_PAID_ON_BACKORDER = "paid_backorder"; - const STATUS_PENDING_ON_BACKORDER = "pending_backorder"; - const STATUS_MOLLIE_AWAITING = 'mollie_awaiting'; - const STATUS_ON_BACKORDER = "on_backorder"; - const MOLLIE_AWAITING_PAYMENT = "awaiting"; - const PRICE_DISPLAY_METHOD_NO_TAXES = '1'; - const APPLEPAY = 'applepay'; - const MOLLIE_COUNTRIES = 'country_'; - - const FEE_NO_FEE = 0; - const FEE_FIXED_FEE = 1; - const FEE_PERCENTAGE= 2; - const FEE_FIXED_FEE_AND_PERCENTAGE = 3; - - const CARTES_BANCAIRES = 'cartesbancaires'; - - /** @var array $methods */ - public static $methods = [ - 'banktransfer' => 'Bank', - 'belfius' => 'Belfius', - 'bitcoin' => 'Bitcoin', - 'cartesbancaires' => 'Cartes Bancaires', - 'creditcard' => 'Credit Card', - 'directdebit' => 'Direct Debit', - 'eps' => 'EPS', - 'giftcard' => 'Giftcard', - 'giropay' => 'Giropay', - 'ideal' => 'iDEAL', - 'inghomepay ' => 'ING Homepay', - 'kbc' => 'KBC', - 'bancontact' => 'Bancontact', - 'paypal' => 'PayPal', - 'paysafecard' => 'Paysafecard', - 'sofort' => 'Sofort Banking', - 'klarnapaylater' => 'Pay later.', - 'klarnaspliceit' => 'Slice it.', - 'applepay' => 'Apple Pay', - 'mybank' => 'MyBank', - ]; - - public static function getStatuses() - { - return [ - PaymentStatus::STATUS_PAID => Configuration::get(self::MOLLIE_STATUS_PAID), - PaymentStatus::STATUS_AUTHORIZED => Configuration::get(self::MOLLIE_STATUS_PAID), - PaymentStatus::STATUS_CANCELED => Configuration::get(self::MOLLIE_STATUS_CANCELED), - PaymentStatus::STATUS_EXPIRED => Configuration::get(self::MOLLIE_STATUS_EXPIRED), - RefundStatus::STATUS_REFUNDED => Configuration::get(self::MOLLIE_STATUS_REFUNDED), - PaymentStatus::STATUS_OPEN => Configuration::get(self::MOLLIE_STATUS_OPEN), - PaymentStatus::STATUS_FAILED => Configuration::get(self::MOLLIE_STATUS_CANCELED), - self::MOLLIE_AWAITING_PAYMENT => Configuration::get(self::STATUS_MOLLIE_AWAITING), - self::PARTIAL_REFUND_CODE => Configuration::get(self::MOLLIE_STATUS_PARTIAL_REFUND), - 'created' => Configuration::get(self::MOLLIE_STATUS_OPEN), - self::STATUS_PAID_ON_BACKORDER => Configuration::get('PS_OS_OUTOFSTOCK_PAID'), - self::STATUS_PENDING_ON_BACKORDER => Configuration::get('PS_OS_OUTOFSTOCK_UNPAID'), - self::STATUS_ON_BACKORDER => Configuration::get('PS_OS_OUTOFSTOCK'), - ]; - } - - public static function isVersion17() - { - return (bool)version_compare(_PS_VERSION_, '1.7', '>='); - } - - public static function isTestMode() - { - $apiKey = Configuration::get(self::MOLLIE_API_KEY); - if (strpos($apiKey, 'test') === 0) { - return true; - } - - return false; - } + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Config; + +use _PhpScoper5ea00cc67502b\Mollie\Api\Types\PaymentStatus; +use _PhpScoper5ea00cc67502b\Mollie\Api\Types\RefundStatus; +use Configuration; + +class Config +{ + /** + * Currency restrictions per payment method + * + * @var array + */ + public static $methodCurrencies = [ + 'banktransfer' => ['eur'], + 'belfius' => ['eur'], + 'bitcoin' => ['eur'], + 'cartesbancaires' => ['eur'], + 'creditcard' => ['aud', 'bgn', 'cad', 'chf', 'czk', 'dkk', 'eur', 'gbp', 'hkd', 'hrk', 'huf', 'ils', 'isk', 'jpy', 'pln', 'ron', 'sek', 'usd'], + 'directdebit' => ['eur'], + 'eps' => ['eur'], + 'giftcard' => ['eur'], + 'giropay' => ['eur'], + 'ideal' => ['eur'], + 'applepay' => ['aud', 'bgn', 'cad', 'chf', 'czk', 'dkk', 'eur', 'gbp', 'hkd', 'hrk', 'huf', 'ils', 'isk', 'jpy', 'pln', 'ron', 'sek', 'usd'], + 'inghomepay' => ['eur'], + 'kbc' => ['eur'], + 'bancontact' => ['eur'], + 'paypal' => ['aud', 'brl', 'cad', 'chf', 'czk', 'dkk', 'eur', 'gbp', 'hkd', 'huf', 'ils', 'jpy', 'mxn', 'myr', 'nok', 'nzd', 'php', 'pln', 'rub', 'sek', 'sgd', 'thb', 'twd', 'usd'], + 'paysafecard' => ['eur'], + 'sofort' => ['eur'], + 'klarnapaylater' => ['eur'], + 'klarnasliceit' => ['eur'], + 'mybank' => ['eur'], + + ]; + + + /** + * Default payment method availability + * + * empty array is global availability + * + * @var array + * + * @since 3.3.2 + */ + public static $defaultMethodAvailability = [ + 'creditcard' => [], + 'klarnapaylater' => ['nl', 'de', 'at', 'fi'], + 'klarnasliceit' => ['de', 'at', 'fi'], + 'ideal' => ['nl'], + 'bancontact' => ['be'], + 'paypal' => [], + 'giropay' => ['de'], + 'eps' => ['at'], + 'belfius' => ['be'], + 'inghomepay' => ['be'], + 'kbc' => ['be'], + 'sofort' => ['de', 'at', 'ch', 'pl', 'it', 'es', 'be', 'nl'], + 'giftcard' => ['nl'], + 'bitcoin' => [], + 'paysafecard' => [], + 'banktransfer' => [], + 'cartesbancaires' => ['fr'], + 'directdebit' => [ + 'fi', 'at', 'pt', 'be', 'bg', 'es', 'hr', 'cy', 'cz', 'dk', 'ee', 'fr', 'gf', 'de', 'gi', 'gr', 'gp', 'gg', 'hu', + 'is', 'ie', 'im', 'it', 'je', 'lv', 'li', 'lt', 'lu', 'pt', 'mt', 'mq', 'yt', 'mc', 'nl', 'no', 'pl', 'pt', 're', + 'ro', 'bl', 'mf', 'pm', 'sm', 'sk', 'sl', 'es', 'se', 'ch', 'gb', 'uk', + ], + 'mybank' => [], + ]; + + const SUPPORTED_PHP_VERSION = '5.6'; + const NOTICE = 1; + const WARNING = 2; + const ERROR = 3; + const CRASH = 4; + + const NAME = 'mollie'; + + const PAYMENTSCREEN_LOCALE_BROWSER_LOCALE = 'browser_locale'; + const PAYMENTSCREEN_LOCALE_SEND_WEBSITE_LOCALE = 'website_locale'; + + const LOGOS_BIG = 'big'; + const LOGOS_NORMAL = 'normal'; + const LOGOS_HIDE = 'hide'; + + const ISSUERS_ON_CLICK = 'on-click'; + const ISSUERS_PAYMENT_PAGE = 'payment-page'; + const METHODS_CONFIG = 'MOLLIE_METHODS_CONFIG'; + + const DEBUG_LOG_NONE = 0; + const DEBUG_LOG_ERRORS = 1; + const DEBUG_LOG_ALL = 2; + + const MOLLIE_API_KEY = 'MOLLIE_API_KEY'; + const MOLLIE_PROFILE_ID = 'MOLLIE_PROFILE_ID'; + const MOLLIE_ACCOUNT_SWITCH = 'MOLLIE_ACCOUNT_SWITCH'; + const MOLLIE_PAYMENTSCREEN_LOCALE = 'MOLLIE_PAYMENTSCREEN_LOCALE'; + const MOLLIE_IFRAME = 'MOLLIE_IFRAME'; + const MOLLIE_IMAGES = 'MOLLIE_IMAGES'; + const MOLLIE_ISSUERS = 'MOLLIE_ISSUERS'; + const MOLLIE_CSS = 'MOLLIE_CSS'; + const MOLLIE_DEBUG_LOG = 'MOLLIE_DEBUG_LOG'; + const MOLLIE_QRENABLED = 'MOLLIE_QRENABLED'; + const MOLLIE_METHOD_COUNTRIES = 'MOLLIE_METHOD_COUNTRIES'; + const MOLLIE_METHOD_COUNTRIES_DISPLAY = 'MOLLIE_METHOD_COUNTRIES_DISPLAY'; + const MOLLIE_DISPLAY_ERRORS = 'MOLLIE_DISPLAY_ERRORS'; + const MOLLIE_TRACKING_URLS = 'MOLLIE_TRACKING_URLS_'; + const MOLLIE_AUTO_SHIP_MAIN = 'MOLLIE_AS_MAIN'; + const MOLLIE_AUTO_SHIP_STATUSES = 'MOLLIE_AS_STATUSES'; + const MOLLIE_STATUS_OPEN = 'MOLLIE_STATUS_OPEN'; + const MOLLIE_STATUS_PAID = 'MOLLIE_STATUS_PAID'; + const MOLLIE_STATUS_CANCELED = 'MOLLIE_STATUS_CANCELED'; + const MOLLIE_STATUS_EXPIRED = 'MOLLIE_STATUS_EXPIRED'; + const MOLLIE_STATUS_PARTIAL_REFUND = 'MOLLIE_STATUS_PARTIAL_REFUND'; + const MOLLIE_STATUS_REFUNDED = 'MOLLIE_STATUS_REFUNDED'; + const MOLLIE_MAIL_WHEN_OPEN = 'MOLLIE_MAIL_WHEN_OPEN'; + const MOLLIE_MAIL_WHEN_PAID = 'MOLLIE_MAIL_WHEN_PAID'; + const MOLLIE_MAIL_WHEN_CANCELED = 'MOLLIE_MAIL_WHEN_CANCELED'; + const MOLLIE_MAIL_WHEN_EXPIRED = 'MOLLIE_MAIL_WHEN_EXPIRED'; + const MOLLIE_MAIL_WHEN_REFUNDED = 'MOLLIE_MAIL_WHEN_REFUNDED'; + const PARTIAL_REFUND_CODE = 'partial_refund'; + + const MOLLIE_CARRIER_URL_SOURCE = 'MOLLIE_CARRIER_URL_SOURCE_'; + const MOLLIE_CARRIER_CUSTOM_URL = 'MOLLIE_CARRIER_CUSTOM_URL_'; + + const MOLLIE_METHOD_ENABLED = 'MOLLIE_METHOD_ENABLED_'; + const MOLLIE_METHOD_TITLE = 'MOLLIE_METHOD_TITLE_'; + const MOLLIE_METHOD_API = 'MOLLIE_METHOD_API_'; + const MOLLIE_METHOD_DESCRIPTION = 'MOLLIE_METHOD_DESCRIPTION_'; + const MOLLIE_METHOD_APPLICABLE_COUNTRIES = 'MOLLIE_METHOD_APPLICABLE_COUNTRIES_'; + const MOLLIE_METHOD_CERTAIN_COUNTRIES = 'MOLLIE_METHOD_CERTAIN_COUNTRIES_'; + const MOLLIE_METHOD_MINIMUM_ORDER_VALUE = 'MOLLIE_METHOD_MINIMUM_ORDER_VALUE_'; + const MOLLIE_METHOD_MAX_ORDER_VALUE = 'MOLLIE_METHOD_MAX_ORDER_VALUE_'; + const MOLLIE_METHOD_SURCHARGE_TYPE = 'MOLLIE_METHOD_SURCHARGE_TYPE_'; + const MOLLIE_METHOD_SURCHARGE_FIXED_AMOUNT = 'MOLLIE_METHOD_SURCHARGE_FIXED_AMOUNT_'; + const MOLLIE_METHOD_SURCHARGE_PERCENTAGE = 'MOLLIE_METHOD_SURCHARGE_PERCENTAGE_'; + const MOLLIE_METHOD_SURCHARGE_LIMIT = 'MOLLIE_METHOD_SURCHARGE_LIMIT_'; + + const MOLLIE_RESELLER_PARTNER_ID = 4602094; + const MOLLIE_RESELLER_PROFILE_KEY = 'B69C2D66'; + const MOLLIE_RESELLER_APP_SECRET = '49726EB7650EC592F732E7B82A4C1EFD6EE8A10F'; + + const MOLLIE_CARRIER_NO_TRACKING_INFO = 'no_tracking_info'; + const MOLLIE_CARRIER_MODULE = 'module'; + const MOLLIE_CARRIER_CARRIER = 'carrier_url'; + const MOLLIE_CARRIER_CUSTOM = 'custom_url'; + + const MOLLIE_API = 'MOLLIE_API'; + const MOLLIE_ORDERS_API = 'orders'; + const MOLLIE_PAYMENTS_API = 'payments'; + + const MOLLIE_METHODS_LAST_CHECK = 'MOLLIE_METHOD_CHECK_UPD'; + const MOLLIE_METHODS_CHECK_INTERVAL = 86400; //daily check + + const API_ROUNDING_PRECISION = 2; + + const STATUS_PAID_ON_BACKORDER = "paid_backorder"; + const STATUS_PENDING_ON_BACKORDER = "pending_backorder"; + const STATUS_MOLLIE_AWAITING = 'mollie_awaiting'; + const STATUS_ON_BACKORDER = "on_backorder"; + const MOLLIE_AWAITING_PAYMENT = "awaiting"; + const PRICE_DISPLAY_METHOD_NO_TAXES = '1'; + const APPLEPAY = 'applepay'; + const MOLLIE_COUNTRIES = 'country_'; + + const FEE_NO_FEE = 0; + const FEE_FIXED_FEE = 1; + const FEE_PERCENTAGE= 2; + const FEE_FIXED_FEE_AND_PERCENTAGE = 3; + + const CARTES_BANCAIRES = 'cartesbancaires'; + + /** @var array $methods */ + public static $methods = [ + 'banktransfer' => 'Bank', + 'belfius' => 'Belfius', + 'bitcoin' => 'Bitcoin', + 'cartesbancaires' => 'Cartes Bancaires', + 'creditcard' => 'Credit Card', + 'directdebit' => 'Direct Debit', + 'eps' => 'EPS', + 'giftcard' => 'Giftcard', + 'giropay' => 'Giropay', + 'ideal' => 'iDEAL', + 'inghomepay ' => 'ING Homepay', + 'kbc' => 'KBC', + 'bancontact' => 'Bancontact', + 'paypal' => 'PayPal', + 'paysafecard' => 'Paysafecard', + 'sofort' => 'Sofort Banking', + 'klarnapaylater' => 'Pay later.', + 'klarnaspliceit' => 'Slice it.', + 'applepay' => 'Apple Pay', + 'mybank' => 'MyBank', + ]; + + public static function getStatuses() + { + return [ + PaymentStatus::STATUS_PAID => Configuration::get(self::MOLLIE_STATUS_PAID), + PaymentStatus::STATUS_AUTHORIZED => Configuration::get(self::MOLLIE_STATUS_PAID), + PaymentStatus::STATUS_CANCELED => Configuration::get(self::MOLLIE_STATUS_CANCELED), + PaymentStatus::STATUS_EXPIRED => Configuration::get(self::MOLLIE_STATUS_EXPIRED), + RefundStatus::STATUS_REFUNDED => Configuration::get(self::MOLLIE_STATUS_REFUNDED), + PaymentStatus::STATUS_OPEN => Configuration::get(self::MOLLIE_STATUS_OPEN), + PaymentStatus::STATUS_FAILED => Configuration::get(self::MOLLIE_STATUS_CANCELED), + self::MOLLIE_AWAITING_PAYMENT => Configuration::get(self::STATUS_MOLLIE_AWAITING), + self::PARTIAL_REFUND_CODE => Configuration::get(self::MOLLIE_STATUS_PARTIAL_REFUND), + 'created' => Configuration::get(self::MOLLIE_STATUS_OPEN), + self::STATUS_PAID_ON_BACKORDER => Configuration::get('PS_OS_OUTOFSTOCK_PAID'), + self::STATUS_PENDING_ON_BACKORDER => Configuration::get('PS_OS_OUTOFSTOCK_UNPAID'), + self::STATUS_ON_BACKORDER => Configuration::get('PS_OS_OUTOFSTOCK'), + ]; + } + + public static function isVersion17() + { + return (bool)version_compare(_PS_VERSION_, '1.7', '>='); + } + + public static function isTestMode() + { + $apiKey = Configuration::get(self::MOLLIE_API_KEY); + if (strpos($apiKey, 'test') === 0) { + return true; + } + + return false; + } } \ No newline at end of file diff --git a/src/Config/index.php b/src/Config/index.php new file mode 100644 index 000000000..9e462a606 --- /dev/null +++ b/src/Config/index.php @@ -0,0 +1,44 @@ + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/src/Entity/MolCarrierInformation.php b/src/Entity/MolCarrierInformation.php index 4bc88f40a..85bd105bb 100644 --- a/src/Entity/MolCarrierInformation.php +++ b/src/Entity/MolCarrierInformation.php @@ -1,32 +1,65 @@ - 'mol_carrier_information', - 'primary' => 'id_mol_carrier_information', - 'fields' => array( - 'id_carrier' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), - 'url_source' => array('type' => self::TYPE_STRING, 'validate' => 'isString'), - 'custom_url' => array('type' => self::TYPE_STRING, 'validate' => 'isString'), - ), - ); + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +class MolCarrierInformation extends ObjectModel +{ + /** + * @var int + */ + public $id_carrier; + + /** + * @var string + */ + public $url_source; + + /** + * @var string + */ + public $custom_url; + + /** + * @var array + */ + public static $definition = array( + 'table' => 'mol_carrier_information', + 'primary' => 'id_mol_carrier_information', + 'fields' => array( + 'id_carrier' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), + 'url_source' => array('type' => self::TYPE_STRING, 'validate' => 'isString'), + 'custom_url' => array('type' => self::TYPE_STRING, 'validate' => 'isString'), + ), + ); } \ No newline at end of file diff --git a/src/Entity/MolOrderFee.php b/src/Entity/MolOrderFee.php index 11b79693a..3b27c33b2 100644 --- a/src/Entity/MolOrderFee.php +++ b/src/Entity/MolOrderFee.php @@ -1,26 +1,59 @@ - 'mol_order_fee', - 'primary' => 'id_mol_order_fee', - 'fields' => array( - 'id_cart' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), - 'order_fee' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'), - ), - ); + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +class MolOrderFee extends ObjectModel +{ + /** + * @var int + */ + public $id_cart; + + /** + * @var float + */ + public $order_fee; + + /** + * @var array + */ + public static $definition = array( + 'table' => 'mol_order_fee', + 'primary' => 'id_mol_order_fee', + 'fields' => array( + 'id_cart' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), + 'order_fee' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'), + ), + ); } \ No newline at end of file diff --git a/src/Entity/MolPaymentMethod.php b/src/Entity/MolPaymentMethod.php index 566ef4438..363435947 100644 --- a/src/Entity/MolPaymentMethod.php +++ b/src/Entity/MolPaymentMethod.php @@ -1,4 +1,37 @@ + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ class MolPaymentMethod extends ObjectModel { diff --git a/src/Entity/MolPaymentMethodIssuer.php b/src/Entity/MolPaymentMethodIssuer.php index dfa7fd101..0b388585a 100644 --- a/src/Entity/MolPaymentMethodIssuer.php +++ b/src/Entity/MolPaymentMethodIssuer.php @@ -1,4 +1,37 @@ + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ class MolPaymentMethodIssuer extends ObjectModel { diff --git a/src/Entity/index.php b/src/Entity/index.php new file mode 100644 index 000000000..9e462a606 --- /dev/null +++ b/src/Entity/index.php @@ -0,0 +1,44 @@ + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/src/Factory/ContextFactory.php b/src/Factory/ContextFactory.php index 5c7d935fb..0f4913c59 100644 --- a/src/Factory/ContextFactory.php +++ b/src/Factory/ContextFactory.php @@ -1,24 +1,36 @@ - * @copyright Fruugo.com Limited - * @license Fruugo + * @author Mollie B.V. + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart */ namespace Mollie\Factory; diff --git a/src/Factory/index.php b/src/Factory/index.php new file mode 100644 index 000000000..9e462a606 --- /dev/null +++ b/src/Factory/index.php @@ -0,0 +1,44 @@ + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/src/Install/Installer.php b/src/Install/Installer.php index f20f9e4e3..ce474f776 100644 --- a/src/Install/Installer.php +++ b/src/Install/Installer.php @@ -1,235 +1,269 @@ -module = $module; - } - - public function install() - { - foreach (self::getHooks() as $hook) { - $this->module->registerHook($hook); - } - - $context = Context::getContext(); - - try { - $this->partialRefundOrderState($context->language->id); - } catch (\Exception $e) { - $this->errors[] = $this->module->l('Unable to install Mollie partially refunded order state'); - return false; - } - try { - $this->awaitingMollieOrderState($context->language->id); - } catch (\Exception $e) { - $this->errors[] = $this->module->l('Unable to install Mollie awaiting state'); - return false; - } - - try { - $this->initConfig(); - } catch (\Exception $e) { - $this->errors[] = $this->module->l('Unable to install config'); - return false; - } - try { - $this->setDefaultCarrierStatuses(); - } catch (\Exception $e) { - $this->errors[] = $this->module->l('Unable to install default carrier statuses'); - return false; - } - - include(dirname(__FILE__) . '/../../sql/install.php'); - - return true; - } - - public function getErrors() - { - return $this->errors; - } - - public static function getHooks() - { - return [ - 'displayPayment', - 'displayPaymentEU', - 'paymentOptions', - 'displayAdminOrder', - 'displayBackOfficeHeader', - 'displayOrderConfirmation', - 'actionFrontControllerSetMedia', - 'actionEmailSendBefore', - 'actionOrderStatusUpdate', - 'displayPDFInvoice' - ]; - } - - /** - * Create new order state for partial refunds. - * - * @return boolean - * @throws PrestaShopDatabaseException - * @throws PrestaShopException - * @throws Adapter_Exception - * @since 2.0.0 - * - */ - private function partialRefundOrderState($languageId) - { - $stateExists = false; - $states = OrderState::getOrderStates((int)$languageId); - foreach ($states as $state) { - if ($this->module->lang('Mollie partially refunded') === $state['name']) { - Configuration::updateValue(Mollie\Config\Config::MOLLIE_STATUS_PARTIAL_REFUND, (int)$state[OrderState::$definition['primary']]); - $stateExists = true; - break; - } - } - if (!$stateExists) { - $orderState = new OrderState(); - $orderState->send_email = false; - $orderState->color = '#6F8C9F'; - $orderState->hidden = false; - $orderState->delivery = false; - $orderState->logable = false; - $orderState->invoice = false; - $orderState->module_name = $this->module->name; - $orderState->name = []; - $languages = Language::getLanguages(false); - foreach ($languages as $language) { - $orderState->name[$language['id_lang']] = $this->module->lang('Mollie partially refunded'); - } - if ($orderState->add()) { - $source = _PS_MODULE_DIR_ . 'mollie/views/img/logo_small.png'; - $destination = _PS_ROOT_DIR_ . '/img/os/' . (int)$orderState->id . '.gif'; - @copy($source, $destination); - } - Configuration::updateValue(Mollie\Config\Config::MOLLIE_STATUS_PARTIAL_REFUND, (int)$orderState->id); - } - - return true; - } - - /** - * @param $languageId - * @return bool - * @throws PrestaShopDatabaseException - * @throws PrestaShopException - */ - private function awaitingMollieOrderState($languageId) - { - $stateExists = false; - $states = OrderState::getOrderStates((int)$languageId); - foreach ($states as $state) { - if ($this->module->lang('Awaiting Mollie payment') === $state['name']) { - Configuration::updateValue(Mollie\Config\Config::STATUS_MOLLIE_AWAITING, (int)$state[OrderState::$definition['primary']]); - $stateExists = true; - break; - } - } - if (!$stateExists) { - $orderState = new OrderState(); - $orderState->send_email = false; - $orderState->color = '#4169E1'; - $orderState->hidden = false; - $orderState->delivery = false; - $orderState->logable = false; - $orderState->invoice = false; - $orderState->module_name = $this->module->name; - $orderState->name = []; - $languages = Language::getLanguages(false); - foreach ($languages as $language) { - $orderState->name[$language['id_lang']] = $this->module->lang('Awaiting Mollie payment'); - } - if ($orderState->add()) { - $source = _PS_MODULE_DIR_ . 'mollie/views/img/logo_small.png'; - $destination = _PS_ROOT_DIR_ . '/img/os/' . (int)$orderState->id . '.gif'; - @copy($source, $destination); - } - Configuration::updateValue(Mollie\Config\Config::STATUS_MOLLIE_AWAITING, (int)$orderState->id); - } - - return true; - } - - /** - * @return void - * - */ - protected function initConfig() - { - Configuration::updateValue(Mollie\Config\Config::MOLLIE_API_KEY, ''); - Configuration::updateValue(Mollie\Config\Config::MOLLIE_PROFILE_ID, ''); - Configuration::updateValue(Mollie\Config\Config::MOLLIE_PAYMENTSCREEN_LOCALE, Mollie\Config\Config::PAYMENTSCREEN_LOCALE_BROWSER_LOCALE); - Configuration::updateValue(Mollie\Config\Config::MOLLIE_IFRAME, false); - Configuration::updateValue(Mollie\Config\Config::MOLLIE_IMAGES, Mollie\Config\Config::LOGOS_NORMAL); - Configuration::updateValue(Mollie\Config\Config::MOLLIE_ISSUERS, Mollie\Config\Config::ISSUERS_ON_CLICK); - Configuration::updateValue(Mollie\Config\Config::MOLLIE_CSS, ''); - Configuration::updateValue(Mollie\Config\Config::MOLLIE_TRACKING_URLS, ''); - Configuration::updateValue(Mollie\Config\Config::MOLLIE_DEBUG_LOG, Mollie\Config\Config::DEBUG_LOG_ERRORS); - Configuration::updateValue(Mollie\Config\Config::MOLLIE_QRENABLED, false); - Configuration::updateValue(Mollie\Config\Config::MOLLIE_METHOD_COUNTRIES, 0); - Configuration::updateValue(Mollie\Config\Config::MOLLIE_METHOD_COUNTRIES_DISPLAY, 0); - Configuration::updateValue(Mollie\Config\Config::MOLLIE_DISPLAY_ERRORS, false); - Configuration::updateValue(Mollie\Config\Config::MOLLIE_STATUS_OPEN, Configuration::get(Mollie\Config\Config::STATUS_MOLLIE_AWAITING)); - Configuration::updateValue(Mollie\Config\Config::MOLLIE_STATUS_PAID, Configuration::get('PS_OS_PAYMENT')); - Configuration::updateValue(Mollie\Config\Config::MOLLIE_STATUS_CANCELED, Configuration::get('PS_OS_CANCELED')); - Configuration::updateValue(Mollie\Config\Config::MOLLIE_STATUS_EXPIRED, Configuration::get('PS_OS_CANCELED')); - Configuration::updateValue( - Mollie\Config\Config::MOLLIE_STATUS_PARTIAL_REFUND, - Configuration::get(Mollie\Config\Config::MOLLIE_STATUS_PARTIAL_REFUND) - ); - Configuration::updateValue(Mollie\Config\Config::MOLLIE_STATUS_REFUNDED, Configuration::get('PS_OS_REFUND')); - Configuration::updateValue(Mollie\Config\Config::MOLLIE_MAIL_WHEN_PAID, true); - Configuration::updateValue(Mollie\Config\Config::MOLLIE_MAIL_WHEN_CANCELED, true); - Configuration::updateValue(Mollie\Config\Config::MOLLIE_MAIL_WHEN_EXPIRED, true); - Configuration::updateValue(Mollie\Config\Config::MOLLIE_MAIL_WHEN_REFUNDED, true); - Configuration::updateValue(Mollie\Config\Config::MOLLIE_ACCOUNT_SWITCH, false); - Configuration::updateValue(Mollie\Config\Config::MOLLIE_CSS, ''); - - Configuration::updateValue(Mollie\Config\Config::MOLLIE_API, Mollie\Config\Config::MOLLIE_ORDERS_API); - } - - /*** - * - */ - public function setDefaultCarrierStatuses() - { - $sql = new DbQuery(); - $sql->select('`' . bqSQL(OrderState::$definition['primary']) . '`'); - $sql->from(bqSQL(OrderState::$definition['table'])); - $sql->where('`shipped` = 1'); - - $defaultStatuses = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); - if (!is_array($defaultStatuses)) { - return; - } - $defaultStatuses = array_map('intval', array_column($defaultStatuses, OrderState::$definition['primary'])); - Configuration::updateValue(Mollie\Config\Config::MOLLIE_AUTO_SHIP_STATUSES, json_encode($defaultStatuses)); - } + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Install; + +use Configuration; +use Context; +use Db; +use DbQuery; +use Exception; +use Language; +use Mollie; +use OrderState; +use PrestaShopDatabaseException; +use PrestaShopException; + +class Installer +{ + /** + * @var array + */ + private $errors = []; + + /** + * @var Mollie + */ + private $module; + + public function __construct(Mollie $module) + { + $this->module = $module; + } + + public function install() + { + foreach (self::getHooks() as $hook) { + $this->module->registerHook($hook); + } + + $context = Context::getContext(); + + try { + $this->partialRefundOrderState($context->language->id); + } catch (Exception $e) { + $this->errors[] = $this->module->l('Unable to install Mollie partially refunded order state'); + return false; + } + try { + $this->awaitingMollieOrderState($context->language->id); + } catch (Exception $e) { + $this->errors[] = $this->module->l('Unable to install Mollie awaiting state'); + return false; + } + + try { + $this->initConfig(); + } catch (Exception $e) { + $this->errors[] = $this->module->l('Unable to install config'); + return false; + } + try { + $this->setDefaultCarrierStatuses(); + } catch (Exception $e) { + $this->errors[] = $this->module->l('Unable to install default carrier statuses'); + return false; + } + + include(dirname(__FILE__) . '/../../sql/install.php'); + + return true; + } + + public function getErrors() + { + return $this->errors; + } + + public static function getHooks() + { + return [ + 'displayPayment', + 'displayPaymentEU', + 'paymentOptions', + 'displayAdminOrder', + 'displayBackOfficeHeader', + 'displayOrderConfirmation', + 'actionFrontControllerSetMedia', + 'actionEmailSendBefore', + 'actionOrderStatusUpdate', + 'displayPDFInvoice' + ]; + } + + /** + * Create new order state for partial refunds. + * + * @return boolean + * @throws PrestaShopDatabaseException + * @throws PrestaShopException + * @throws Adapter_Exception + * @since 2.0.0 + * + */ + private function partialRefundOrderState($languageId) + { + $stateExists = false; + $states = OrderState::getOrderStates((int)$languageId); + foreach ($states as $state) { + if ($this->module->lang('Mollie partially refunded') === $state['name']) { + Configuration::updateValue(Mollie\Config\Config::MOLLIE_STATUS_PARTIAL_REFUND, (int)$state[OrderState::$definition['primary']]); + $stateExists = true; + break; + } + } + if (!$stateExists) { + $orderState = new OrderState(); + $orderState->send_email = false; + $orderState->color = '#6F8C9F'; + $orderState->hidden = false; + $orderState->delivery = false; + $orderState->logable = false; + $orderState->invoice = false; + $orderState->module_name = $this->module->name; + $orderState->name = []; + $languages = Language::getLanguages(false); + foreach ($languages as $language) { + $orderState->name[$language['id_lang']] = $this->module->lang('Mollie partially refunded'); + } + if ($orderState->add()) { + $source = _PS_MODULE_DIR_ . 'mollie/views/img/logo_small.png'; + $destination = _PS_ROOT_DIR_ . '/img/os/' . (int)$orderState->id . '.gif'; + @copy($source, $destination); + } + Configuration::updateValue(Mollie\Config\Config::MOLLIE_STATUS_PARTIAL_REFUND, (int)$orderState->id); + } + + return true; + } + + /** + * @param $languageId + * @return bool + * @throws PrestaShopDatabaseException + * @throws PrestaShopException + */ + private function awaitingMollieOrderState($languageId) + { + $stateExists = false; + $states = OrderState::getOrderStates((int)$languageId); + foreach ($states as $state) { + if ($this->module->lang('Awaiting Mollie payment') === $state['name']) { + Configuration::updateValue(Mollie\Config\Config::STATUS_MOLLIE_AWAITING, (int)$state[OrderState::$definition['primary']]); + $stateExists = true; + break; + } + } + if (!$stateExists) { + $orderState = new OrderState(); + $orderState->send_email = false; + $orderState->color = '#4169E1'; + $orderState->hidden = false; + $orderState->delivery = false; + $orderState->logable = false; + $orderState->invoice = false; + $orderState->module_name = $this->module->name; + $orderState->name = []; + $languages = Language::getLanguages(false); + foreach ($languages as $language) { + $orderState->name[$language['id_lang']] = $this->module->lang('Awaiting Mollie payment'); + } + if ($orderState->add()) { + $source = _PS_MODULE_DIR_ . 'mollie/views/img/logo_small.png'; + $destination = _PS_ROOT_DIR_ . '/img/os/' . (int)$orderState->id . '.gif'; + @copy($source, $destination); + } + Configuration::updateValue(Mollie\Config\Config::STATUS_MOLLIE_AWAITING, (int)$orderState->id); + } + + return true; + } + + /** + * @return void + * + */ + protected function initConfig() + { + Configuration::updateValue(Mollie\Config\Config::MOLLIE_API_KEY, ''); + Configuration::updateValue(Mollie\Config\Config::MOLLIE_PROFILE_ID, ''); + Configuration::updateValue(Mollie\Config\Config::MOLLIE_PAYMENTSCREEN_LOCALE, Mollie\Config\Config::PAYMENTSCREEN_LOCALE_BROWSER_LOCALE); + Configuration::updateValue(Mollie\Config\Config::MOLLIE_IFRAME, false); + Configuration::updateValue(Mollie\Config\Config::MOLLIE_IMAGES, Mollie\Config\Config::LOGOS_NORMAL); + Configuration::updateValue(Mollie\Config\Config::MOLLIE_ISSUERS, Mollie\Config\Config::ISSUERS_ON_CLICK); + Configuration::updateValue(Mollie\Config\Config::MOLLIE_CSS, ''); + Configuration::updateValue(Mollie\Config\Config::MOLLIE_TRACKING_URLS, ''); + Configuration::updateValue(Mollie\Config\Config::MOLLIE_DEBUG_LOG, Mollie\Config\Config::DEBUG_LOG_ERRORS); + Configuration::updateValue(Mollie\Config\Config::MOLLIE_QRENABLED, false); + Configuration::updateValue(Mollie\Config\Config::MOLLIE_METHOD_COUNTRIES, 0); + Configuration::updateValue(Mollie\Config\Config::MOLLIE_METHOD_COUNTRIES_DISPLAY, 0); + Configuration::updateValue(Mollie\Config\Config::MOLLIE_DISPLAY_ERRORS, false); + Configuration::updateValue(Mollie\Config\Config::MOLLIE_STATUS_OPEN, Configuration::get(Mollie\Config\Config::STATUS_MOLLIE_AWAITING)); + Configuration::updateValue(Mollie\Config\Config::MOLLIE_STATUS_PAID, Configuration::get('PS_OS_PAYMENT')); + Configuration::updateValue(Mollie\Config\Config::MOLLIE_STATUS_CANCELED, Configuration::get('PS_OS_CANCELED')); + Configuration::updateValue(Mollie\Config\Config::MOLLIE_STATUS_EXPIRED, Configuration::get('PS_OS_CANCELED')); + Configuration::updateValue( + Mollie\Config\Config::MOLLIE_STATUS_PARTIAL_REFUND, + Configuration::get(Mollie\Config\Config::MOLLIE_STATUS_PARTIAL_REFUND) + ); + Configuration::updateValue(Mollie\Config\Config::MOLLIE_STATUS_REFUNDED, Configuration::get('PS_OS_REFUND')); + Configuration::updateValue(Mollie\Config\Config::MOLLIE_MAIL_WHEN_PAID, true); + Configuration::updateValue(Mollie\Config\Config::MOLLIE_MAIL_WHEN_CANCELED, true); + Configuration::updateValue(Mollie\Config\Config::MOLLIE_MAIL_WHEN_EXPIRED, true); + Configuration::updateValue(Mollie\Config\Config::MOLLIE_MAIL_WHEN_REFUNDED, true); + Configuration::updateValue(Mollie\Config\Config::MOLLIE_ACCOUNT_SWITCH, false); + Configuration::updateValue(Mollie\Config\Config::MOLLIE_CSS, ''); + + Configuration::updateValue(Mollie\Config\Config::MOLLIE_API, Mollie\Config\Config::MOLLIE_ORDERS_API); + } + + /*** + * + */ + public function setDefaultCarrierStatuses() + { + $sql = new DbQuery(); + $sql->select('`' . bqSQL(OrderState::$definition['primary']) . '`'); + $sql->from(bqSQL(OrderState::$definition['table'])); + $sql->where('`shipped` = 1'); + + $defaultStatuses = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); + if (!is_array($defaultStatuses)) { + return; + } + $defaultStatuses = array_map('intval', array_column($defaultStatuses, OrderState::$definition['primary'])); + Configuration::updateValue(Mollie\Config\Config::MOLLIE_AUTO_SHIP_STATUSES, json_encode($defaultStatuses)); + } } \ No newline at end of file diff --git a/src/Install/Uninstall.php b/src/Install/Uninstall.php index 74821cfc3..915670313 100644 --- a/src/Install/Uninstall.php +++ b/src/Install/Uninstall.php @@ -1,72 +1,105 @@ -module = $module; - } - - public function uninstall() - { - $this->deleteConfig(); - - include(dirname(__FILE__) . '/../../sql/uninstall.php'); - - return true; - } - - public function getErrors() - { - return $this->errors; - } - - private function deleteConfig() - { - Configuration::deleteByName(Config::MOLLIE_API_KEY); - Configuration::deleteByName(Config::MOLLIE_PROFILE_ID); - Configuration::deleteByName(Config::MOLLIE_PAYMENTSCREEN_LOCALE); - Configuration::deleteByName(Config::MOLLIE_IFRAME); - Configuration::deleteByName(Config::MOLLIE_IMAGES); - Configuration::deleteByName(Config::MOLLIE_ISSUERS); - Configuration::deleteByName(Config::MOLLIE_CSS); - Configuration::deleteByName(Config::MOLLIE_DEBUG_LOG); - Configuration::deleteByName(Config::MOLLIE_QRENABLED); - Configuration::deleteByName(Config::MOLLIE_DISPLAY_ERRORS); - Configuration::deleteByName(Config::MOLLIE_STATUS_OPEN); - Configuration::deleteByName(Config::MOLLIE_STATUS_PAID); - Configuration::deleteByName(Config::MOLLIE_STATUS_CANCELED); - Configuration::deleteByName(Config::MOLLIE_STATUS_EXPIRED); - Configuration::deleteByName(Config::MOLLIE_STATUS_PARTIAL_REFUND); - Configuration::deleteByName(Config::MOLLIE_STATUS_REFUNDED); - Configuration::deleteByName(Config::MOLLIE_MAIL_WHEN_OPEN); - Configuration::deleteByName(Config::MOLLIE_MAIL_WHEN_PAID); - Configuration::deleteByName(Config::MOLLIE_MAIL_WHEN_CANCELED); - Configuration::deleteByName(Config::MOLLIE_MAIL_WHEN_EXPIRED); - Configuration::deleteByName(Config::MOLLIE_MAIL_WHEN_REFUNDED); - Configuration::deleteByName(Config::MOLLIE_ACCOUNT_SWITCH); - Configuration::deleteByName(Config::MOLLIE_METHOD_COUNTRIES); - Configuration::deleteByName(Config::MOLLIE_METHOD_COUNTRIES_DISPLAY); - Configuration::deleteByName(Config::MOLLIE_API); - Configuration::deleteByName(Config::MOLLIE_AUTO_SHIP_STATUSES); - Configuration::deleteByName(Config::MOLLIE_TRACKING_URLS); - Configuration::deleteByName(Config::MOLLIE_METHODS_LAST_CHECK); - Configuration::deleteByName(Config::METHODS_CONFIG); - } + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Install; + +use Configuration; +use Mollie; +use Mollie\Config\Config; + +class Uninstall +{ + /** + * @var array + */ + private $errors = []; + + /** + * @var Mollie + */ + private $module; + + public function __construct(Mollie $module) + { + $this->module = $module; + } + + public function uninstall() + { + $this->deleteConfig(); + + include(dirname(__FILE__) . '/../../sql/uninstall.php'); + + return true; + } + + public function getErrors() + { + return $this->errors; + } + + private function deleteConfig() + { + Configuration::deleteByName(Config::MOLLIE_API_KEY); + Configuration::deleteByName(Config::MOLLIE_PROFILE_ID); + Configuration::deleteByName(Config::MOLLIE_PAYMENTSCREEN_LOCALE); + Configuration::deleteByName(Config::MOLLIE_IFRAME); + Configuration::deleteByName(Config::MOLLIE_IMAGES); + Configuration::deleteByName(Config::MOLLIE_ISSUERS); + Configuration::deleteByName(Config::MOLLIE_CSS); + Configuration::deleteByName(Config::MOLLIE_DEBUG_LOG); + Configuration::deleteByName(Config::MOLLIE_QRENABLED); + Configuration::deleteByName(Config::MOLLIE_DISPLAY_ERRORS); + Configuration::deleteByName(Config::MOLLIE_STATUS_OPEN); + Configuration::deleteByName(Config::MOLLIE_STATUS_PAID); + Configuration::deleteByName(Config::MOLLIE_STATUS_CANCELED); + Configuration::deleteByName(Config::MOLLIE_STATUS_EXPIRED); + Configuration::deleteByName(Config::MOLLIE_STATUS_PARTIAL_REFUND); + Configuration::deleteByName(Config::MOLLIE_STATUS_REFUNDED); + Configuration::deleteByName(Config::MOLLIE_MAIL_WHEN_OPEN); + Configuration::deleteByName(Config::MOLLIE_MAIL_WHEN_PAID); + Configuration::deleteByName(Config::MOLLIE_MAIL_WHEN_CANCELED); + Configuration::deleteByName(Config::MOLLIE_MAIL_WHEN_EXPIRED); + Configuration::deleteByName(Config::MOLLIE_MAIL_WHEN_REFUNDED); + Configuration::deleteByName(Config::MOLLIE_ACCOUNT_SWITCH); + Configuration::deleteByName(Config::MOLLIE_METHOD_COUNTRIES); + Configuration::deleteByName(Config::MOLLIE_METHOD_COUNTRIES_DISPLAY); + Configuration::deleteByName(Config::MOLLIE_API); + Configuration::deleteByName(Config::MOLLIE_AUTO_SHIP_STATUSES); + Configuration::deleteByName(Config::MOLLIE_TRACKING_URLS); + Configuration::deleteByName(Config::MOLLIE_METHODS_LAST_CHECK); + Configuration::deleteByName(Config::METHODS_CONFIG); + } } \ No newline at end of file diff --git a/src/Install/index.php b/src/Install/index.php new file mode 100644 index 000000000..9e462a606 --- /dev/null +++ b/src/Install/index.php @@ -0,0 +1,44 @@ + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/src/Repository/CountryRepository.php b/src/Repository/CountryRepository.php index e1e597471..a9a1d8442 100644 --- a/src/Repository/CountryRepository.php +++ b/src/Repository/CountryRepository.php @@ -1,51 +1,84 @@ -executeS($sql); - $countryIdsArray = []; - foreach ($countryIds as $countryId) { - $countryIdsArray[] = $countryId['id_country']; - } - - return $countryIdsArray; - } - - public function updatePaymentMethodCountries($idMethod, $idCountries) - { - - $sql = 'DELETE FROM ' . _DB_PREFIX_ . 'mol_country WHERE `id_method` = "' . $idMethod . '"'; - if (!Db::getInstance()->execute($sql)) { - return false; - } - - if ($idCountries == false) { - return true; - } - - $response = true; - foreach ($idCountries as $idCountry) { - $allCountries = 0; - $sql = 'INSERT INTO `' . _DB_PREFIX_ . 'mol_country` (id_method, id_country, all_countries) VALUES ('; - - if ($idCountry === '0') { - $allCountries = 1; - } - $sql .= '"' . pSQL($idMethod) . '", ' . (int)$idCountry . ', ' . (int)$allCountries . ')'; - - if (!Db::getInstance()->execute($sql)) { - $response = false; - } - } - - return $response; - } + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Repository; + +use Db; + +class CountryRepository +{ + public function getMethodCountryIds($methodId) + { + $sql = 'SELECT id_country FROM `' . _DB_PREFIX_ . 'mol_country` WHERE id_method = "' . pSQL($methodId) . '"'; + + $countryIds = Db::getInstance()->executeS($sql); + $countryIdsArray = []; + foreach ($countryIds as $countryId) { + $countryIdsArray[] = $countryId['id_country']; + } + + return $countryIdsArray; + } + + public function updatePaymentMethodCountries($idMethod, $idCountries) + { + + $sql = 'DELETE FROM ' . _DB_PREFIX_ . 'mol_country WHERE `id_method` = "' . $idMethod . '"'; + if (!Db::getInstance()->execute($sql)) { + return false; + } + + if ($idCountries == false) { + return true; + } + + $response = true; + foreach ($idCountries as $idCountry) { + $allCountries = 0; + $sql = 'INSERT INTO `' . _DB_PREFIX_ . 'mol_country` (id_method, id_country, all_countries) VALUES ('; + + if ($idCountry === '0') { + $allCountries = 1; + } + $sql .= '"' . pSQL($idMethod) . '", ' . (int)$idCountry . ', ' . (int)$allCountries . ')'; + + if (!Db::getInstance()->execute($sql)) { + $response = false; + } + } + + return $response; + } } \ No newline at end of file diff --git a/src/Repository/MethodCountryRepository.php b/src/Repository/MethodCountryRepository.php index 5010c02dd..d113444d6 100644 --- a/src/Repository/MethodCountryRepository.php +++ b/src/Repository/MethodCountryRepository.php @@ -1,20 +1,53 @@ -select('`id_mol_country`'); - $sql->from('mol_country'); - $sql->where('`id_method` = "' . pSQL($methodId) . '" AND ( id_country = ' . (int)$countryId . ' OR all_countries = 1)'); - - return Db::getInstance()->getValue($sql); - } + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Repository; + +use Db; +use DbQuery; + +class MethodCountryRepository +{ + + public function checkIfMethodIsAvailableInCountry($methodId, $countryId) + { + $sql = new DbQuery(); + $sql->select('`id_mol_country`'); + $sql->from('mol_country'); + $sql->where('`id_method` = "' . pSQL($methodId) . '" AND ( id_country = ' . (int)$countryId . ' OR all_countries = 1)'); + + return Db::getInstance()->getValue($sql); + } } \ No newline at end of file diff --git a/src/Repository/ModuleRepository.php b/src/Repository/ModuleRepository.php index 85c753ae6..d9cbb5eca 100644 --- a/src/Repository/ModuleRepository.php +++ b/src/Repository/ModuleRepository.php @@ -1,4 +1,37 @@ + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ namespace Mollie\Repository; diff --git a/src/Repository/MolCarrierInformationRepository.php b/src/Repository/MolCarrierInformationRepository.php index cc5e7e64b..62fd9d74c 100644 --- a/src/Repository/MolCarrierInformationRepository.php +++ b/src/Repository/MolCarrierInformationRepository.php @@ -1,19 +1,53 @@ -select('id_mol_carrier_information'); - $sql->from('mol_carrier_information'); - $sql->where('`id_carrier` = ' . (int)$carrierId . ''); - - return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); - } + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Repository; + +use Db; +use DbQuery; + +class MolCarrierInformationRepository +{ + public function getMollieCarrierInformationIdByCarrierId($carrierId) + { + $sql = new DbQuery(); + $sql->select('id_mol_carrier_information'); + $sql->from('mol_carrier_information'); + $sql->where('`id_carrier` = ' . (int)$carrierId . ''); + + return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); + } + } \ No newline at end of file diff --git a/src/Repository/OrderFeeRepository.php b/src/Repository/OrderFeeRepository.php index 025cd3e95..fe876e8b8 100644 --- a/src/Repository/OrderFeeRepository.php +++ b/src/Repository/OrderFeeRepository.php @@ -1,15 +1,48 @@ -getValue($sql); - } + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Repository; + +use Db; + +class OrderFeeRepository +{ + public function getOrderFeeIdByCartId($cartId) + { + $sql = 'Select id_mol_order_fee FROM `' . _DB_PREFIX_ . 'mol_order_fee` WHERE id_cart = "' . (int)$cartId . '"'; + + return Db::getInstance()->getValue($sql); + } } \ No newline at end of file diff --git a/src/Repository/OrderShipmentRepository.php b/src/Repository/OrderShipmentRepository.php index d9772daac..4031de143 100644 --- a/src/Repository/OrderShipmentRepository.php +++ b/src/Repository/OrderShipmentRepository.php @@ -1,19 +1,52 @@ -select('`tracktrace`, `postcode`'); - $sql->from(bqSQL($table)); - $sql->where('`id_order` = "' . pSQL($orderId) . '"'); - - return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql); - } + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Repository; + +use Db; +use DbQuery; + +class OrderShipmentRepository +{ + public function getShipmentInformation($table, $orderId) + { + $sql = new DbQuery(); + $sql->select('`tracktrace`, `postcode`'); + $sql->from(bqSQL($table)); + $sql->where('`id_order` = "' . pSQL($orderId) . '"'); + + return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql); + } } \ No newline at end of file diff --git a/src/Repository/PaymentMethodRepository.php b/src/Repository/PaymentMethodRepository.php index 599749e26..06efcf1de 100644 --- a/src/Repository/PaymentMethodRepository.php +++ b/src/Repository/PaymentMethodRepository.php @@ -1,118 +1,151 @@ -getValue($sql); - } - - public function deletePaymentMethodIssuersByPaymentMethodId($paymentMethodId) - { - $sql = 'DELETE FROM `' . _DB_PREFIX_ . 'mol_payment_method_issuer` WHERE id_payment_method = "' . pSQL($paymentMethodId) . '"'; - - return Db::getInstance()->execute($sql); - } - - public function getPaymentMethodIdByMethodId($paymentMethodId) - { - $sql = 'SELECT id_payment_method FROM `' . _DB_PREFIX_ . 'mol_payment_method` WHERE id_method = "' . pSQL($paymentMethodId) . '"'; - - return Db::getInstance()->getValue($sql); - } - - - /** - * @param string $column - * @param int $id - * - * @return array - * @throws PrestaShopDatabaseException - * @throws PrestaShopException - * - * @since 3.3.0 static function - */ - public function getPaymentBy($column, $id) - { - try { - $paidPayment = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow( - sprintf( - 'SELECT * FROM `%s` WHERE `%s` = \'%s\' AND `bank_status` IN(\'%s\', \'%s\')', - _DB_PREFIX_ . 'mollie_payments', - bqSQL($column), - pSQL($id), - PaymentStatus::STATUS_PAID, - PaymentStatus::STATUS_AUTHORIZED - ) - ); - } catch (PrestaShopDatabaseException $e) { - static::tryAddOrderReferenceColumn(); - throw $e; - } - - if ($paidPayment) { - return $paidPayment; - } - - try { - $nonPaidPayment = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow( - sprintf( - 'SELECT * FROM `%s` WHERE `%s` = \'%s\' ORDER BY `created_at` DESC', - _DB_PREFIX_ . 'mollie_payments', - bqSQL($column), - pSQL($id) - ) - ); - } catch (PrestaShopDatabaseException $e) { - $this->tryAddOrderReferenceColumn(); - throw $e; - } - - return $nonPaidPayment; - } - - /** - * Add the order reference column in case the module upgrade script hasn't run - * - * @return bool - * - * @since 3.3.0 - */ - public function tryAddOrderReferenceColumn() - { - try { - if (!Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' - SELECT COUNT(*) - FROM information_schema.COLUMNS - WHERE TABLE_SCHEMA = \'' . _DB_NAME_ . '\' - AND TABLE_NAME = \'' . _DB_PREFIX_ . 'mollie_payments\' - AND COLUMN_NAME = \'order_reference\'') - ) { - return Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'mollie_payments` ADD `order_reference` varchar(191)'); - } - } catch (PrestaShopException $e) { - return false; - } - - return true; - } - - public function getMethodsForCheckout() - { - $sql = new DbQuery(); - $sql->select('*'); - $sql->from('mol_payment_method'); - - return Db::getInstance()->executeS($sql); - } + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Repository; + +use _PhpScoper5ea00cc67502b\Mollie\Api\Types\PaymentStatus; +use Db; +use DbQuery; +use PrestaShopDatabaseException; +use PrestaShopException; + +class PaymentMethodRepository +{ + public function getPaymentMethodIssuersByPaymentMethodId($paymentMethodId) + { + $sql = 'Select issuers_json FROM `' . _DB_PREFIX_ . 'mol_payment_method_issuer` WHERE id_payment_method = "' . pSQL($paymentMethodId) . '"'; + + return Db::getInstance()->getValue($sql); + } + + public function deletePaymentMethodIssuersByPaymentMethodId($paymentMethodId) + { + $sql = 'DELETE FROM `' . _DB_PREFIX_ . 'mol_payment_method_issuer` WHERE id_payment_method = "' . pSQL($paymentMethodId) . '"'; + + return Db::getInstance()->execute($sql); + } + + public function getPaymentMethodIdByMethodId($paymentMethodId) + { + $sql = 'SELECT id_payment_method FROM `' . _DB_PREFIX_ . 'mol_payment_method` WHERE id_method = "' . pSQL($paymentMethodId) . '"'; + + return Db::getInstance()->getValue($sql); + } + + + /** + * @param string $column + * @param int $id + * + * @return array + * @throws PrestaShopDatabaseException + * @throws PrestaShopException + * + * @since 3.3.0 static function + */ + public function getPaymentBy($column, $id) + { + try { + $paidPayment = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow( + sprintf( + 'SELECT * FROM `%s` WHERE `%s` = \'%s\' AND `bank_status` IN(\'%s\', \'%s\')', + _DB_PREFIX_ . 'mollie_payments', + bqSQL($column), + pSQL($id), + PaymentStatus::STATUS_PAID, + PaymentStatus::STATUS_AUTHORIZED + ) + ); + } catch (PrestaShopDatabaseException $e) { + static::tryAddOrderReferenceColumn(); + throw $e; + } + + if ($paidPayment) { + return $paidPayment; + } + + try { + $nonPaidPayment = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow( + sprintf( + 'SELECT * FROM `%s` WHERE `%s` = \'%s\' ORDER BY `created_at` DESC', + _DB_PREFIX_ . 'mollie_payments', + bqSQL($column), + pSQL($id) + ) + ); + } catch (PrestaShopDatabaseException $e) { + $this->tryAddOrderReferenceColumn(); + throw $e; + } + + return $nonPaidPayment; + } + + /** + * Add the order reference column in case the module upgrade script hasn't run + * + * @return bool + * + * @since 3.3.0 + */ + public function tryAddOrderReferenceColumn() + { + try { + if (!Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' + SELECT COUNT(*) + FROM information_schema.COLUMNS + WHERE TABLE_SCHEMA = \'' . _DB_NAME_ . '\' + AND TABLE_NAME = \'' . _DB_PREFIX_ . 'mollie_payments\' + AND COLUMN_NAME = \'order_reference\'') + ) { + return Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'mollie_payments` ADD `order_reference` varchar(191)'); + } + } catch (PrestaShopException $e) { + return false; + } + + return true; + } + + public function getMethodsForCheckout() + { + $sql = new DbQuery(); + $sql->select('*'); + $sql->from('mol_payment_method'); + + return Db::getInstance()->executeS($sql); + } } \ No newline at end of file diff --git a/src/Repository/index.php b/src/Repository/index.php new file mode 100644 index 000000000..9e462a606 --- /dev/null +++ b/src/Repository/index.php @@ -0,0 +1,44 @@ + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/src/Service/ApiService.php b/src/Service/ApiService.php index 403dfdef1..52f395b0f 100644 --- a/src/Service/ApiService.php +++ b/src/Service/ApiService.php @@ -1,412 +1,451 @@ -methodRepository = $methodRepository; - $this->countryRepository = $countryRepository; - } - - public function setApiKey($apiKey, $moduleVersion) - { - $api = new MollieApiClient(); - $context = Context::getContext(); - if ($apiKey) { - try { - $api->setApiKey($apiKey); - } catch (ApiException $e) { - return; - } - } elseif (!empty($context->employee) - && Tools::getValue('Mollie_Api_Key') - && $context->controller instanceof AdminModulesController - ) { - $api->setApiKey(Tools::getValue('Mollie_Api_Key')); - } - if (defined('_TB_VERSION_')) { - $api->addVersionString('ThirtyBees/' . _TB_VERSION_); - $api->addVersionString("MollieThirtyBees/{$moduleVersion}"); - } else { - $api->addVersionString('PrestaShop/' . _PS_VERSION_); - $api->addVersionString("MolliePrestaShop/{$moduleVersion}"); - } - - return $api; - } - - /** - * Get payment methods to show on the configuration page - * - * @param $api - * @param $path - * @param bool $active Active methods only - * - * @return array - * - * @since 3.0.0 - * @since 3.4.0 public - * - * @public ✓ This method is part of the public API - */ - public function getMethodsForConfig($api, $path, $active = false) - { - $notAvailable = []; - try { - $apiMethods = $api->methods->all(['resource' => 'orders', 'include' => 'issuers', 'includeWallets' => 'applepay'])->getArrayCopy(); - } catch (Exception $e) { - $this->errors[] = $e->getMessage(); - return []; - } - - if (!count($apiMethods)) { - return []; - } - - $dbMethods = @json_decode(Configuration::get(Config::METHODS_CONFIG), true); - if (!$dbMethods) { - $dbMethods = []; - } - $keys = ['id', 'name', 'enabled', 'image', 'issuers', 'position']; - foreach ($dbMethods as $index => $dbMethod) { - if (count(array_intersect($keys, array_keys($dbMethod))) !== count($keys)) { - unset($dbMethods[$index]); - } - } - - if (!is_array($dbMethods)) { - $dbMethods = []; - $configMethods = []; - } else { - $configMethods = []; - foreach ($dbMethods as $dbMethod) { - $configMethods[$dbMethod['id']] = $dbMethod; - } - } - - $methodsFromDb = array_keys($configMethods); - $methods = []; - $deferredMethods = []; - $isSSLEnabled = Configuration::get('PS_SSL_ENABLED_EVERYWHERE'); - foreach ($apiMethods as $apiMethod) { - $tipEnableSSL = false; - if ($apiMethod->id === Config::APPLEPAY && !$isSSLEnabled) { - $notAvailable[] = $apiMethod->id; - $tipEnableSSL = true; - } - if (!in_array($apiMethod->id, $methodsFromDb) || !isset($configMethods[$apiMethod->id]['position'])) { - $deferredMethods[] = [ - 'id' => $apiMethod->id, - 'name' => $apiMethod->description, - 'enabled' => true, - 'available' => !in_array($apiMethod->id, $notAvailable), - 'image' => (array)$apiMethod->image, - 'issuers' => $apiMethod->issuers, - 'tipEnableSSL' => $tipEnableSSL - ]; - } else { - $methods[$configMethods[$apiMethod->id]['position']] = [ - 'id' => $apiMethod->id, - 'name' => $apiMethod->description, - 'enabled' => $configMethods[$apiMethod->id]['enabled'], - 'available' => !in_array($apiMethod->id, $notAvailable), - 'image' => (array)$apiMethod->image, - 'issuers' => $apiMethod->issuers, - 'tipEnableSSL' => $tipEnableSSL - ]; - } - } - $availableApiMethods = array_column(array_map(function ($apiMethod) { - return (array)$apiMethod; - }, $apiMethods), 'id'); - if (in_array('creditcard', $availableApiMethods)) { - foreach ([\Mollie\Config\Config::CARTES_BANCAIRES => 'Cartes Bancaires'] as $id => $name) { - if (!in_array($id, array_column($dbMethods, 'id'))) { - $deferredMethods[] = [ - 'id' => $id, - 'name' => $name, - 'enabled' => true, - 'available' => !in_array($id, $notAvailable), - 'image' => [ - 'size1x' => \Mollie\Utility\UrlPathUtility::getMediaPath("{$path}views/img/{$id}_small.png"), - 'size2x' => \Mollie\Utility\UrlPathUtility::getMediaPath("{$path}views/img/{$id}.png"), - 'svg' => \Mollie\Utility\UrlPathUtility::getMediaPath("{$path}views/img/{$id}.svg"), - ], - 'issuers' => null, - ]; - } else { - $cc = $dbMethods[array_search('creditcard', array_column($dbMethods, 'id'))]; - $thisMethod = $dbMethods[array_search($id, array_column($dbMethods, 'id'))]; - $methods[$configMethods[$id]['position']] = [ - 'id' => $id, - 'name' => $name, - 'enabled' => !empty($thisMethod['enabled']) && !empty($cc['enabled']), - 'available' => !in_array($id, $notAvailable), - 'image' => [ - 'size1x' => \Mollie\Utility\UrlPathUtility::getMediaPath("{$path}views/img/{$id}_small.png"), - 'size2x' => \Mollie\Utility\UrlPathUtility::getMediaPath("{$path}views/img/{$id}.png"), - 'svg' => \Mollie\Utility\UrlPathUtility::getMediaPath("{$path}views/img/{$id}.svg"), - ], - 'issuers' => null, - ]; - } - } - } - ksort($methods); - $methods = array_values($methods); - foreach ($deferredMethods as $deferredMethod) { - $methods[] = $deferredMethod; - } - if ($active) { - foreach ($methods as $index => $method) { - if (!$method['enabled']) { - unset($methods[$index]); - } - } - } - - $methods = $this->getMethodsObjForConfig($methods); - $methods = $this->getMethodsCountriesForConfig($methods); - - return $methods; - } - - - private function getMethodsObjForConfig($apiMethods) - { - $methods = []; - $defaultPaymentMethod = new MolPaymentMethod(); - $defaultPaymentMethod->enabled = 0; - $defaultPaymentMethod->title = ''; - $defaultPaymentMethod->method = 'payments'; - $defaultPaymentMethod->description = ''; - $defaultPaymentMethod->is_countries_applicable = false; - $defaultPaymentMethod->minimal_order_value = ''; - $defaultPaymentMethod->max_order_value = ''; - $defaultPaymentMethod->surcharge = 0; - $defaultPaymentMethod->surcharge_fixed_amount = ''; - $defaultPaymentMethod->surcharge_percentage = ''; - $defaultPaymentMethod->surcharge_limit = ''; - - foreach ($apiMethods as $apiMethod) { - $paymentId = $this->methodRepository->getPaymentMethodIdByMethodId($apiMethod['id']); - if ($paymentId) { - $paymentMethod = new MolPaymentMethod($paymentId); - $methods[$apiMethod['id']] = $apiMethod; - $methods[$apiMethod['id']]['obj'] = $paymentMethod; - continue; - } - $defaultPaymentMethod->id_method = $apiMethod['id']; - $defaultPaymentMethod->method_name = $apiMethod['name']; - $methods[$apiMethod['id']] = $apiMethod; - $methods[$apiMethod['id']]['obj'] = $defaultPaymentMethod; - } - - $availableApiMethods = array_column(array_map(function ($apiMethod) { - return (array)$apiMethod; - }, $apiMethods), 'id'); - if (in_array('creditcard', $availableApiMethods)) { - foreach ([\Mollie\Config\Config::CARTES_BANCAIRES => 'Cartes Bancaires'] as $value => $apiMethod) { - $paymentId = $this->methodRepository->getPaymentMethodIdByMethodId($value); - if ($paymentId) { - $paymentMethod = new MolPaymentMethod($paymentId); - $methods[$value]['obj'] = $paymentMethod; - continue; - } - $defaultPaymentMethod->id_method = $value; - $defaultPaymentMethod->method_name = $apiMethod; - $methods[$value]['obj'] = $defaultPaymentMethod; - } - } - - return $methods; - } - - private function getMethodsCountriesForConfig(&$methods) - { - foreach ($methods as $key => $method) { - $methods[$key]['countries'] = $this->countryRepository->getMethodCountryIds($key); - } - - return $methods; - } - - /** - * @param string $transactionId - * @param bool $process Process the new payment/order status - * - * @return array|null - * - * @throws ApiException - * @throws \PrestaShopDatabaseException - * @throws \PrestaShopException - * @throws \PrestaShop\PrestaShop\Adapter\CoreException - * @throws \SmartyException - * @since 3.3.0 - * @since 3.3.2 $process option - */ - public function getFilteredApiPayment($api, $transactionId, $process = false) - { - /** @var Payment $payment */ - $payment = $api->payments->get($transactionId); - if ($process) { - $webhookController = new MollieWebhookModuleFrontController(); - $webhookController->processTransaction($payment); - } - - if ($payment && method_exists($payment, 'refunds')) { - $refunds = $payment->refunds(); - if (empty($refunds)) { - $refunds = []; - } - $refunds = array_map(function ($refund) { - return array_intersect_key( - (array)$refund, - array_flip([ - 'resource', - 'id', - 'amount', - 'createdAt', - ])); - }, (array)$refunds); - $payment = array_intersect_key( - (array)$payment, - array_flip([ - 'resource', - 'id', - 'mode', - 'amount', - 'settlementAmount', - 'amountRefunded', - 'amountRemaining', - 'description', - 'method', - 'status', - 'createdAt', - 'paidAt', - 'canceledAt', - 'expiresAt', - 'failedAt', - 'metadata', - 'isCancelable', - ]) - ); - $payment['refunds'] = (array)$refunds; - } else { - $payment = null; - } - - return $payment; - } - - /** - * @param $api - * @param string $transactionId - * @return array|null - * - * @throws \ErrorException - * @throws ApiException - * @since 3.3.0 - * @since 3.3.2 $process option - */ - public function getFilteredApiOrder($api, $transactionId) - { - /** @var MollieOrderAlias $order */ - $order = $api->orders->get($transactionId, ['embed' => 'payments']); - - if ($order && method_exists($order, 'refunds')) { - $refunds = $order->refunds(); - if (empty($refunds)) { - $refunds = []; - } - $refunds = array_map(function ($refund) { - return array_intersect_key( - (array)$refund, - array_flip([ - 'resource', - 'id', - 'amount', - 'createdAt', - ])); - }, (array)$refunds); - $order = array_intersect_key( - (array)$order, - array_flip([ - 'resource', - 'id', - 'mode', - 'amount', - 'settlementAmount', - 'amountCaptured', - 'status', - 'method', - 'metadata', - 'isCancelable', - 'createdAt', - 'lines', - ]) - ); - $order['refunds'] = (array)$refunds; - } else { - $order = null; - } - - return $order; - } - - - /** - * Get the selected API - * - * @throws PrestaShopException - * - * @since 3.3.0 - * - * @public ✓ This method is part of the public API - */ - public static function selectedApi($selectedApi) - { - if (!in_array($selectedApi, [Config::MOLLIE_ORDERS_API, Config::MOLLIE_PAYMENTS_API])) { - $selectedApi = Configuration::get(Config::MOLLIE_API); - if (!$selectedApi - || !in_array($selectedApi, [Config::MOLLIE_ORDERS_API, Config::MOLLIE_PAYMENTS_API]) - || CartPriceUtility::checkRoundingMode() - ) { - $selectedApi = Config::MOLLIE_PAYMENTS_API; - } - } - - return $selectedApi; - } - + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Service; + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use _PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient; +use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Order as MollieOrderAlias; +use Configuration; +use Context; +use ErrorException; +use Exception; +use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Payment; +use Mollie\Config\Config; +use Mollie\Repository\CountryRepository; +use Mollie\Repository\PaymentMethodRepository; +use Mollie\Utility\CartPriceUtility; +use Mollie\Utility\UrlPathUtility; +use MollieWebhookModuleFrontController; +use MolPaymentMethod; +use PrestaShop\PrestaShop\Adapter\CoreException; +use PrestaShopDatabaseException; +use PrestaShopException; +use SmartyException; +use Tools; + +class ApiService +{ + + private $errors = []; + /** + * @var PaymentMethodRepository + */ + private $methodRepository; + /** + * @var CountryRepository + */ + private $countryRepository; + + public function __construct( + PaymentMethodRepository $methodRepository, + CountryRepository $countryRepository + ) { + $this->methodRepository = $methodRepository; + $this->countryRepository = $countryRepository; + } + + public function setApiKey($apiKey, $moduleVersion) + { + $api = new MollieApiClient(); + $context = Context::getContext(); + if ($apiKey) { + try { + $api->setApiKey($apiKey); + } catch (ApiException $e) { + return; + } + } elseif (!empty($context->employee) + && Tools::getValue('Mollie_Api_Key') + && $context->controller instanceof AdminModulesController + ) { + $api->setApiKey(Tools::getValue('Mollie_Api_Key')); + } + if (defined('_TB_VERSION_')) { + $api->addVersionString('ThirtyBees/' . _TB_VERSION_); + $api->addVersionString("MollieThirtyBees/{$moduleVersion}"); + } else { + $api->addVersionString('PrestaShop/' . _PS_VERSION_); + $api->addVersionString("MolliePrestaShop/{$moduleVersion}"); + } + + return $api; + } + + /** + * Get payment methods to show on the configuration page + * + * @param $api + * @param $path + * @param bool $active Active methods only + * + * @return array + * + * @since 3.0.0 + * @since 3.4.0 public + * + * @public ✓ This method is part of the public API + */ + public function getMethodsForConfig($api, $path, $active = false) + { + $notAvailable = []; + try { + $apiMethods = $api->methods->all(['resource' => 'orders', 'include' => 'issuers', 'includeWallets' => 'applepay'])->getArrayCopy(); + } catch (Exception $e) { + $this->errors[] = $e->getMessage(); + return []; + } + + if (!count($apiMethods)) { + return []; + } + + $dbMethods = @json_decode(Configuration::get(Config::METHODS_CONFIG), true); + if (!$dbMethods) { + $dbMethods = []; + } + $keys = ['id', 'name', 'enabled', 'image', 'issuers', 'position']; + foreach ($dbMethods as $index => $dbMethod) { + if (count(array_intersect($keys, array_keys($dbMethod))) !== count($keys)) { + unset($dbMethods[$index]); + } + } + + if (!is_array($dbMethods)) { + $dbMethods = []; + $configMethods = []; + } else { + $configMethods = []; + foreach ($dbMethods as $dbMethod) { + $configMethods[$dbMethod['id']] = $dbMethod; + } + } + + $methodsFromDb = array_keys($configMethods); + $methods = []; + $deferredMethods = []; + $isSSLEnabled = Configuration::get('PS_SSL_ENABLED_EVERYWHERE'); + foreach ($apiMethods as $apiMethod) { + $tipEnableSSL = false; + if ($apiMethod->id === Config::APPLEPAY && !$isSSLEnabled) { + $notAvailable[] = $apiMethod->id; + $tipEnableSSL = true; + } + if (!in_array($apiMethod->id, $methodsFromDb) || !isset($configMethods[$apiMethod->id]['position'])) { + $deferredMethods[] = [ + 'id' => $apiMethod->id, + 'name' => $apiMethod->description, + 'enabled' => true, + 'available' => !in_array($apiMethod->id, $notAvailable), + 'image' => (array)$apiMethod->image, + 'issuers' => $apiMethod->issuers, + 'tipEnableSSL' => $tipEnableSSL + ]; + } else { + $methods[$configMethods[$apiMethod->id]['position']] = [ + 'id' => $apiMethod->id, + 'name' => $apiMethod->description, + 'enabled' => $configMethods[$apiMethod->id]['enabled'], + 'available' => !in_array($apiMethod->id, $notAvailable), + 'image' => (array)$apiMethod->image, + 'issuers' => $apiMethod->issuers, + 'tipEnableSSL' => $tipEnableSSL + ]; + } + } + $availableApiMethods = array_column(array_map(function ($apiMethod) { + return (array)$apiMethod; + }, $apiMethods), 'id'); + if (in_array('creditcard', $availableApiMethods)) { + foreach ([Config::CARTES_BANCAIRES => 'Cartes Bancaires'] as $id => $name) { + if (!in_array($id, array_column($dbMethods, 'id'))) { + $deferredMethods[] = [ + 'id' => $id, + 'name' => $name, + 'enabled' => true, + 'available' => !in_array($id, $notAvailable), + 'image' => [ + 'size1x' => UrlPathUtility::getMediaPath("{$path}views/img/{$id}_small.png"), + 'size2x' => UrlPathUtility::getMediaPath("{$path}views/img/{$id}.png"), + 'svg' => UrlPathUtility::getMediaPath("{$path}views/img/{$id}.svg"), + ], + 'issuers' => null, + ]; + } else { + $cc = $dbMethods[array_search('creditcard', array_column($dbMethods, 'id'))]; + $thisMethod = $dbMethods[array_search($id, array_column($dbMethods, 'id'))]; + $methods[$configMethods[$id]['position']] = [ + 'id' => $id, + 'name' => $name, + 'enabled' => !empty($thisMethod['enabled']) && !empty($cc['enabled']), + 'available' => !in_array($id, $notAvailable), + 'image' => [ + 'size1x' => UrlPathUtility::getMediaPath("{$path}views/img/{$id}_small.png"), + 'size2x' => UrlPathUtility::getMediaPath("{$path}views/img/{$id}.png"), + 'svg' => UrlPathUtility::getMediaPath("{$path}views/img/{$id}.svg"), + ], + 'issuers' => null, + ]; + } + } + } + ksort($methods); + $methods = array_values($methods); + foreach ($deferredMethods as $deferredMethod) { + $methods[] = $deferredMethod; + } + if ($active) { + foreach ($methods as $index => $method) { + if (!$method['enabled']) { + unset($methods[$index]); + } + } + } + + $methods = $this->getMethodsObjForConfig($methods); + $methods = $this->getMethodsCountriesForConfig($methods); + + return $methods; + } + + + private function getMethodsObjForConfig($apiMethods) + { + $methods = []; + $defaultPaymentMethod = new MolPaymentMethod(); + $defaultPaymentMethod->enabled = 0; + $defaultPaymentMethod->title = ''; + $defaultPaymentMethod->method = 'payments'; + $defaultPaymentMethod->description = ''; + $defaultPaymentMethod->is_countries_applicable = false; + $defaultPaymentMethod->minimal_order_value = ''; + $defaultPaymentMethod->max_order_value = ''; + $defaultPaymentMethod->surcharge = 0; + $defaultPaymentMethod->surcharge_fixed_amount = ''; + $defaultPaymentMethod->surcharge_percentage = ''; + $defaultPaymentMethod->surcharge_limit = ''; + + foreach ($apiMethods as $apiMethod) { + $paymentId = $this->methodRepository->getPaymentMethodIdByMethodId($apiMethod['id']); + if ($paymentId) { + $paymentMethod = new MolPaymentMethod($paymentId); + $methods[$apiMethod['id']] = $apiMethod; + $methods[$apiMethod['id']]['obj'] = $paymentMethod; + continue; + } + $defaultPaymentMethod->id_method = $apiMethod['id']; + $defaultPaymentMethod->method_name = $apiMethod['name']; + $methods[$apiMethod['id']] = $apiMethod; + $methods[$apiMethod['id']]['obj'] = $defaultPaymentMethod; + } + + $availableApiMethods = array_column(array_map(function ($apiMethod) { + return (array)$apiMethod; + }, $apiMethods), 'id'); + if (in_array('creditcard', $availableApiMethods)) { + foreach ([Config::CARTES_BANCAIRES => 'Cartes Bancaires'] as $value => $apiMethod) { + $paymentId = $this->methodRepository->getPaymentMethodIdByMethodId($value); + if ($paymentId) { + $paymentMethod = new MolPaymentMethod($paymentId); + $methods[$value]['obj'] = $paymentMethod; + continue; + } + $defaultPaymentMethod->id_method = $value; + $defaultPaymentMethod->method_name = $apiMethod; + $methods[$value]['obj'] = $defaultPaymentMethod; + } + } + + return $methods; + } + + private function getMethodsCountriesForConfig(&$methods) + { + foreach ($methods as $key => $method) { + $methods[$key]['countries'] = $this->countryRepository->getMethodCountryIds($key); + } + + return $methods; + } + + /** + * @param string $transactionId + * @param bool $process Process the new payment/order status + * + * @return array|null + * + * @throws ApiException + * @throws PrestaShopDatabaseException + * @throws PrestaShopException + * @throws CoreException + * @throws SmartyException + * @since 3.3.0 + * @since 3.3.2 $process option + */ + public function getFilteredApiPayment($api, $transactionId, $process = false) + { + /** @var Payment $payment */ + $payment = $api->payments->get($transactionId); + if ($process) { + $webhookController = new MollieWebhookModuleFrontController(); + $webhookController->processTransaction($payment); + } + + if ($payment && method_exists($payment, 'refunds')) { + $refunds = $payment->refunds(); + if (empty($refunds)) { + $refunds = []; + } + $refunds = array_map(function ($refund) { + return array_intersect_key( + (array)$refund, + array_flip([ + 'resource', + 'id', + 'amount', + 'createdAt', + ])); + }, (array)$refunds); + $payment = array_intersect_key( + (array)$payment, + array_flip([ + 'resource', + 'id', + 'mode', + 'amount', + 'settlementAmount', + 'amountRefunded', + 'amountRemaining', + 'description', + 'method', + 'status', + 'createdAt', + 'paidAt', + 'canceledAt', + 'expiresAt', + 'failedAt', + 'metadata', + 'isCancelable', + ]) + ); + $payment['refunds'] = (array)$refunds; + } else { + $payment = null; + } + + return $payment; + } + + /** + * @param $api + * @param string $transactionId + * @return array|null + * + * @throws ErrorException + * @throws ApiException + * @since 3.3.0 + * @since 3.3.2 $process option + */ + public function getFilteredApiOrder($api, $transactionId) + { + /** @var MollieOrderAlias $order */ + $order = $api->orders->get($transactionId, ['embed' => 'payments']); + + if ($order && method_exists($order, 'refunds')) { + $refunds = $order->refunds(); + if (empty($refunds)) { + $refunds = []; + } + $refunds = array_map(function ($refund) { + return array_intersect_key( + (array)$refund, + array_flip([ + 'resource', + 'id', + 'amount', + 'createdAt', + ])); + }, (array)$refunds); + $order = array_intersect_key( + (array)$order, + array_flip([ + 'resource', + 'id', + 'mode', + 'amount', + 'settlementAmount', + 'amountCaptured', + 'status', + 'method', + 'metadata', + 'isCancelable', + 'createdAt', + 'lines', + ]) + ); + $order['refunds'] = (array)$refunds; + } else { + $order = null; + } + + return $order; + } + + + /** + * Get the selected API + * + * @throws PrestaShopException + * + * @since 3.3.0 + * + * @public ✓ This method is part of the public API + */ + public static function selectedApi($selectedApi) + { + if (!in_array($selectedApi, [Config::MOLLIE_ORDERS_API, Config::MOLLIE_PAYMENTS_API])) { + $selectedApi = Configuration::get(Config::MOLLIE_API); + if (!$selectedApi + || !in_array($selectedApi, [Config::MOLLIE_ORDERS_API, Config::MOLLIE_PAYMENTS_API]) + || CartPriceUtility::checkRoundingMode() + ) { + $selectedApi = Config::MOLLIE_PAYMENTS_API; + } + } + + return $selectedApi; + } + } \ No newline at end of file diff --git a/src/Service/CancelService.php b/src/Service/CancelService.php index bd62f869b..7f3c5c60c 100644 --- a/src/Service/CancelService.php +++ b/src/Service/CancelService.php @@ -1,77 +1,114 @@ -module = $module; - } - - /** - * @param string $transactionId - * @param array $lines - * - * @return array - * - * @throws \PrestaShopDatabaseException - * @throws \PrestaShopException - * @throws \PrestaShop\PrestaShop\Adapter\CoreException - * @throws \SmartyException - * @since 3.3.0 - */ - public function doCancelOrderLines($transactionId, $lines = []) - { - try { - /** @var Order $payment */ - $order = $this->module->api->orders->get($transactionId, ['embed' => 'payments']); - if ($lines === []) { - $order->cancel(); - } else { - $cancelableLines = []; - foreach ($lines as $line) { - $cancelableLines[] = ['id' => $line['id'], 'quantity' => $line['quantity']]; - } - $order->cancelLines(['lines' => $cancelableLines]); - } - - if (EnvironmentUtility::isLocalEnvironment()) { - // Refresh payment on local environments - /** @var Payment $payment */ - $apiPayment = $this->module->api->orders->get($transactionId, ['embed' => 'payments']); - if (!Tools::isSubmit('module')) { - $_GET['module'] = $this->module->name; - } - $webhookController = new MollieWebhookModuleFrontController(); - $webhookController->processTransaction($apiPayment); - } - } catch (ApiException $e) { - return [ - 'success' => false, - 'message' => $this->module->l('The product(s) could not be canceled!'), - 'detailed' => $e->getMessage(), - ]; - } - - return [ - 'success' => true, - 'message' => '', - 'detailed' => '', - ]; - } - + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Service; + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Order; +use Mollie; +use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Payment; +use Mollie\Utility\EnvironmentUtility; +use MollieWebhookModuleFrontController; +use PrestaShop\PrestaShop\Adapter\CoreException; +use PrestaShopDatabaseException; +use PrestaShopException; +use SmartyException; +use Tools; + +class CancelService +{ + /** + * @var Mollie + */ + private $module; + + public function __construct(Mollie $module) + { + $this->module = $module; + } + + /** + * @param string $transactionId + * @param array $lines + * + * @return array + * + * @throws PrestaShopDatabaseException + * @throws PrestaShopException + * @throws CoreException + * @throws SmartyException + * @since 3.3.0 + */ + public function doCancelOrderLines($transactionId, $lines = []) + { + try { + /** @var Order $payment */ + $order = $this->module->api->orders->get($transactionId, ['embed' => 'payments']); + if ($lines === []) { + $order->cancel(); + } else { + $cancelableLines = []; + foreach ($lines as $line) { + $cancelableLines[] = ['id' => $line['id'], 'quantity' => $line['quantity']]; + } + $order->cancelLines(['lines' => $cancelableLines]); + } + + if (EnvironmentUtility::isLocalEnvironment()) { + // Refresh payment on local environments + /** @var Payment $payment */ + $apiPayment = $this->module->api->orders->get($transactionId, ['embed' => 'payments']); + if (!Tools::isSubmit('module')) { + $_GET['module'] = $this->module->name; + } + $webhookController = new MollieWebhookModuleFrontController(); + $webhookController->processTransaction($apiPayment); + } + } catch (ApiException $e) { + return [ + 'success' => false, + 'message' => $this->module->l('The product(s) could not be canceled!'), + 'detailed' => $e->getMessage(), + ]; + } + + return [ + 'success' => true, + 'message' => '', + 'detailed' => '', + ]; + } + } \ No newline at end of file diff --git a/src/Service/CarrierService.php b/src/Service/CarrierService.php deleted file mode 100644 index acd98033b..000000000 --- a/src/Service/CarrierService.php +++ /dev/null @@ -1,54 +0,0 @@ -language->id, - false, - false, - false, - null, - Carrier::ALL_CARRIERS - ); - - $configCarriers = []; - foreach ($carriers as $carrier) { - $idCarrier = (int)$carrier['id_carrier']; - $configCarriers[] = [ - 'id_carrier' => $idCarrier, - 'name' => $carrier['name'], - 'source' => isset($dbConfig[$idCarrier]) ? $trackingUrls[$idCarrier]['source'] : ($carrier['external_module_name'] ? Config::MOLLIE_CARRIER_MODULE : Config::MOLLIE_CARRIER_CARRIER), - 'module' => !empty($carrier['external_module_name']) ? $carrier['external_module_name'] : null, - 'module_name' => !empty($carrier['external_module_name']) ? $carrier['external_module_name'] : null, - 'custom_url' => isset($dbConfig[$idCarrier]) ? $trackingUrls[$idCarrier]['custom_url'] : '', - ]; - } - if (count($trackingUrls) !== count($configCarriers)) { - Configuration::updateValue(Config::MOLLIE_TRACKING_URLS, json_encode($configCarriers)); - } - - return $configCarriers; - } -} \ No newline at end of file diff --git a/src/Service/CartLinesService.php b/src/Service/CartLinesService.php index ea8fc6dd8..3c4bab390 100644 --- a/src/Service/CartLinesService.php +++ b/src/Service/CartLinesService.php @@ -1,267 +1,301 @@ -module = $module; - } - - /** - * @param float $amount - * - * @param $paymentFee - * @param Cart $cart - * @return array - */ - public function getCartLines($amount, $paymentFee, Cart $cart) - { - $oCurrency = new Currency($cart->id_currency); - $apiRoundingPrecision = Mollie\Config\Config::API_ROUNDING_PRECISION; - - $remaining = round($amount, $apiRoundingPrecision); - $shipping = round($cart->getTotalShippingCost(null, true), $apiRoundingPrecision); - $cartSummary = $cart->getSummaryDetails(); - $cartItems = $cart->getProducts(); - $wrapping = Configuration::get('PS_GIFT_WRAPPING') ? round($cartSummary['total_wrapping'], $apiRoundingPrecision) : 0; - $remaining = round($remaining - $shipping - $wrapping, $apiRoundingPrecision); - $totalDiscounts = isset($cartSummary['total_discounts']) ? round($cartSummary['total_discounts'], $apiRoundingPrecision) : 0; - - $aItems = []; - /* Item */ - foreach ($cartItems as $cartItem) { - // Get the rounded total w/ tax - $roundedTotalWithTax = round($cartItem['total_wt'], $apiRoundingPrecision); - - // Skip if no qty - $quantity = (int)$cartItem['cart_quantity']; - if ($quantity <= 0 || $cartItem['price_wt'] <= 0) { - continue; - } - - // Generate the product hash - $idProduct = number_format($cartItem['id_product']); - $idProductAttribute = number_format($cartItem['id_product_attribute']); - $idCustomization = number_format($cartItem['id_customization']); - - $productHash = "{$idProduct}¤{$idProductAttribute}¤{$idCustomization}"; - $aItems[$productHash] = []; - - // Try to spread this product evenly and account for rounding differences on the order line - foreach (\Mollie\Utility\CartPriceUtility::spreadAmountEvenly($roundedTotalWithTax, $quantity) as $unitPrice => $qty) { - $aItems[$productHash][] = [ - 'name' => $cartItem['name'], - 'sku' => $productHash, - 'targetVat' => (float)$cartItem['rate'], - 'quantity' => $qty, - 'unitPrice' => $unitPrice, - 'totalAmount' => (float)$unitPrice * $qty, - ]; - $remaining -= round((float)$unitPrice * $qty, $apiRoundingPrecision); - } - } - - // Add discount if applicable - if ($totalDiscounts >= 0.01) { - $totalDiscountsNoTax = round($cartSummary['total_discounts_tax_exc'], $apiRoundingPrecision); - $vatRate = round((($totalDiscounts - $totalDiscountsNoTax) / $totalDiscountsNoTax) * 100, $apiRoundingPrecision); - - $aItems['discount'] = [ - [ - 'name' => 'Discount', - 'type' => 'discount', - 'quantity' => 1, - 'unitPrice' => -round($totalDiscounts, $apiRoundingPrecision), - 'totalAmount' => -round($totalDiscounts, $apiRoundingPrecision), - 'targetVat' => $vatRate, - ], - ]; - $remaining += $totalDiscounts; - } - - // Compensate for order total rounding inaccuracies - $remaining = round($remaining, $apiRoundingPrecision); - if ($remaining < 0) { - foreach (array_reverse($aItems) as $hash => $items) { - // Grab the line group's total amount - $totalAmount = array_sum(array_column($items, 'totalAmount')); - - // Remove when total is lower than remaining - if ($totalAmount <= $remaining) { - // The line total is less than remaining, we should remove this line group and continue - $remaining = $remaining - $totalAmount; - unset($items); - continue; - } - - // Otherwise spread the cart line again with the updated total - $aItems[$hash] = static::spreadCartLineGroup($items, $totalAmount - $remaining); - break; - } - } elseif ($remaining > 0) { - foreach (array_reverse($aItems) as $hash => $items) { - // Grab the line group's total amount - $totalAmount = array_sum(array_column($items, 'totalAmount')); - // Otherwise spread the cart line again with the updated total - $aItems[$hash] = static::spreadCartLineGroup($items, $totalAmount + $remaining); - break; - } - } - - // Fill the order lines with the rest of the data (tax, total amount, etc.) - foreach ($aItems as $productHash => $aItem) { - $aItems[$productHash] = array_map(function ($line) use ($apiRoundingPrecision, $oCurrency) { - $quantity = (int)$line['quantity']; - $targetVat = $line['targetVat']; - $unitPrice = $line['unitPrice']; - $unitPriceNoTax = round($line['unitPrice'] / (1 + ($targetVat / 100)), $apiRoundingPrecision); - - // Calculate VAT - $totalAmount = round($unitPrice * $quantity, $apiRoundingPrecision); - $actualVatRate = round(($unitPrice * $quantity - $unitPriceNoTax * $quantity) / ($unitPriceNoTax * $quantity) * 100, $apiRoundingPrecision); - $vatAmount = $totalAmount * ($actualVatRate / ($actualVatRate + 100)); - - $newItem = [ - 'name' => $line['name'], - 'quantity' => (int)$quantity, - 'unitPrice' => round($unitPrice, $apiRoundingPrecision), - 'totalAmount' => round($totalAmount, $apiRoundingPrecision), - 'vatRate' => round($actualVatRate, $apiRoundingPrecision), - 'vatAmount' => round($vatAmount, $apiRoundingPrecision), - ]; - if (isset($line['sku'])) { - $newItem['sku'] = $line['sku']; - } - - return $newItem; - }, $aItem); - } - - // Add shipping - if (round($shipping, 2) > 0) { - $shippingVatRate = round(($cartSummary['total_shipping'] - $cartSummary['total_shipping_tax_exc']) / $cartSummary['total_shipping_tax_exc'] * 100, $apiRoundingPrecision); - - $aItems['shipping'] = [ - [ - 'name' => $this->module->l('Shipping'), - 'quantity' => 1, - 'unitPrice' => round($shipping, $apiRoundingPrecision), - 'totalAmount' => round($shipping, $apiRoundingPrecision), - 'vatAmount' => round($shipping * $shippingVatRate / ($shippingVatRate + 100), $apiRoundingPrecision), - 'vatRate' => $shippingVatRate, - ], - ]; - } - - // Add wrapping - if (round($wrapping, 2) > 0) { - $wrappingVatRate = round(($cartSummary['total_wrapping'] - $cartSummary['total_wrapping_tax_exc']) / $cartSummary['total_wrapping_tax_exc'] * 100, $apiRoundingPrecision); - - $aItems['wrapping'] = [ - [ - 'name' => $this->module->l('Gift wrapping'), - 'quantity' => 1, - 'unitPrice' => round($wrapping, $apiRoundingPrecision), - 'totalAmount' => round($wrapping, $apiRoundingPrecision), - 'vatAmount' => round($wrapping * $wrappingVatRate / ($wrappingVatRate + 100), $apiRoundingPrecision), - 'vatRate' => $wrappingVatRate, - ], - ]; - } - - // Add fee - if ($paymentFee) { - $aItems['surcharge'] = [ - [ - 'name' => $this->module->l('Payment Fee'), - 'quantity' => 1, - 'unitPrice' => round($paymentFee, $apiRoundingPrecision), - 'totalAmount' => round($paymentFee, $apiRoundingPrecision), - 'vatAmount' => 0, - 'vatRate' => 0, - ], - ]; - } - - // Ungroup all the cart lines, just one level - $newItems = []; - foreach ($aItems as &$items) { - foreach ($items as &$item) { - $newItems[] = $item; - } - } - - // Convert floats to strings for the Mollie API and add additional info - foreach ($newItems as $index => $item) { - $newItems[$index] = [ - 'name' => (string)$item['name'], - 'quantity' => (int)$item['quantity'], - 'sku' => (string)(isset($item['sku']) ? $item['sku'] : ''), - 'unitPrice' => [ - 'currency' => Tools::strtoupper($oCurrency->iso_code), - 'value' => number_format($item['unitPrice'], $apiRoundingPrecision, '.', ''), - ], - 'totalAmount' => [ - 'currency' => Tools::strtoupper($oCurrency->iso_code), - 'value' => number_format($item['totalAmount'], $apiRoundingPrecision, '.', ''), - ], - 'vatAmount' => [ - 'currency' => Tools::strtoupper($oCurrency->iso_code), - 'value' => number_format($item['vatAmount'], $apiRoundingPrecision, '.', ''), - ], - 'vatRate' => number_format($item['vatRate'], $apiRoundingPrecision, '.', ''), - ]; - } - - return $newItems; - } - - /** - * Spread the cart line amount evenly - * - * Optionally split into multiple lines in case of rounding inaccuracies - * - * @param array[] $cartLineGroup Cart Line Group WITHOUT VAT details (except target VAT rate) - * @param float $newTotal - * - * @return array[] - * - * @since 3.2.2 - * @since 3.3.3 Omits VAT details - */ - public static function spreadCartLineGroup($cartLineGroup, $newTotal) - { - $apiRoundingPrecision = Mollie\Config\Config::API_ROUNDING_PRECISION; - $newTotal = round($newTotal, $apiRoundingPrecision); - $quantity = array_sum(array_column($cartLineGroup, 'quantity')); - $newCartLineGroup = []; - $spread = \Mollie\Utility\CartPriceUtility::spreadAmountEvenly($newTotal, $quantity); - foreach ($spread as $unitPrice => $qty) { - $newCartLineGroup[] = [ - 'name' => $cartLineGroup[0]['name'], - 'quantity' => $qty, - 'unitPrice' => (float)$unitPrice, - 'totalAmount' => (float)$unitPrice * $qty, - 'sku' => $cartLineGroup[0]['sku'], - 'targetVat' => $cartLineGroup[0]['targetVat'], - ]; - } - - return $newCartLineGroup; - } - + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Service; + +use Cart; +use Configuration; +use Currency; +use Mollie; +use Mollie\Utility\CartPriceUtility; +use Tools; + +class CartLinesService +{ + + /** + * @var Mollie + */ + private $module; + + public function __construct(Mollie $module) + { + $this->module = $module; + } + + /** + * @param float $amount + * + * @param $paymentFee + * @param Cart $cart + * @return array + */ + public function getCartLines($amount, $paymentFee, Cart $cart) + { + $oCurrency = new Currency($cart->id_currency); + $apiRoundingPrecision = Mollie\Config\Config::API_ROUNDING_PRECISION; + + $remaining = round($amount, $apiRoundingPrecision); + $shipping = round($cart->getTotalShippingCost(null, true), $apiRoundingPrecision); + $cartSummary = $cart->getSummaryDetails(); + $cartItems = $cart->getProducts(); + $wrapping = Configuration::get('PS_GIFT_WRAPPING') ? round($cartSummary['total_wrapping'], $apiRoundingPrecision) : 0; + $remaining = round($remaining - $shipping - $wrapping, $apiRoundingPrecision); + $totalDiscounts = isset($cartSummary['total_discounts']) ? round($cartSummary['total_discounts'], $apiRoundingPrecision) : 0; + + $aItems = []; + /* Item */ + foreach ($cartItems as $cartItem) { + // Get the rounded total w/ tax + $roundedTotalWithTax = round($cartItem['total_wt'], $apiRoundingPrecision); + + // Skip if no qty + $quantity = (int)$cartItem['cart_quantity']; + if ($quantity <= 0 || $cartItem['price_wt'] <= 0) { + continue; + } + + // Generate the product hash + $idProduct = number_format($cartItem['id_product']); + $idProductAttribute = number_format($cartItem['id_product_attribute']); + $idCustomization = number_format($cartItem['id_customization']); + + $productHash = "{$idProduct}¤{$idProductAttribute}¤{$idCustomization}"; + $aItems[$productHash] = []; + + // Try to spread this product evenly and account for rounding differences on the order line + foreach (CartPriceUtility::spreadAmountEvenly($roundedTotalWithTax, $quantity) as $unitPrice => $qty) { + $aItems[$productHash][] = [ + 'name' => $cartItem['name'], + 'sku' => $productHash, + 'targetVat' => (float)$cartItem['rate'], + 'quantity' => $qty, + 'unitPrice' => $unitPrice, + 'totalAmount' => (float)$unitPrice * $qty, + ]; + $remaining -= round((float)$unitPrice * $qty, $apiRoundingPrecision); + } + } + + // Add discount if applicable + if ($totalDiscounts >= 0.01) { + $totalDiscountsNoTax = round($cartSummary['total_discounts_tax_exc'], $apiRoundingPrecision); + $vatRate = round((($totalDiscounts - $totalDiscountsNoTax) / $totalDiscountsNoTax) * 100, $apiRoundingPrecision); + + $aItems['discount'] = [ + [ + 'name' => 'Discount', + 'type' => 'discount', + 'quantity' => 1, + 'unitPrice' => -round($totalDiscounts, $apiRoundingPrecision), + 'totalAmount' => -round($totalDiscounts, $apiRoundingPrecision), + 'targetVat' => $vatRate, + ], + ]; + $remaining += $totalDiscounts; + } + + // Compensate for order total rounding inaccuracies + $remaining = round($remaining, $apiRoundingPrecision); + if ($remaining < 0) { + foreach (array_reverse($aItems) as $hash => $items) { + // Grab the line group's total amount + $totalAmount = array_sum(array_column($items, 'totalAmount')); + + // Remove when total is lower than remaining + if ($totalAmount <= $remaining) { + // The line total is less than remaining, we should remove this line group and continue + $remaining = $remaining - $totalAmount; + unset($items); + continue; + } + + // Otherwise spread the cart line again with the updated total + $aItems[$hash] = static::spreadCartLineGroup($items, $totalAmount - $remaining); + break; + } + } elseif ($remaining > 0) { + foreach (array_reverse($aItems) as $hash => $items) { + // Grab the line group's total amount + $totalAmount = array_sum(array_column($items, 'totalAmount')); + // Otherwise spread the cart line again with the updated total + $aItems[$hash] = static::spreadCartLineGroup($items, $totalAmount + $remaining); + break; + } + } + + // Fill the order lines with the rest of the data (tax, total amount, etc.) + foreach ($aItems as $productHash => $aItem) { + $aItems[$productHash] = array_map(function ($line) use ($apiRoundingPrecision, $oCurrency) { + $quantity = (int)$line['quantity']; + $targetVat = $line['targetVat']; + $unitPrice = $line['unitPrice']; + $unitPriceNoTax = round($line['unitPrice'] / (1 + ($targetVat / 100)), $apiRoundingPrecision); + + // Calculate VAT + $totalAmount = round($unitPrice * $quantity, $apiRoundingPrecision); + $actualVatRate = round(($unitPrice * $quantity - $unitPriceNoTax * $quantity) / ($unitPriceNoTax * $quantity) * 100, $apiRoundingPrecision); + $vatAmount = $totalAmount * ($actualVatRate / ($actualVatRate + 100)); + + $newItem = [ + 'name' => $line['name'], + 'quantity' => (int)$quantity, + 'unitPrice' => round($unitPrice, $apiRoundingPrecision), + 'totalAmount' => round($totalAmount, $apiRoundingPrecision), + 'vatRate' => round($actualVatRate, $apiRoundingPrecision), + 'vatAmount' => round($vatAmount, $apiRoundingPrecision), + ]; + if (isset($line['sku'])) { + $newItem['sku'] = $line['sku']; + } + + return $newItem; + }, $aItem); + } + + // Add shipping + if (round($shipping, 2) > 0) { + $shippingVatRate = round(($cartSummary['total_shipping'] - $cartSummary['total_shipping_tax_exc']) / $cartSummary['total_shipping_tax_exc'] * 100, $apiRoundingPrecision); + + $aItems['shipping'] = [ + [ + 'name' => $this->module->l('Shipping'), + 'quantity' => 1, + 'unitPrice' => round($shipping, $apiRoundingPrecision), + 'totalAmount' => round($shipping, $apiRoundingPrecision), + 'vatAmount' => round($shipping * $shippingVatRate / ($shippingVatRate + 100), $apiRoundingPrecision), + 'vatRate' => $shippingVatRate, + ], + ]; + } + + // Add wrapping + if (round($wrapping, 2) > 0) { + $wrappingVatRate = round(($cartSummary['total_wrapping'] - $cartSummary['total_wrapping_tax_exc']) / $cartSummary['total_wrapping_tax_exc'] * 100, $apiRoundingPrecision); + + $aItems['wrapping'] = [ + [ + 'name' => $this->module->l('Gift wrapping'), + 'quantity' => 1, + 'unitPrice' => round($wrapping, $apiRoundingPrecision), + 'totalAmount' => round($wrapping, $apiRoundingPrecision), + 'vatAmount' => round($wrapping * $wrappingVatRate / ($wrappingVatRate + 100), $apiRoundingPrecision), + 'vatRate' => $wrappingVatRate, + ], + ]; + } + + // Add fee + if ($paymentFee) { + $aItems['surcharge'] = [ + [ + 'name' => $this->module->l('Payment Fee'), + 'quantity' => 1, + 'unitPrice' => round($paymentFee, $apiRoundingPrecision), + 'totalAmount' => round($paymentFee, $apiRoundingPrecision), + 'vatAmount' => 0, + 'vatRate' => 0, + ], + ]; + } + + // Ungroup all the cart lines, just one level + $newItems = []; + foreach ($aItems as &$items) { + foreach ($items as &$item) { + $newItems[] = $item; + } + } + + // Convert floats to strings for the Mollie API and add additional info + foreach ($newItems as $index => $item) { + $newItems[$index] = [ + 'name' => (string)$item['name'], + 'quantity' => (int)$item['quantity'], + 'sku' => (string)(isset($item['sku']) ? $item['sku'] : ''), + 'unitPrice' => [ + 'currency' => Tools::strtoupper($oCurrency->iso_code), + 'value' => number_format($item['unitPrice'], $apiRoundingPrecision, '.', ''), + ], + 'totalAmount' => [ + 'currency' => Tools::strtoupper($oCurrency->iso_code), + 'value' => number_format($item['totalAmount'], $apiRoundingPrecision, '.', ''), + ], + 'vatAmount' => [ + 'currency' => Tools::strtoupper($oCurrency->iso_code), + 'value' => number_format($item['vatAmount'], $apiRoundingPrecision, '.', ''), + ], + 'vatRate' => number_format($item['vatRate'], $apiRoundingPrecision, '.', ''), + ]; + } + + return $newItems; + } + + /** + * Spread the cart line amount evenly + * + * Optionally split into multiple lines in case of rounding inaccuracies + * + * @param array[] $cartLineGroup Cart Line Group WITHOUT VAT details (except target VAT rate) + * @param float $newTotal + * + * @return array[] + * + * @since 3.2.2 + * @since 3.3.3 Omits VAT details + */ + public static function spreadCartLineGroup($cartLineGroup, $newTotal) + { + $apiRoundingPrecision = Mollie\Config\Config::API_ROUNDING_PRECISION; + $newTotal = round($newTotal, $apiRoundingPrecision); + $quantity = array_sum(array_column($cartLineGroup, 'quantity')); + $newCartLineGroup = []; + $spread = CartPriceUtility::spreadAmountEvenly($newTotal, $quantity); + foreach ($spread as $unitPrice => $qty) { + $newCartLineGroup[] = [ + 'name' => $cartLineGroup[0]['name'], + 'quantity' => $qty, + 'unitPrice' => (float)$unitPrice, + 'totalAmount' => (float)$unitPrice * $qty, + 'sku' => $cartLineGroup[0]['sku'], + 'targetVat' => $cartLineGroup[0]['targetVat'], + ]; + } + + return $newCartLineGroup; + } + } \ No newline at end of file diff --git a/src/Service/ConfigFieldService.php b/src/Service/ConfigFieldService.php index fa2f7649f..3677694fc 100644 --- a/src/Service/ConfigFieldService.php +++ b/src/Service/ConfigFieldService.php @@ -1,102 +1,135 @@ -module = $module; - $this->apiService = $apiService; - $this->countryRepository = $countryRepository; - } - - /** - * @return array - */ - public function getConfigFieldsValues() - { - $configFields = [ - Config::MOLLIE_API_KEY => Configuration::get(Config::MOLLIE_API_KEY), - Config::MOLLIE_PROFILE_ID => Configuration::get(Config::MOLLIE_PROFILE_ID), - Config::MOLLIE_PAYMENTSCREEN_LOCALE => Configuration::get(Config::MOLLIE_PAYMENTSCREEN_LOCALE), - Config::MOLLIE_IFRAME => Configuration::get(Config::MOLLIE_IFRAME), - - Config::MOLLIE_CSS => Configuration::get(Config::MOLLIE_CSS), - Config::MOLLIE_IMAGES => Configuration::get(Config::MOLLIE_IMAGES), - Config::MOLLIE_ISSUERS => Configuration::get(Config::MOLLIE_ISSUERS), - - Config::MOLLIE_QRENABLED => Configuration::get(Config::MOLLIE_QRENABLED), - Config::MOLLIE_METHOD_COUNTRIES => Configuration::get(Config::MOLLIE_METHOD_COUNTRIES), - Config::MOLLIE_METHOD_COUNTRIES_DISPLAY => Configuration::get(Config::MOLLIE_METHOD_COUNTRIES_DISPLAY), - - Config::MOLLIE_STATUS_OPEN => Configuration::get(Config::MOLLIE_STATUS_OPEN), - Config::MOLLIE_STATUS_PAID => Configuration::get(Config::MOLLIE_STATUS_PAID), - Config::MOLLIE_STATUS_CANCELED => Configuration::get(Config::MOLLIE_STATUS_CANCELED), - Config::MOLLIE_STATUS_EXPIRED => Configuration::get(Config::MOLLIE_STATUS_EXPIRED), - Config::MOLLIE_STATUS_PARTIAL_REFUND => Configuration::get(Config::MOLLIE_STATUS_PARTIAL_REFUND), - Config::MOLLIE_STATUS_REFUNDED => Configuration::get(Config::MOLLIE_STATUS_REFUNDED), - Config::MOLLIE_MAIL_WHEN_OPEN => Configuration::get(Config::MOLLIE_MAIL_WHEN_OPEN), - Config::MOLLIE_MAIL_WHEN_PAID => Configuration::get(Config::MOLLIE_MAIL_WHEN_PAID), - Config::MOLLIE_MAIL_WHEN_CANCELED => Configuration::get(Config::MOLLIE_MAIL_WHEN_CANCELED), - Config::MOLLIE_MAIL_WHEN_EXPIRED => Configuration::get(Config::MOLLIE_MAIL_WHEN_EXPIRED), - Config::MOLLIE_MAIL_WHEN_REFUNDED => Configuration::get(Config::MOLLIE_MAIL_WHEN_REFUNDED), - Config::MOLLIE_ACCOUNT_SWITCH => Configuration::get(Config::MOLLIE_ACCOUNT_SWITCH), - - Config::MOLLIE_DISPLAY_ERRORS => Configuration::get(Config::MOLLIE_DISPLAY_ERRORS), - Config::MOLLIE_DEBUG_LOG => Configuration::get(Config::MOLLIE_DEBUG_LOG), - Config::MOLLIE_API => Configuration::get(Config::MOLLIE_API), - - Config::MOLLIE_AUTO_SHIP_MAIN => Configuration::get(Config::MOLLIE_AUTO_SHIP_MAIN), - ]; - - if (Configuration::get(Config::MOLLIE_API_KEY)) { - foreach ($this->apiService->getMethodsForConfig($this->module->api, $this->module->getPathUri()) as $method) { - $countryIds = $this->countryRepository->getMethodCountryIds($method['id']); - if ($countryIds) { - $configFields = array_merge($configFields, [Config::MOLLIE_COUNTRIES . $method['id'] . '[]' => $countryIds]); - continue; - } - $configFields = array_merge($configFields, [Config::MOLLIE_COUNTRIES . $method['id'] . '[]' => []]); - } - } - - $checkStatuses = []; - if (Configuration::get(Config::MOLLIE_AUTO_SHIP_STATUSES)) { - $checkConfs = @json_decode(Configuration::get(Config::MOLLIE_AUTO_SHIP_STATUSES), true); - } - if (!isset($checkConfs) || !is_array($checkConfs)) { - $checkConfs = []; - } - - foreach ($checkConfs as $conf) { - $checkStatuses[Config::MOLLIE_AUTO_SHIP_STATUSES . '_' . (int)$conf] = true; - } - - $configFields = array_merge($configFields, $checkStatuses); - - return $configFields; - } - + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Service; + +use Configuration; +use Mollie; +use Mollie\Config\Config; +use Mollie\Repository\CountryRepository; + +class ConfigFieldService +{ + /** + * @var Mollie + */ + private $module; + /** + * @var ApiService + */ + private $apiService; + /** + * @var CountryRepository + */ + private $countryRepository; + + public function __construct( + Mollie $module, + ApiService $apiService, + CountryRepository $countryRepository + ) { + $this->module = $module; + $this->apiService = $apiService; + $this->countryRepository = $countryRepository; + } + + /** + * @return array + */ + public function getConfigFieldsValues() + { + $configFields = [ + Config::MOLLIE_API_KEY => Configuration::get(Config::MOLLIE_API_KEY), + Config::MOLLIE_PROFILE_ID => Configuration::get(Config::MOLLIE_PROFILE_ID), + Config::MOLLIE_PAYMENTSCREEN_LOCALE => Configuration::get(Config::MOLLIE_PAYMENTSCREEN_LOCALE), + Config::MOLLIE_IFRAME => Configuration::get(Config::MOLLIE_IFRAME), + + Config::MOLLIE_CSS => Configuration::get(Config::MOLLIE_CSS), + Config::MOLLIE_IMAGES => Configuration::get(Config::MOLLIE_IMAGES), + Config::MOLLIE_ISSUERS => Configuration::get(Config::MOLLIE_ISSUERS), + + Config::MOLLIE_QRENABLED => Configuration::get(Config::MOLLIE_QRENABLED), + Config::MOLLIE_METHOD_COUNTRIES => Configuration::get(Config::MOLLIE_METHOD_COUNTRIES), + Config::MOLLIE_METHOD_COUNTRIES_DISPLAY => Configuration::get(Config::MOLLIE_METHOD_COUNTRIES_DISPLAY), + + Config::MOLLIE_STATUS_OPEN => Configuration::get(Config::MOLLIE_STATUS_OPEN), + Config::MOLLIE_STATUS_PAID => Configuration::get(Config::MOLLIE_STATUS_PAID), + Config::MOLLIE_STATUS_CANCELED => Configuration::get(Config::MOLLIE_STATUS_CANCELED), + Config::MOLLIE_STATUS_EXPIRED => Configuration::get(Config::MOLLIE_STATUS_EXPIRED), + Config::MOLLIE_STATUS_PARTIAL_REFUND => Configuration::get(Config::MOLLIE_STATUS_PARTIAL_REFUND), + Config::MOLLIE_STATUS_REFUNDED => Configuration::get(Config::MOLLIE_STATUS_REFUNDED), + Config::MOLLIE_MAIL_WHEN_OPEN => Configuration::get(Config::MOLLIE_MAIL_WHEN_OPEN), + Config::MOLLIE_MAIL_WHEN_PAID => Configuration::get(Config::MOLLIE_MAIL_WHEN_PAID), + Config::MOLLIE_MAIL_WHEN_CANCELED => Configuration::get(Config::MOLLIE_MAIL_WHEN_CANCELED), + Config::MOLLIE_MAIL_WHEN_EXPIRED => Configuration::get(Config::MOLLIE_MAIL_WHEN_EXPIRED), + Config::MOLLIE_MAIL_WHEN_REFUNDED => Configuration::get(Config::MOLLIE_MAIL_WHEN_REFUNDED), + Config::MOLLIE_ACCOUNT_SWITCH => Configuration::get(Config::MOLLIE_ACCOUNT_SWITCH), + + Config::MOLLIE_DISPLAY_ERRORS => Configuration::get(Config::MOLLIE_DISPLAY_ERRORS), + Config::MOLLIE_DEBUG_LOG => Configuration::get(Config::MOLLIE_DEBUG_LOG), + Config::MOLLIE_API => Configuration::get(Config::MOLLIE_API), + + Config::MOLLIE_AUTO_SHIP_MAIN => Configuration::get(Config::MOLLIE_AUTO_SHIP_MAIN), + ]; + + if (Configuration::get(Config::MOLLIE_API_KEY)) { + foreach ($this->apiService->getMethodsForConfig($this->module->api, $this->module->getPathUri()) as $method) { + $countryIds = $this->countryRepository->getMethodCountryIds($method['id']); + if ($countryIds) { + $configFields = array_merge($configFields, [Config::MOLLIE_COUNTRIES . $method['id'] . '[]' => $countryIds]); + continue; + } + $configFields = array_merge($configFields, [Config::MOLLIE_COUNTRIES . $method['id'] . '[]' => []]); + } + } + + $checkStatuses = []; + if (Configuration::get(Config::MOLLIE_AUTO_SHIP_STATUSES)) { + $checkConfs = @json_decode(Configuration::get(Config::MOLLIE_AUTO_SHIP_STATUSES), true); + } + if (!isset($checkConfs) || !is_array($checkConfs)) { + $checkConfs = []; + } + + foreach ($checkConfs as $conf) { + $checkStatuses[Config::MOLLIE_AUTO_SHIP_STATUSES . '_' . (int)$conf] = true; + } + + $configFields = array_merge($configFields, $checkStatuses); + + return $configFields; + } + } \ No newline at end of file diff --git a/src/Service/CountryService.php b/src/Service/CountryService.php index dc246d5fb..f33979e49 100644 --- a/src/Service/CountryService.php +++ b/src/Service/CountryService.php @@ -1,40 +1,73 @@ -module = $module; - } - - public function getActiveCountriesList($onlyActive = true) - { - $context = Context::getContext(); - $langId = $context->language->id; - $countries = Country::getCountries($langId, $onlyActive); - $countriesWithNames = []; - $countriesWithNames[] = [ - 'id' => 0, - 'name' => $this->module->l('All') - ]; - foreach ($countries as $key => $country) { - $countriesWithNames[] = [ - 'id' => $key, - 'name' => $country['name'], - ]; - } - - return $countriesWithNames; - } + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Service; + +use Context; +use Country; +use Mollie; + +class CountryService +{ + /** + * @var Mollie + */ + private $module; + + public function __construct(Mollie $module) + { + $this->module = $module; + } + + public function getActiveCountriesList($onlyActive = true) + { + $context = Context::getContext(); + $langId = $context->language->id; + $countries = Country::getCountries($langId, $onlyActive); + $countriesWithNames = []; + $countriesWithNames[] = [ + 'id' => 0, + 'name' => $this->module->l('All') + ]; + foreach ($countries as $key => $country) { + $countriesWithNames[] = [ + 'id' => $key, + 'name' => $country['name'], + ]; + } + + return $countriesWithNames; + } } \ No newline at end of file diff --git a/src/Service/IssuerService.php b/src/Service/IssuerService.php index 2f67c0fcb..a12532236 100644 --- a/src/Service/IssuerService.php +++ b/src/Service/IssuerService.php @@ -1,46 +1,80 @@ -paymentMethodRepository = $paymentMethodRepository; - $this->module = $module; - } - - public function getIdealIssuers() - { - $methodId = $this->paymentMethodRepository->getPaymentMethodIdByMethodId(PaymentMethod::IDEAL); - $issuersJson = $this->paymentMethodRepository->getPaymentMethodIssuersByPaymentMethodId($methodId); - $issuers = json_decode($issuersJson, true); - $issuerList[PaymentMethod::IDEAL] = []; - $context = Context::getContext(); - foreach ($issuers as $issuer) { - $issuer['href'] = $context->link->getModuleLink( - $this->module->name, - 'payment', - ['method' => $methodId , 'issuer' => $issuer['id'], 'rand' => time()], - true - ); - $issuerList[PaymentMethod::IDEAL][$issuer['id']] = $issuer; - } - - return $issuerList; - } + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Service; + +use Context; +use Mollie; +use _PhpScoper5ea00cc67502b\Mollie\Api\Types\PaymentMethod; +use Mollie\Repository\PaymentMethodRepository; + +class IssuerService +{ + /** + * @var PaymentMethodRepository + */ + private $paymentMethodRepository; + /** + * @var Mollie + */ + private $module; + + public function __construct(Mollie $module, PaymentMethodRepository $paymentMethodRepository) + { + $this->paymentMethodRepository = $paymentMethodRepository; + $this->module = $module; + } + + public function getIdealIssuers() + { + $methodId = $this->paymentMethodRepository->getPaymentMethodIdByMethodId(PaymentMethod::IDEAL); + $issuersJson = $this->paymentMethodRepository->getPaymentMethodIssuersByPaymentMethodId($methodId); + $issuers = json_decode($issuersJson, true); + $issuerList = []; + $issuerList[PaymentMethod::IDEAL] = []; + $context = Context::getContext(); + foreach ($issuers as $issuer) { + $issuer['href'] = $context->link->getModuleLink( + $this->module->name, + 'payment', + ['method' => $methodId , 'issuer' => $issuer['id'], 'rand' => time()], + true + ); + $issuerList[PaymentMethod::IDEAL][$issuer['id']] = $issuer; + } + + return $issuerList; + } } \ No newline at end of file diff --git a/src/Service/LanguageService.php b/src/Service/LanguageService.php index 693edc5c5..3668e4860 100644 --- a/src/Service/LanguageService.php +++ b/src/Service/LanguageService.php @@ -1,76 +1,109 @@ -module = $module; - } - - public function getLang() { - return [ - PaymentStatus::STATUS_PAID => $this->module->l('Paid'), - PaymentStatus::STATUS_AUTHORIZED => $this->module->l('Authorized'), - PaymentStatus::STATUS_CANCELED => $this->module->l('Canceled'), - PaymentStatus::STATUS_EXPIRED => $this->module->l('Expired'), - RefundStatus::STATUS_REFUNDED => $this->module->l('Refunded'), - PaymentStatus::STATUS_OPEN => $this->module->l('Bankwire pending'), - Mollie\Config\Config::PARTIAL_REFUND_CODE => $this->module->l('Partially refunded'), - 'created' => $this->module->l('Created'), - 'This payment method is not available.' => $this->module->l('This payment method is not available.'), - 'Click here to continue' => $this->module->l('Click here to continue'), - 'This payment method is only available for Euros.' => $this->module->l('This payment method is only available for Euros.'), - 'There was an error while processing your request: ' => $this->module->l('There was an error while processing your request: '), - 'The order with this id does not exist.' => $this->module->l('The order with this id does not exist.'), - 'We have not received a definite payment status. You will be notified as soon as we receive a confirmation of the bank/merchant.' => $this->module->l('We have not received a definite payment status. You will be notified as soon as we receive a confirmation of the bank/merchant.'), - 'Unfortunately your payment was expired.' => $this->module->l('Unfortunately your payment was expired.'), - 'Thank you. Your payment has been received.' => $this->module->l('Thank you. Your payment has been received.'), - 'The transaction has an unexpected status.' => $this->module->l('The transaction has an unexpected status.'), - 'You are not authorised to see this page.' => $this->module->l('You are not authorised to see this page.'), - 'Continue shopping' => $this->module->l('Continue shopping'), - 'Welcome back' => $this->module->l('Welcome back'), - 'Select your bank:' => $this->module->l('Select your bank:'), - 'OK' => $this->module->l('OK'), - 'Different payment method' => $this->module->l('Different payment method'), - 'Pay with %s' => $this->module->l('Pay with %s'), - 'Refund this order' => $this->module->l('Refund this order'), - 'Mollie refund' => $this->module->l('Mollie refund'), - 'Refund order #%d through the Mollie API.' => $this->module->l('Refund order #%d through the Mollie API.'), - 'The order has been refunded!' => $this->module->l('The order has been refunded!'), - 'Mollie B.V. will transfer the money back to the customer on the next business day.' => $this->module->l('Mollie B.V. will transfer the money back to the customer on the next business day.'), - 'Awaiting Mollie payment' => $this->module->l('Awaiting Mollie payment'), - 'Mollie partially refunded' => $this->module->l('Mollie partially refunded'), - 'iDEAL' => $this->module->l('iDEAL'), - 'Cartes Bancaires' => $this->module->l('Cartes Bancaires'), - 'Credit card' => $this->module->l('Credit card'), - 'Bancontact' => $this->module->l('Bancontact'), - 'SOFORT Banking' => $this->module->l('SOFORT Banking'), - 'SEPA Direct Debit' => $this->module->l('SEPA Direct Debit'), - 'Belfius Pay Button' => $this->module->l('Belfius Pay Button'), - 'Bitcoin' => $this->module->l('Bitcoin'), - 'PODIUM Cadeaukaart' => $this->module->l('PODIUM Cadeaukaart'), - 'Gift cards' => $this->module->l('Gift cards'), - 'Bank transfer' => $this->module->l('Bank transfer'), - 'PayPal' => $this->module->l('PayPal'), - 'paysafecard' => $this->module->l('paysafecard'), - 'KBC/CBC Payment Button' => $this->module->l('KBC/CBC Payment Button'), - 'ING Home\'Pay' => $this->module->l('ING Home\'Pay'), - 'Giropay' => $this->module->l('Giropay'), - 'eps' => $this->module->l('eps'), - 'Pay later.' => $this->module->l('Pay later.'), - 'Slice it.' => $this->module->l('Slice it.'), - 'MyBank' => $this->module->l('MyBank'), - ]; - } + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Service; + +use _PhpScoper5ea00cc67502b\Mollie\Api\Types\PaymentStatus; +use _PhpScoper5ea00cc67502b\Mollie\Api\Types\RefundStatus; +use Mollie; + +class LanguageService +{ + /** + * @var Mollie + */ + private $module; + + public function __construct(Mollie $module) + { + $this->module = $module; + } + + public function getLang() { + return [ + PaymentStatus::STATUS_PAID => $this->module->l('Paid'), + PaymentStatus::STATUS_AUTHORIZED => $this->module->l('Authorized'), + PaymentStatus::STATUS_CANCELED => $this->module->l('Canceled'), + PaymentStatus::STATUS_EXPIRED => $this->module->l('Expired'), + RefundStatus::STATUS_REFUNDED => $this->module->l('Refunded'), + PaymentStatus::STATUS_OPEN => $this->module->l('Bankwire pending'), + Mollie\Config\Config::PARTIAL_REFUND_CODE => $this->module->l('Partially refunded'), + 'created' => $this->module->l('Created'), + 'This payment method is not available.' => $this->module->l('This payment method is not available.'), + 'Click here to continue' => $this->module->l('Click here to continue'), + 'This payment method is only available for Euros.' => $this->module->l('This payment method is only available for Euros.'), + 'There was an error while processing your request: ' => $this->module->l('There was an error while processing your request: '), + 'The order with this id does not exist.' => $this->module->l('The order with this id does not exist.'), + 'We have not received a definite payment status. You will be notified as soon as we receive a confirmation of the bank/merchant.' => $this->module->l('We have not received a definite payment status. You will be notified as soon as we receive a confirmation of the bank/merchant.'), + 'Unfortunately your payment was expired.' => $this->module->l('Unfortunately your payment was expired.'), + 'Thank you. Your payment has been received.' => $this->module->l('Thank you. Your payment has been received.'), + 'The transaction has an unexpected status.' => $this->module->l('The transaction has an unexpected status.'), + 'You are not authorised to see this page.' => $this->module->l('You are not authorised to see this page.'), + 'Continue shopping' => $this->module->l('Continue shopping'), + 'Welcome back' => $this->module->l('Welcome back'), + 'Select your bank:' => $this->module->l('Select your bank:'), + 'OK' => $this->module->l('OK'), + 'Different payment method' => $this->module->l('Different payment method'), + 'Pay with %s' => $this->module->l('Pay with %s'), + 'Refund this order' => $this->module->l('Refund this order'), + 'Mollie refund' => $this->module->l('Mollie refund'), + 'Refund order #%d through the Mollie API.' => $this->module->l('Refund order #%d through the Mollie API.'), + 'The order has been refunded!' => $this->module->l('The order has been refunded!'), + 'Mollie B.V. will transfer the money back to the customer on the next business day.' => $this->module->l('Mollie B.V. will transfer the money back to the customer on the next business day.'), + 'Awaiting Mollie payment' => $this->module->l('Awaiting Mollie payment'), + 'Mollie partially refunded' => $this->module->l('Mollie partially refunded'), + 'iDEAL' => $this->module->l('iDEAL'), + 'Cartes Bancaires' => $this->module->l('Cartes Bancaires'), + 'Credit card' => $this->module->l('Credit card'), + 'Bancontact' => $this->module->l('Bancontact'), + 'SOFORT Banking' => $this->module->l('SOFORT Banking'), + 'SEPA Direct Debit' => $this->module->l('SEPA Direct Debit'), + 'Belfius Pay Button' => $this->module->l('Belfius Pay Button'), + 'Bitcoin' => $this->module->l('Bitcoin'), + 'PODIUM Cadeaukaart' => $this->module->l('PODIUM Cadeaukaart'), + 'Gift cards' => $this->module->l('Gift cards'), + 'Bank transfer' => $this->module->l('Bank transfer'), + 'PayPal' => $this->module->l('PayPal'), + 'paysafecard' => $this->module->l('paysafecard'), + 'KBC/CBC Payment Button' => $this->module->l('KBC/CBC Payment Button'), + 'ING Home\'Pay' => $this->module->l('ING Home\'Pay'), + 'Giropay' => $this->module->l('Giropay'), + 'eps' => $this->module->l('eps'), + 'Pay later.' => $this->module->l('Pay later.'), + 'Slice it.' => $this->module->l('Slice it.'), + 'MyBank' => $this->module->l('MyBank'), + ]; + } } \ No newline at end of file diff --git a/src/Service/MolCarrierInformationService.php b/src/Service/MolCarrierInformationService.php index af55c3686..6a6cf31f5 100644 --- a/src/Service/MolCarrierInformationService.php +++ b/src/Service/MolCarrierInformationService.php @@ -1,78 +1,111 @@ -informationRepository = $informationRepository; - } - - public function getAllCarriersInformation($langId = null) - { - if (!$langId) { - $langId = Context::getContext()->language->id; - } - - $carriers = Carrier::getCarriers( - $langId, - false, - false, - false, - null, - Carrier::ALL_CARRIERS - ); - - $configCarriers = array(); - /** @var Carrier $carrier */ - foreach ($carriers as $carrier) { - $carrier = new Carrier($carrier['id_carrier']); - $carrierInfoId = $this->informationRepository->getMollieCarrierInformationIdByCarrierId($carrier->id); - if ($carrierInfoId) { - $carrierInfo = new MolCarrierInformation($carrierInfoId); - $configCarriers[] = [ - 'id_carrier' => $carrier->id, - 'name' => $carrier->name, - 'source' => $carrierInfo->url_source, - 'module' => $carrier->external_module_name, - 'module_name' => $carrier->external_module_name, - 'custom_url' => $carrierInfo->custom_url, - ]; - } else { - $configCarriers[] = [ - 'id_carrier' => $carrier->id, - 'name' => $carrier->name, - 'source' =>$carrier->external_module_name ? Config::MOLLIE_CARRIER_MODULE : Config::MOLLIE_CARRIER_CARRIER, - 'module' => $carrier->external_module_name, - 'module_name' => $carrier->external_module_name, - 'custom_url' => '', - ]; - } - } - - return $configCarriers; - } - - public function saveMolCarrierInfo($carrierId, $urlSource, $customUrl = null) - { - $carrierInformationId = $this->informationRepository->getMollieCarrierInformationIdByCarrierId($carrierId); - $carrierInformation = new MolCarrierInformation($carrierInformationId); - $carrierInformation->id_carrier = $carrierId; - $carrierInformation->url_source = $urlSource; - $carrierInformation->custom_url = $customUrl; - - $carrierInformation->save(); - } + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Service; + +use Carrier; +use Context; +use MolCarrierInformation; +use Mollie\Config\Config; +use Mollie\Repository\MolCarrierInformationRepository; + +class MolCarrierInformationService +{ + /** + * @var MolCarrierInformationRepository + */ + private $informationRepository; + + public function __construct(MolCarrierInformationRepository $informationRepository) + { + $this->informationRepository = $informationRepository; + } + + public function getAllCarriersInformation($langId = null) + { + if (!$langId) { + $langId = Context::getContext()->language->id; + } + + $carriers = Carrier::getCarriers( + $langId, + false, + false, + false, + null, + Carrier::ALL_CARRIERS + ); + + $configCarriers = array(); + /** @var Carrier $carrier */ + foreach ($carriers as $carrier) { + $carrier = new Carrier($carrier['id_carrier']); + $carrierInfoId = $this->informationRepository->getMollieCarrierInformationIdByCarrierId($carrier->id); + if ($carrierInfoId) { + $carrierInfo = new MolCarrierInformation($carrierInfoId); + $configCarriers[] = [ + 'id_carrier' => $carrier->id, + 'name' => $carrier->name, + 'source' => $carrierInfo->url_source, + 'module' => $carrier->external_module_name, + 'module_name' => $carrier->external_module_name, + 'custom_url' => $carrierInfo->custom_url, + ]; + } else { + $configCarriers[] = [ + 'id_carrier' => $carrier->id, + 'name' => $carrier->name, + 'source' =>$carrier->external_module_name ? Config::MOLLIE_CARRIER_MODULE : Config::MOLLIE_CARRIER_CARRIER, + 'module' => $carrier->external_module_name, + 'module_name' => $carrier->external_module_name, + 'custom_url' => '', + ]; + } + } + + return $configCarriers; + } + + public function saveMolCarrierInfo($carrierId, $urlSource, $customUrl = null) + { + $carrierInformationId = $this->informationRepository->getMollieCarrierInformationIdByCarrierId($carrierId); + $carrierInformation = new MolCarrierInformation($carrierInformationId); + $carrierInformation->id_carrier = $carrierId; + $carrierInformation->url_source = $urlSource; + $carrierInformation->custom_url = $customUrl; + + $carrierInformation->save(); + } } \ No newline at end of file diff --git a/src/Service/MollieOrderInfoService.php b/src/Service/MollieOrderInfoService.php index f69635bae..a7136b838 100644 --- a/src/Service/MollieOrderInfoService.php +++ b/src/Service/MollieOrderInfoService.php @@ -1,172 +1,205 @@ -module = $module; - $this->paymentMethodRepository = $paymentMethodRepository; - $this->refundService = $refundService; - $this->shipService = $shipService; - $this->cancelService = $cancelService; - $this->shipmentService = $shipmentService; - $this->apiService = $apiService; - } - - /** - * @param $input - * @return array - * @since 3.3.0 - */ - public function displayMollieOrderInfo($input, $adminOrdersControllerId) - { - $context = Context::getContext(); - - try { - $mollieData = $this->paymentMethodRepository->getPaymentBy('transaction_id', $input['transactionId']); - $access = Profile::getProfileAccess($context->employee->id_profile, $adminOrdersControllerId); - if ($input['resource'] === 'payments') { - switch ($input['action']) { - case 'refund': - // Check order edit permissions - if (!$access || empty($access['edit'])) { - return [ - 'success' => false, - 'message' => $this->module->l('You do not have permission to refund payments'), - ]; - } - if (!isset($input['amount']) || empty($input['amount'])) { - // No amount = full refund - $status = $this->refundService->doPaymentRefund($mollieData['transaction_id']); - } else { - $status = $this->refundService->doPaymentRefund($mollieData['transaction_id'], $input['amount']); - } - - return [ - 'success' => isset($status['status']) && $status['status'] === 'success', - 'payment' => $this->apiService->getFilteredApiPayment($this->module->api, $input['transactionId'], false), - ]; - case 'retrieve': - // Check order view permissions - if (!$access || empty($access['view'])) { - return [ - 'success' => false, - 'message' => sprintf($this->module->l('You do not have permission to %s payments'), $this->module->l('view')), - ]; - } - return [ - 'success' => true, - 'payment' => $this->apiService->getFilteredApiPayment($this->module->api, $input['transactionId'], false) - ]; - default: - return ['success' => false]; - } - } elseif ($input['resource'] === 'orders') { - switch ($input['action']) { - case 'retrieve': - // Check order edit permissions - if (!$access || empty($access['view'])) { - return [ - 'success' => false, - 'message' => sprintf($this->module->l('You do not have permission to %s payments'), $this->module->l('edit')), - ]; - } - $info = $this->paymentMethodRepository->getPaymentBy('transaction_id', $input['transactionId']); - if (!$info) { - return ['success' => false]; - } - $tracking = $this->shipmentService->getShipmentInformation($info['order_reference']); - - return [ - 'success' => true, - 'order' => $this->apiService->getFilteredApiOrder($this->module->api, $input['transactionId']), - 'tracking' => $tracking, - ]; - case 'ship': - // Check order edit permissions - if (!$access || empty($access['edit'])) { - return [ - 'success' => false, - 'message' => sprintf($this->module->l('You do not have permission to %s payments'), $this->module->l('ship')), - ]; - } - $status = $this->shipService->doShipOrderLines($input['transactionId'], isset($input['orderLines']) ? $input['orderLines'] : [], isset($input['tracking']) ? $input['tracking'] : null); - return array_merge($status, ['order' => $this->apiService->getFilteredApiOrder($this->module->api, $input['transactionId'])]); - case 'refund': - // Check order edit permissions - if (!$access || empty($access['edit'])) { - return [ - 'success' => false, - 'message' => sprintf($this->module->l('You do not have permission to %s payments'), $this->module->l('refund')), - ]; - } - $status = $this->refundService->doRefundOrderLines($input['transactionId'], isset($input['orderLines']) ? $input['orderLines'] : []); - return array_merge($status, ['order' => $this->apiService->getFilteredApiOrder($this->module->api, $input['transactionId'])]); - case 'cancel': - // Check order edit permissions - if (!$access || empty($access['edit'])) { - return [ - 'success' => false, - 'message' => sprintf($this->module->l('You do not have permission to %s payments'), $this->module->l('cancel')), - ]; - } - $status = $this->cancelService->doCancelOrderLines($input['transactionId'], isset($input['orderLines']) ? $input['orderLines'] : []); - return array_merge($status, ['order' => $this->apiService->getFilteredApiOrder($this->module->api, $input['transactionId'])]); - default: - return ['success' => false]; - } - } - } catch (Exception $e) { - PrestaShopLogger::addLog("Mollie module error: {$e->getMessage()}"); - return ['success' => false]; - } - - return ['success' => false]; - } + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Service; + +use Context; +use Exception; +use Mollie; +use Mollie\Repository\PaymentMethodRepository; +use PrestaShopLogger; +use Profile; + +class MollieOrderInfoService +{ + + /** + * @var PaymentMethodRepository + */ + private $paymentMethodRepository; + /** + * @var RefundService + */ + private $refundService; + /** + * @var ShipService + */ + private $shipService; + /** + * @var CancelService + */ + private $cancelService; + /** + * @var ShipmentService + */ + private $shipmentService; + /** + * @var Mollie + */ + private $module; + /** + * @var ApiService + */ + private $apiService; + + public function __construct( + Mollie $module, + PaymentMethodRepository $paymentMethodRepository, + RefundService $refundService, + ShipService $shipService, + CancelService $cancelService, + ShipmentService $shipmentService, + ApiService $apiService + ) { + $this->module = $module; + $this->paymentMethodRepository = $paymentMethodRepository; + $this->refundService = $refundService; + $this->shipService = $shipService; + $this->cancelService = $cancelService; + $this->shipmentService = $shipmentService; + $this->apiService = $apiService; + } + + /** + * @param $input + * @return array + * @since 3.3.0 + */ + public function displayMollieOrderInfo($input, $adminOrdersControllerId) + { + $context = Context::getContext(); + + try { + $mollieData = $this->paymentMethodRepository->getPaymentBy('transaction_id', $input['transactionId']); + $access = Profile::getProfileAccess($context->employee->id_profile, $adminOrdersControllerId); + if ($input['resource'] === 'payments') { + switch ($input['action']) { + case 'refund': + // Check order edit permissions + if (!$access || empty($access['edit'])) { + return [ + 'success' => false, + 'message' => $this->module->l('You do not have permission to refund payments'), + ]; + } + if (!isset($input['amount']) || empty($input['amount'])) { + // No amount = full refund + $status = $this->refundService->doPaymentRefund($mollieData['transaction_id']); + } else { + $status = $this->refundService->doPaymentRefund($mollieData['transaction_id'], $input['amount']); + } + + return [ + 'success' => isset($status['status']) && $status['status'] === 'success', + 'payment' => $this->apiService->getFilteredApiPayment($this->module->api, $input['transactionId'], false), + ]; + case 'retrieve': + // Check order view permissions + if (!$access || empty($access['view'])) { + return [ + 'success' => false, + 'message' => sprintf($this->module->l('You do not have permission to %s payments'), $this->module->l('view')), + ]; + } + return [ + 'success' => true, + 'payment' => $this->apiService->getFilteredApiPayment($this->module->api, $input['transactionId'], false) + ]; + default: + return ['success' => false]; + } + } elseif ($input['resource'] === 'orders') { + switch ($input['action']) { + case 'retrieve': + // Check order edit permissions + if (!$access || empty($access['view'])) { + return [ + 'success' => false, + 'message' => sprintf($this->module->l('You do not have permission to %s payments'), $this->module->l('edit')), + ]; + } + $info = $this->paymentMethodRepository->getPaymentBy('transaction_id', $input['transactionId']); + if (!$info) { + return ['success' => false]; + } + $tracking = $this->shipmentService->getShipmentInformation($info['order_reference']); + + return [ + 'success' => true, + 'order' => $this->apiService->getFilteredApiOrder($this->module->api, $input['transactionId']), + 'tracking' => $tracking, + ]; + case 'ship': + // Check order edit permissions + if (!$access || empty($access['edit'])) { + return [ + 'success' => false, + 'message' => sprintf($this->module->l('You do not have permission to %s payments'), $this->module->l('ship')), + ]; + } + $status = $this->shipService->doShipOrderLines($input['transactionId'], isset($input['orderLines']) ? $input['orderLines'] : [], isset($input['tracking']) ? $input['tracking'] : null); + return array_merge($status, ['order' => $this->apiService->getFilteredApiOrder($this->module->api, $input['transactionId'])]); + case 'refund': + // Check order edit permissions + if (!$access || empty($access['edit'])) { + return [ + 'success' => false, + 'message' => sprintf($this->module->l('You do not have permission to %s payments'), $this->module->l('refund')), + ]; + } + $status = $this->refundService->doRefundOrderLines($input['transactionId'], isset($input['orderLines']) ? $input['orderLines'] : []); + return array_merge($status, ['order' => $this->apiService->getFilteredApiOrder($this->module->api, $input['transactionId'])]); + case 'cancel': + // Check order edit permissions + if (!$access || empty($access['edit'])) { + return [ + 'success' => false, + 'message' => sprintf($this->module->l('You do not have permission to %s payments'), $this->module->l('cancel')), + ]; + } + $status = $this->cancelService->doCancelOrderLines($input['transactionId'], isset($input['orderLines']) ? $input['orderLines'] : []); + return array_merge($status, ['order' => $this->apiService->getFilteredApiOrder($this->module->api, $input['transactionId'])]); + default: + return ['success' => false]; + } + } + } catch (Exception $e) { + PrestaShopLogger::addLog("Mollie module error: {$e->getMessage()}"); + return ['success' => false]; + } + + return ['success' => false]; + } } \ No newline at end of file diff --git a/src/Service/OrderFeeService.php b/src/Service/OrderFeeService.php index 9ed1688e5..3ba8bbb4f 100644 --- a/src/Service/OrderFeeService.php +++ b/src/Service/OrderFeeService.php @@ -1,26 +1,60 @@ - $method) { - if ((int)$method['surcharge'] === 0) { - $methods[$index]['fee'] = false; - $methods[$index]['fee_display'] = false; - continue; - } - $paymentMethod = new MolPaymentMethod($method['id_payment_method']); - $paymentFee = \Mollie\Utility\PaymentFeeUtility::getPaymentFee($paymentMethod, $totalPrice); - $methods[$index]['fee'] = $paymentFee; - $methods[$index]['fee_display'] = Tools::displayPrice($paymentFee); - } - - return $methods; - } + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Service; + +use Mollie\Utility\PaymentFeeUtility; +use MolPaymentMethod; +use Tools; + +class OrderFeeService +{ + public function getPaymentFees($methods, $totalPrice) + { + foreach ($methods as $index => $method) { + if ((int)$method['surcharge'] === 0) { + $methods[$index]['fee'] = false; + $methods[$index]['fee_display'] = false; + continue; + } + $paymentMethod = new MolPaymentMethod($method['id_payment_method']); + $paymentFee = PaymentFeeUtility::getPaymentFee($paymentMethod, $totalPrice); + $methods[$index]['fee'] = $paymentFee; + $methods[$index]['fee_display'] = Tools::displayPrice($paymentFee); + } + + return $methods; + } } \ No newline at end of file diff --git a/src/Service/OrderStatusService.php b/src/Service/OrderStatusService.php index 7b6c70f72..85c50bfe9 100644 --- a/src/Service/OrderStatusService.php +++ b/src/Service/OrderStatusService.php @@ -1,83 +1,118 @@ - $prestaShopStatusId) { - if ((int)$prestaShopStatusId === $statusId) { - $status = $mollieStatus; - break; - } - } - } - - if ((int) $statusId === 0) { - return; - } - - if (!$order instanceof Order) { - $order = new Order((int)$order); - } - - if (!Validate::isLoadedObject($order)) { - return; - } - - $history = array_map(function ($item) { - return (int)$item['id_order_state']; - }, $order->getHistory(Context::getContext()->language->id)); - if (!Validate::isLoadedObject($order) - || !$status - ) { - return; - } - if ($useExistingPayment === null) { - $useExistingPayment = !$order->hasInvoice(); - } - - $history = new OrderHistory(); - $history->id_order = $order->id; - $history->changeIdOrderState($statusId, $order, $useExistingPayment); - - if (Configuration::get('MOLLIE_MAIL_WHEN_' . Tools::strtoupper($status))) { - $history->addWithemail(true, $templateVars); - } else { - $history->add(); - } - } - + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Service; + +use Configuration; +use Context; +use Mollie\Config\Config; +use Order; +use OrderHistory; +use PrestaShopDatabaseException; +use PrestaShopException; +use Tools; +use Validate; + +class OrderStatusService +{ + /** + * @param int $order + * @param string|int $statusId + * @param null $useExistingPayment + * @param array $templateVars + * + * @return void + * + * @throws PrestaShopDatabaseException + * @throws PrestaShopException + * @since 3.3.2 Accept both Order ID and Order object + * @since 3.3.2 Accept both Mollie status string and PrestaShop status ID + * @since 3.3.2 $useExistingPayment option + * @since 3.3.4 Accepts template vars for the corresponding email template + */ + public function setOrderStatus($order, $statusId, $useExistingPayment = null, $templateVars = []) + { + if (is_string($statusId)) { + $status = $statusId; + if (empty(Config::getStatuses()[$statusId])) { + return; + } + $statusId = (int)Config::getStatuses()[$statusId]; + } else { + $status = ''; + foreach (Config::getStatuses() as $mollieStatus => $prestaShopStatusId) { + if ((int)$prestaShopStatusId === $statusId) { + $status = $mollieStatus; + break; + } + } + } + + if ((int) $statusId === 0) { + return; + } + + if (!$order instanceof Order) { + $order = new Order((int)$order); + } + + if (!Validate::isLoadedObject($order)) { + return; + } + + $history = array_map(function ($item) { + return (int)$item['id_order_state']; + }, $order->getHistory(Context::getContext()->language->id)); + if (!Validate::isLoadedObject($order) + || !$status + ) { + return; + } + if ($useExistingPayment === null) { + $useExistingPayment = !$order->hasInvoice(); + } + + $history = new OrderHistory(); + $history->id_order = $order->id; + $history->changeIdOrderState($statusId, $order, $useExistingPayment); + + if (Configuration::get('MOLLIE_MAIL_WHEN_' . Tools::strtoupper($status))) { + $history->addWithemail(true, $templateVars); + } else { + $history->add(); + } + } + } \ No newline at end of file diff --git a/src/Service/PaymentMethodService.php b/src/Service/PaymentMethodService.php index aa772ce78..38381e5b7 100644 --- a/src/Service/PaymentMethodService.php +++ b/src/Service/PaymentMethodService.php @@ -1,332 +1,371 @@ -module = $module; - $this->methodRepository = $methodRepository; - $this->countryRepository = $countryRepository; - $this->cartLinesService = $cartLinesService; - } - - public function savePaymentMethod($method) - { - $paymentId = $this->methodRepository->getPaymentMethodIdByMethodId($method['id']); - $paymentMethod = new MolPaymentMethod(); - if ($paymentId) { - $paymentMethod = new MolPaymentMethod($paymentId); - } - $paymentMethod->id_method = $method['id']; - $paymentMethod->method_name = $method['name']; - $paymentMethod->enabled = Tools::getValue(Mollie\Config\Config::MOLLIE_METHOD_ENABLED . $method['id']); - $paymentMethod->title = Tools::getValue(Mollie\Config\Config::MOLLIE_METHOD_TITLE . $method['id']); - $paymentMethod->method = Tools::getValue(Mollie\Config\Config::MOLLIE_METHOD_API . $method['id']); - $paymentMethod->description = Tools::getValue(Mollie\Config\Config::MOLLIE_METHOD_DESCRIPTION . $method['id']); - $paymentMethod->is_countries_applicable = Tools::getValue(Mollie\Config\Config::MOLLIE_METHOD_APPLICABLE_COUNTRIES . $method['id']); - $paymentMethod->minimal_order_value = Tools::getValue(Mollie\Config\Config::MOLLIE_METHOD_MINIMUM_ORDER_VALUE . $method['id']); - $paymentMethod->max_order_value = Tools::getValue(Mollie\Config\Config::MOLLIE_METHOD_MAX_ORDER_VALUE . $method['id']); - $paymentMethod->surcharge = Tools::getValue(Mollie\Config\Config::MOLLIE_METHOD_SURCHARGE_TYPE . $method['id']); - $paymentMethod->surcharge_fixed_amount = Tools::getValue(Mollie\Config\Config::MOLLIE_METHOD_SURCHARGE_FIXED_AMOUNT . $method['id']); - $paymentMethod->surcharge_percentage = Tools::getValue(Mollie\Config\Config::MOLLIE_METHOD_SURCHARGE_PERCENTAGE . $method['id']); - $paymentMethod->surcharge_limit = Tools::getValue(Mollie\Config\Config::MOLLIE_METHOD_SURCHARGE_LIMIT . $method['id']); - $paymentMethod->images_json = json_encode($method['image']); - - $paymentMethod->save(); - - return $paymentMethod; - } - - /** - * Get payment methods to show on the checkout - * - * @return array - * - * @throws \PrestaShopDatabaseException - * @throws \PrestaShopException - * @since 3.0.0 - * @since 3.4.0 public - * - * @public ✓ This method is part of the public API - */ - public function getMethodsForCheckout() - { - if (!Configuration::get(Config::MOLLIE_API_KEY)) { - return []; - } - $context = Context::getContext(); - $iso = Tools::strtolower($context->currency->iso_code); - $methods = $this->methodRepository->getMethodsForCheckout(); - if (empty($methods)) { - $methods = []; - } - $countryCode = Tools::strtolower($context->country->iso_code); - $unavailableMethods = []; - foreach (Mollie\Config\Config::$defaultMethodAvailability as $methodName => $countries) { - if (!in_array($methodName, ['klarnapaylater', 'klarnasliceit']) - || empty($countries) - ) { - continue; - } - if (!in_array($countryCode, $countries)) { - $unavailableMethods[] = $methodName; - } - } - - foreach ($methods as $index => $method) { - $methodObj = new MolPaymentMethod($method['id_payment_method']); - if (!isset(Mollie\Config\Config::$methodCurrencies[$methodObj->id_method]) - || !in_array($iso, Mollie\Config\Config::$methodCurrencies[$methodObj->id_method]) - || !$methodObj->enabled - || in_array($methodObj->id_method, $unavailableMethods) - ) { - unset($methods[$index]); - } - if ($methodObj->id_method === Mollie\Config\Config::APPLEPAY) { - if (!Configuration::get('PS_SSL_ENABLED_EVERYWHERE')) { - unset($methods[$index]); - } elseif ($_COOKIE['isApplePayMethod'] === '0') { - unset($methods[$index]); - } - } - } - - if (version_compare(_PS_VERSION_, '1.6.0.9', '>')) { - foreach ($methods as $index => $methodId) { - $methodObj = new MolPaymentMethod($methodId['id_payment_method']); - if (!$methodObj->is_countries_applicable) { - if (!$this->countryRepository->checkIfMethodIsAvailableInCountry($methodObj->id_method, $country = Country::getByIso($countryCode))) { - unset($methods[$index]); - } - } - } - } - - return $methods; - } - - /** - * Get payment data - * - * @param float|string $amount - * @param $currency - * @param string $method - * @param string|null $issuer - * @param int|Cart $cartId - * @param string $secureKey - * @param MolPaymentMethod $molPaymentMethod - * @param bool $qrCode - * @param string $orderReference - * - * @return array - * @since 3.3.0 Order reference - */ - public function getPaymentData( - $amount, - $currency, - $method, - $issuer, - $cartId, - $secureKey, - MolPaymentMethod $molPaymentMethod, - $qrCode = false, - $orderReference = '', - $cardToken = false - ) { - if (!$orderReference) { - $this->module->currentOrderReference = $orderReference = Order::generateReference(); - } - $description = \Mollie\Utility\TextGeneratorUtility::generateDescriptionFromCart($molPaymentMethod->description, $cartId, $orderReference); - $context = Context::getContext(); - $cart = new Cart($cartId); - $customer = new Customer($cart->id_customer); - - $paymentFee = \Mollie\Utility\PaymentFeeUtility::getPaymentFee($molPaymentMethod, $amount); - $totalAmount = (number_format(str_replace(',', '.', $amount), 2, '.', '')); - $totalAmount += $paymentFee; - - $paymentData = [ - 'amount' => [ - 'currency' => (string)($currency ? Tools::strtoupper($currency) : 'EUR'), - 'value' => (string)number_format($totalAmount, 2, '.', ''), - ], - 'method' => $method, - 'redirectUrl' => ($qrCode - ? $context->link->getModuleLink( - 'mollie', - 'qrcode', - ['cart_id' => $cartId, 'done' => 1, 'rand' => time()], - true - ) - : $context->link->getModuleLink( - 'mollie', - 'return', - ['cart_id' => $cartId, 'utm_nooverride' => 1, 'rand' => time()], - true - ) - ), - ]; - if ($cardToken) { - $paymentData['cardToken'] = $cardToken; - } - if (!\Mollie\Utility\EnvironmentUtility::isLocalEnvironment()) { - $paymentData['webhookUrl'] = $context->link->getModuleLink( - 'mollie', - 'webhook', - [], - true - ); - } - - $paymentData['metadata'] = [ - 'cart_id' => $cartId, - 'order_reference' => $orderReference, - 'secure_key' => Tools::encrypt($secureKey), - ]; - - // Send webshop locale - if (($molPaymentMethod->method === Mollie\Config\Config::MOLLIE_PAYMENTS_API - && Configuration::get(Mollie\Config\Config::MOLLIE_PAYMENTSCREEN_LOCALE) === Mollie\Config\Config::PAYMENTSCREEN_LOCALE_SEND_WEBSITE_LOCALE) - || $molPaymentMethod->method === Mollie\Config\Config::MOLLIE_ORDERS_API - ) { - $locale = \Mollie\Utility\LocaleUtility::getWebshopLocale(); - if (preg_match( - '/^[a-z]{2}(?:[\-_][A-Z]{2})?$/iu', - $locale - )) { - $paymentData['locale'] = $locale; - } - } - - if ($molPaymentMethod->method === Mollie\Config\Config::MOLLIE_PAYMENTS_API) { - $paymentData['description'] = str_ireplace( - ['%'], - [$cartId], - $description - ); - $paymentData['issuer'] = $issuer; - - if (isset($context->cart) && Tools::getValue('method') === 'paypal') { - if (isset($context->cart->id_customer)) { - $buyer = new Customer($context->cart->id_customer); - $paymentData['billingEmail'] = (string)$buyer->email; - } - if (isset($context->cart->id_address_invoice)) { - $billing = new Address((int)$context->cart->id_address_invoice); - $paymentData['billingAddress'] = [ - 'streetAndNumber' => (string)$billing->address1 . ' ' . $billing->address2, - 'city' => (string)$billing->city, - 'region' => (string)State::getNameById($billing->id_state), - 'country' => (string)Country::getIsoById($billing->id_country), - ]; - $paymentData['billingAddress']['postalCode'] = (string)$billing->postcode ?: '-'; - } - if (isset($context->cart->id_address_delivery)) { - $shipping = new Address((int)$context->cart->id_address_delivery); - $paymentData['shippingAddress'] = [ - 'streetAndNumber' => (string)$shipping->address1 . ' ' . $shipping->address2, - 'city' => (string)$shipping->city, - 'region' => (string)State::getNameById($shipping->id_state), - 'country' => (string)Country::getIsoById($shipping->id_country), - ]; - $paymentData['shippingAddress']['postalCode'] = (string)$shipping->postcode ?: '-'; - } - } - - switch ($method) { - case PaymentMethod::BANKTRANSFER: - $paymentData['billingEmail'] = $customer->email; - $paymentData['locale'] = \Mollie\Utility\LocaleUtility::getWebshopLocale(); - break; - case PaymentMethod::BITCOIN: - $paymentData['billingEmail'] = $customer->email; - break; - } - } elseif ($molPaymentMethod->method === Mollie\Config\Config::MOLLIE_ORDERS_API) { - if (isset($cart->id_address_invoice)) { - $billing = new Address((int)$cart->id_address_invoice); - $paymentData['billingAddress'] = [ - 'givenName' => (string)$customer->firstname, - 'familyName' => (string)$customer->lastname, - 'email' => (string)$customer->email, - 'streetAndNumber' => (string)$billing->address1 . ' ' . $billing->address2, - 'city' => (string)$billing->city, - 'region' => (string)State::getNameById($billing->id_state), - 'country' => (string)Country::getIsoById($billing->id_country), - ]; - $paymentData['billingAddress']['postalCode'] = (string)$billing->postcode ?: '-'; - } - if (isset($cart->id_address_delivery)) { - $shipping = new Address((int)$cart->id_address_delivery); - $paymentData['shippingAddress'] = [ - 'givenName' => (string)$customer->firstname, - 'familyName' => (string)$customer->lastname, - 'email' => (string)$customer->email, - 'streetAndNumber' => (string)$shipping->address1 . ' ' . $shipping->address2, - 'city' => (string)$shipping->city, - 'region' => (string)State::getNameById($shipping->id_state), - 'country' => (string)Country::getIsoById($shipping->id_country), - ]; - $paymentData['shippingAddress']['postalCode'] = (string)$shipping->postcode ?: '-'; - } - $paymentData['orderNumber'] = $orderReference; - - $paymentData['lines'] = $this->cartLinesService->getCartLines($amount, $paymentFee, $cart); - $paymentData['payment'] = []; - if (!\Mollie\Utility\EnvironmentUtility::isLocalEnvironment()) { - $paymentData['payment']['webhookUrl'] = $context->link->getModuleLink( - 'mollie', - 'webhook', - [], - true - ); - } - if ($issuer) { - $paymentData['payment']['issuer'] = $issuer; - } - } - - return $paymentData; - } - + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Service; + +use _PhpScoper5ea00cc67502b\Mollie\Api\Types\PaymentMethod; +use Address; +use Cart; +use Configuration; +use Context; +use Country; +use Customer; +use Mollie; +use Mollie\Config\Config; +use Mollie\Repository\MethodCountryRepository; +use Mollie\Repository\PaymentMethodRepository; +use Mollie\Utility\EnvironmentUtility; +use Mollie\Utility\LocaleUtility; +use Mollie\Utility\PaymentFeeUtility; +use Mollie\Utility\TextGeneratorUtility; +use MolPaymentMethod; +use Order; +use PrestaShopDatabaseException; +use PrestaShopException; +use State; +use Tools; + +class PaymentMethodService +{ + /** + * @var Mollie + */ + private $module; + /** + * @var PaymentMethodRepository + */ + private $methodRepository; + /** + * @var MethodCountryRepository + */ + private $countryRepository; + /** + * @var CartLinesService + */ + private $cartLinesService; + + public function __construct( + Mollie $module, + PaymentMethodRepository $methodRepository, + MethodCountryRepository $countryRepository, + CartLinesService $cartLinesService + ) + { + $this->module = $module; + $this->methodRepository = $methodRepository; + $this->countryRepository = $countryRepository; + $this->cartLinesService = $cartLinesService; + } + + public function savePaymentMethod($method) + { + $paymentId = $this->methodRepository->getPaymentMethodIdByMethodId($method['id']); + $paymentMethod = new MolPaymentMethod(); + if ($paymentId) { + $paymentMethod = new MolPaymentMethod($paymentId); + } + $paymentMethod->id_method = $method['id']; + $paymentMethod->method_name = $method['name']; + $paymentMethod->enabled = Tools::getValue(Mollie\Config\Config::MOLLIE_METHOD_ENABLED . $method['id']); + $paymentMethod->title = Tools::getValue(Mollie\Config\Config::MOLLIE_METHOD_TITLE . $method['id']); + $paymentMethod->method = Tools::getValue(Mollie\Config\Config::MOLLIE_METHOD_API . $method['id']); + $paymentMethod->description = Tools::getValue(Mollie\Config\Config::MOLLIE_METHOD_DESCRIPTION . $method['id']); + $paymentMethod->is_countries_applicable = Tools::getValue(Mollie\Config\Config::MOLLIE_METHOD_APPLICABLE_COUNTRIES . $method['id']); + $paymentMethod->minimal_order_value = Tools::getValue(Mollie\Config\Config::MOLLIE_METHOD_MINIMUM_ORDER_VALUE . $method['id']); + $paymentMethod->max_order_value = Tools::getValue(Mollie\Config\Config::MOLLIE_METHOD_MAX_ORDER_VALUE . $method['id']); + $paymentMethod->surcharge = Tools::getValue(Mollie\Config\Config::MOLLIE_METHOD_SURCHARGE_TYPE . $method['id']); + $paymentMethod->surcharge_fixed_amount = Tools::getValue(Mollie\Config\Config::MOLLIE_METHOD_SURCHARGE_FIXED_AMOUNT . $method['id']); + $paymentMethod->surcharge_percentage = Tools::getValue(Mollie\Config\Config::MOLLIE_METHOD_SURCHARGE_PERCENTAGE . $method['id']); + $paymentMethod->surcharge_limit = Tools::getValue(Mollie\Config\Config::MOLLIE_METHOD_SURCHARGE_LIMIT . $method['id']); + $paymentMethod->images_json = json_encode($method['image']); + + $paymentMethod->save(); + + return $paymentMethod; + } + + /** + * Get payment methods to show on the checkout + * + * @return array + * + * @throws PrestaShopDatabaseException + * @throws PrestaShopException + * @since 3.0.0 + * @since 3.4.0 public + * + * @public ✓ This method is part of the public API + */ + public function getMethodsForCheckout() + { + if (!Configuration::get(Config::MOLLIE_API_KEY)) { + return []; + } + $context = Context::getContext(); + $iso = Tools::strtolower($context->currency->iso_code); + $methods = $this->methodRepository->getMethodsForCheckout(); + if (empty($methods)) { + $methods = []; + } + $countryCode = Tools::strtolower($context->country->iso_code); + $unavailableMethods = []; + foreach (Mollie\Config\Config::$defaultMethodAvailability as $methodName => $countries) { + if (!in_array($methodName, ['klarnapaylater', 'klarnasliceit']) + || empty($countries) + ) { + continue; + } + if (!in_array($countryCode, $countries)) { + $unavailableMethods[] = $methodName; + } + } + + foreach ($methods as $index => $method) { + $methodObj = new MolPaymentMethod($method['id_payment_method']); + if (!isset(Mollie\Config\Config::$methodCurrencies[$methodObj->id_method]) + || !in_array($iso, Mollie\Config\Config::$methodCurrencies[$methodObj->id_method]) + || !$methodObj->enabled + || in_array($methodObj->id_method, $unavailableMethods) + ) { + unset($methods[$index]); + } + if ($methodObj->id_method === Mollie\Config\Config::APPLEPAY) { + if (!Configuration::get('PS_SSL_ENABLED_EVERYWHERE')) { + unset($methods[$index]); + } elseif (Context::getContext()->cookie->isApplePayMethod === '0') { + unset($methods[$index]); + } + } + } + + if (version_compare(_PS_VERSION_, '1.6.0.9', '>')) { + foreach ($methods as $index => $methodId) { + $methodObj = new MolPaymentMethod($methodId['id_payment_method']); + if (!$methodObj->is_countries_applicable) { + if (!$this->countryRepository->checkIfMethodIsAvailableInCountry($methodObj->id_method, $country = Country::getByIso($countryCode))) { + unset($methods[$index]); + } + } + } + } + + return $methods; + } + + /** + * Get payment data + * + * @param float|string $amount + * @param $currency + * @param string $method + * @param string|null $issuer + * @param int|Cart $cartId + * @param string $secureKey + * @param MolPaymentMethod $molPaymentMethod + * @param bool $qrCode + * @param string $orderReference + * + * @return array + * @since 3.3.0 Order reference + */ + public function getPaymentData( + $amount, + $currency, + $method, + $issuer, + $cartId, + $secureKey, + MolPaymentMethod $molPaymentMethod, + $qrCode = false, + $orderReference = '', + $cardToken = false + ) { + if (!$orderReference) { + $this->module->currentOrderReference = $orderReference = Order::generateReference(); + } + $description = TextGeneratorUtility::generateDescriptionFromCart($molPaymentMethod->description, $cartId, $orderReference); + $context = Context::getContext(); + $cart = new Cart($cartId); + $customer = new Customer($cart->id_customer); + + $paymentFee = PaymentFeeUtility::getPaymentFee($molPaymentMethod, $amount); + $totalAmount = (number_format(str_replace(',', '.', $amount), 2, '.', '')); + $totalAmount += $paymentFee; + + $paymentData = [ + 'amount' => [ + 'currency' => (string)($currency ? Tools::strtoupper($currency) : 'EUR'), + 'value' => (string)number_format($totalAmount, 2, '.', ''), + ], + 'method' => $method, + 'redirectUrl' => ($qrCode + ? $context->link->getModuleLink( + 'mollie', + 'qrcode', + ['cart_id' => $cartId, 'done' => 1, 'rand' => time()], + true + ) + : $context->link->getModuleLink( + 'mollie', + 'return', + ['cart_id' => $cartId, 'utm_nooverride' => 1, 'rand' => time()], + true + ) + ), + ]; + if ($cardToken) { + $paymentData['cardToken'] = $cardToken; + } + if (!EnvironmentUtility::isLocalEnvironment()) { + $paymentData['webhookUrl'] = $context->link->getModuleLink( + 'mollie', + 'webhook', + [], + true + ); + } + + $paymentData['metadata'] = [ + 'cart_id' => $cartId, + 'order_reference' => $orderReference, + 'secure_key' => Tools::encrypt($secureKey), + ]; + + // Send webshop locale + if (($molPaymentMethod->method === Mollie\Config\Config::MOLLIE_PAYMENTS_API + && Configuration::get(Mollie\Config\Config::MOLLIE_PAYMENTSCREEN_LOCALE) === Mollie\Config\Config::PAYMENTSCREEN_LOCALE_SEND_WEBSITE_LOCALE) + || $molPaymentMethod->method === Mollie\Config\Config::MOLLIE_ORDERS_API + ) { + $locale = LocaleUtility::getWebshopLocale(); + if (preg_match( + '/^[a-z]{2}(?:[\-_][A-Z]{2})?$/iu', + $locale + )) { + $paymentData['locale'] = $locale; + } + } + + if ($molPaymentMethod->method === Mollie\Config\Config::MOLLIE_PAYMENTS_API) { + $paymentData['description'] = str_ireplace( + ['%'], + [$cartId], + $description + ); + $paymentData['issuer'] = $issuer; + + if (isset($context->cart) && Tools::getValue('method') === 'paypal') { + if (isset($context->cart->id_customer)) { + $buyer = new Customer($context->cart->id_customer); + $paymentData['billingEmail'] = (string)$buyer->email; + } + if (isset($context->cart->id_address_invoice)) { + $billing = new Address((int)$context->cart->id_address_invoice); + $paymentData['billingAddress'] = [ + 'streetAndNumber' => (string)$billing->address1 . ' ' . $billing->address2, + 'city' => (string)$billing->city, + 'region' => (string)State::getNameById($billing->id_state), + 'country' => (string)Country::getIsoById($billing->id_country), + ]; + $paymentData['billingAddress']['postalCode'] = (string)$billing->postcode ?: '-'; + } + if (isset($context->cart->id_address_delivery)) { + $shipping = new Address((int)$context->cart->id_address_delivery); + $paymentData['shippingAddress'] = [ + 'streetAndNumber' => (string)$shipping->address1 . ' ' . $shipping->address2, + 'city' => (string)$shipping->city, + 'region' => (string)State::getNameById($shipping->id_state), + 'country' => (string)Country::getIsoById($shipping->id_country), + ]; + $paymentData['shippingAddress']['postalCode'] = (string)$shipping->postcode ?: '-'; + } + } + + switch ($method) { + case PaymentMethod::BANKTRANSFER: + $paymentData['billingEmail'] = $customer->email; + $paymentData['locale'] = LocaleUtility::getWebshopLocale(); + break; + case PaymentMethod::BITCOIN: + $paymentData['billingEmail'] = $customer->email; + break; + } + } elseif ($molPaymentMethod->method === Mollie\Config\Config::MOLLIE_ORDERS_API) { + if (isset($cart->id_address_invoice)) { + $billing = new Address((int)$cart->id_address_invoice); + $paymentData['billingAddress'] = [ + 'givenName' => (string)$customer->firstname, + 'familyName' => (string)$customer->lastname, + 'email' => (string)$customer->email, + 'streetAndNumber' => (string)$billing->address1 . ' ' . $billing->address2, + 'city' => (string)$billing->city, + 'region' => (string)State::getNameById($billing->id_state), + 'country' => (string)Country::getIsoById($billing->id_country), + ]; + $paymentData['billingAddress']['postalCode'] = (string)$billing->postcode ?: '-'; + } + if (isset($cart->id_address_delivery)) { + $shipping = new Address((int)$cart->id_address_delivery); + $paymentData['shippingAddress'] = [ + 'givenName' => (string)$customer->firstname, + 'familyName' => (string)$customer->lastname, + 'email' => (string)$customer->email, + 'streetAndNumber' => (string)$shipping->address1 . ' ' . $shipping->address2, + 'city' => (string)$shipping->city, + 'region' => (string)State::getNameById($shipping->id_state), + 'country' => (string)Country::getIsoById($shipping->id_country), + ]; + $paymentData['shippingAddress']['postalCode'] = (string)$shipping->postcode ?: '-'; + } + $paymentData['orderNumber'] = $orderReference; + + $paymentData['lines'] = $this->cartLinesService->getCartLines($amount, $paymentFee, $cart); + $paymentData['payment'] = []; + if (!EnvironmentUtility::isLocalEnvironment()) { + $paymentData['payment']['webhookUrl'] = $context->link->getModuleLink( + 'mollie', + 'webhook', + [], + true + ); + } + if ($issuer) { + $paymentData['payment']['issuer'] = $issuer; + } + } + + return $paymentData; + } + } \ No newline at end of file diff --git a/src/Service/RefundService.php b/src/Service/RefundService.php index f021f1fd9..5870c4e41 100644 --- a/src/Service/RefundService.php +++ b/src/Service/RefundService.php @@ -1,139 +1,175 @@ -module = $module; - } - - /** - * @param string $transactionId Transaction/Mollie Order ID - * @param float|null $amount Amount to refund, refund all if `null` - * - * @return array - * - * @throws \PrestaShopDatabaseException - * @throws \PrestaShopException - * @throws \PrestaShop\PrestaShop\Adapter\CoreException - * @throws ApiException - * @since 3.3.0 Renamed `doRefund` to `doPaymentRefund`, added `$amount` - * @since 3.3.2 Omit $orderId - */ - public function doPaymentRefund($transactionId, $amount = null) - { - try { - /** @var Payment $payment */ - $payment = $this->module->api->payments->get($transactionId); - if ($amount) { - $payment->refund([ - 'amount' => [ - 'currency' => (string)$payment->amount->currency, - 'value' => (string)number_format($amount, 2, '.', ''), - ], - ]); - } elseif ((float)$payment->settlementAmount->value - (float)$payment->amountRefunded->value > 0) { - $payment->refund([ - 'amount' => [ - 'currency' => (string)$payment->amount->currency, - 'value' => (string)number_format(((float)$payment->settlementAmount->value - (float)$payment->amountRefunded->value), 2, '.', ''), - ], - ]); - } - } catch (ApiException $e) { - return [ - 'status' => 'fail', - 'msg_fail' => $this->module->l('The order could not be refunded!'), - 'msg_details' => $this->module->l('Reason:') . ' ' . $e->getMessage(), - ]; - } - - if (EnvironmentUtility::isLocalEnvironment()) { - // Refresh payment on local environments - /** @var Payment $payment */ - $apiPayment = $this->module->api->payments->get($transactionId); - if (!Tools::isSubmit('module')) { - $_GET['module'] = $this->module->name; - } - $webhookController = new MollieWebhookModuleFrontController(); - $webhookController->processTransaction($apiPayment); - } - - return [ - 'status' => 'success', - 'msg_success' => $this->module->l('The order has been refunded!'), - 'msg_details' => $this->module->l('Mollie B.V. will transfer the money back to the customer on the next business day.'), - ]; - } - - /** - * @param string $transactionId - * @param array $lines - * - * @return array - * - * @throws \PrestaShopDatabaseException - * @throws \PrestaShopException - * @throws \PrestaShop\PrestaShop\Adapter\CoreException - * @throws \SmartyException - * @since 3.3.0 - */ - public function doRefundOrderLines($transactionId, $lines = []) - { - try { - /** @var MollieOrderAlias $payment */ - $order = $this->module->api->orders->get($transactionId, ['embed' => 'payments']); - $refund = [ - 'lines' => array_map(function ($line) { - return array_intersect_key( - (array)$line, - array_flip([ - 'id', - 'quantity', - ])); - }, $lines), - ]; - $order->refund($refund); - - if (EnvironmentUtility::isLocalEnvironment()) { - // Refresh payment on local environments - /** @var Payment $payment */ - $apiPayment = $this->module->api->orders->get($transactionId, ['embed' => 'payments']); - if (!Tools::isSubmit('module')) { - $_GET['module'] = $this->module->name; - } - $webhookController = new MollieWebhookModuleFrontController(); - $webhookController->processTransaction($apiPayment); - } - } catch (ApiException $e) { - return [ - 'success' => false, - 'message' => $this->module->l('The product(s) could not be refunded!'), - 'detailed' => $e->getMessage(), - ]; - } - - return [ - 'success' => true, - 'message' => '', - 'detailed' => '', - ]; - } - + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Service; + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use Mollie; +use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Order as MollieOrderAlias; +use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Payment; +use Mollie\Utility\EnvironmentUtility; +use MollieWebhookModuleFrontController; +use PrestaShop\PrestaShop\Adapter\CoreException; +use PrestaShopDatabaseException; +use PrestaShopException; +use SmartyException; +use Tools; + +class RefundService +{ + /** + * @var Mollie + */ + private $module; + + public function __construct(Mollie $module) + { + $this->module = $module; + } + + /** + * @param string $transactionId Transaction/Mollie Order ID + * @param float|null $amount Amount to refund, refund all if `null` + * + * @return array + * + * @throws PrestaShopDatabaseException + * @throws PrestaShopException + * @throws CoreException + * @throws ApiException + * @since 3.3.0 Renamed `doRefund` to `doPaymentRefund`, added `$amount` + * @since 3.3.2 Omit $orderId + */ + public function doPaymentRefund($transactionId, $amount = null) + { + try { + /** @var Payment $payment */ + $payment = $this->module->api->payments->get($transactionId); + if ($amount) { + $payment->refund([ + 'amount' => [ + 'currency' => (string)$payment->amount->currency, + 'value' => (string)number_format($amount, 2, '.', ''), + ], + ]); + } elseif ((float)$payment->settlementAmount->value - (float)$payment->amountRefunded->value > 0) { + $payment->refund([ + 'amount' => [ + 'currency' => (string)$payment->amount->currency, + 'value' => (string)number_format(((float)$payment->settlementAmount->value - (float)$payment->amountRefunded->value), 2, '.', ''), + ], + ]); + } + } catch (ApiException $e) { + return [ + 'status' => 'fail', + 'msg_fail' => $this->module->l('The order could not be refunded!'), + 'msg_details' => $this->module->l('Reason:') . ' ' . $e->getMessage(), + ]; + } + + if (EnvironmentUtility::isLocalEnvironment()) { + // Refresh payment on local environments + /** @var Payment $payment */ + $apiPayment = $this->module->api->payments->get($transactionId); + if (!Tools::isSubmit('module')) { + $_GET['module'] = $this->module->name; + } + $webhookController = new MollieWebhookModuleFrontController(); + $webhookController->processTransaction($apiPayment); + } + + return [ + 'status' => 'success', + 'msg_success' => $this->module->l('The order has been refunded!'), + 'msg_details' => $this->module->l('Mollie B.V. will transfer the money back to the customer on the next business day.'), + ]; + } + + /** + * @param string $transactionId + * @param array $lines + * + * @return array + * + * @throws PrestaShopDatabaseException + * @throws PrestaShopException + * @throws CoreException + * @throws SmartyException + * @since 3.3.0 + */ + public function doRefundOrderLines($transactionId, $lines = []) + { + try { + /** @var MollieOrderAlias $payment */ + $order = $this->module->api->orders->get($transactionId, ['embed' => 'payments']); + $refund = [ + 'lines' => array_map(function ($line) { + return array_intersect_key( + (array)$line, + array_flip([ + 'id', + 'quantity', + ])); + }, $lines), + ]; + $order->refund($refund); + + if (EnvironmentUtility::isLocalEnvironment()) { + // Refresh payment on local environments + /** @var Payment $payment */ + $apiPayment = $this->module->api->orders->get($transactionId, ['embed' => 'payments']); + if (!Tools::isSubmit('module')) { + $_GET['module'] = $this->module->name; + } + $webhookController = new MollieWebhookModuleFrontController(); + $webhookController->processTransaction($apiPayment); + } + } catch (ApiException $e) { + return [ + 'success' => false, + 'message' => $this->module->l('The product(s) could not be refunded!'), + 'detailed' => $e->getMessage(), + ]; + } + + return [ + 'success' => true, + 'message' => '', + 'detailed' => '', + ]; + } + } \ No newline at end of file diff --git a/src/Service/SettingsSaveService.php b/src/Service/SettingsSaveService.php index 7d438ed37..1c060b438 100644 --- a/src/Service/SettingsSaveService.php +++ b/src/Service/SettingsSaveService.php @@ -1,234 +1,269 @@ -module = $module; - $this->countryRepository = $countryRepository; - $this->paymentMethodRepository = $paymentMethodRepository; - $this->paymentMethodService = $paymentMethodService; - $this->apiService = $apiService; - $this->carrierInformationService = $carrierInformationService; - } - - /** - * @param array $errors - * - * @return string - * @throws ApiException - * @throws \PrestaShopDatabaseException - * @throws \PrestaShopException - */ - public function saveSettings(&$errors = []) - { - $mollieApiKey = Tools::getValue(Config::MOLLIE_API_KEY); - $mollieProfileId = Tools::getValue(Config::MOLLIE_PROFILE_ID); - - if (strpos($mollieApiKey, 'live') !== 0 && strpos($mollieApiKey, 'test') !== 0) { - $errors[] = $this->module->l('The API key needs to start with test or live.'); - } - - if (Tools::getValue(Config::METHODS_CONFIG) && json_decode(Tools::getValue(Config::METHODS_CONFIG))) { - Configuration::updateValue( - Config::METHODS_CONFIG, - json_encode(@json_decode(Tools::getValue(Config::METHODS_CONFIG))) - ); - } - - if ($this->module->api->methods !== null && Configuration::get(Config::MOLLIE_API_KEY)) { - foreach ($this->apiService->getMethodsForConfig($this->module->api, $this->module->getPathUri()) as $method) { - try { - $paymentMethod = $this->paymentMethodService->savePaymentMethod($method); - } catch (Exception $e) { - $errors[] = $this->module->l('Something went wrong. Couldn\'t save your payment methods'); - } - - - if (!$this->paymentMethodRepository->deletePaymentMethodIssuersByPaymentMethodId($paymentMethod->id)) { - $errors[] = $this->module->l('Something went wrong. Couldn\'t delete old payment methods issuers'); - } - - if ($method['issuers']) { - $paymentMethodIssuer = new MolPaymentMethodIssuer(); - $paymentMethodIssuer->issuers_json = json_encode($method['issuers']); - $paymentMethodIssuer->id_payment_method = $paymentMethod->id; - try { - $paymentMethodIssuer->add(); - } catch (Exception $e) { - $errors[] = $this->module->l('Something went wrong. Couldn\'t save your payment methods issuer'); - } - } - - $countries = Tools::getValue(Config::MOLLIE_METHOD_CERTAIN_COUNTRIES . $method['id']); - $this->countryRepository->updatePaymentMethodCountries($method['id'], $countries); - } - } - - $molliePaymentscreenLocale = Tools::getValue(Config::MOLLIE_PAYMENTSCREEN_LOCALE); - $mollieIFrameEnabled = Tools::getValue(Config::MOLLIE_IFRAME); - $mollieImages = Tools::getValue(Config::MOLLIE_IMAGES); - $mollieIssuers = Tools::getValue(Config::MOLLIE_ISSUERS); - $mollieCss = Tools::getValue(Config::MOLLIE_CSS); - if (!isset($mollieCss)) { - $mollieCss = ''; - } - $mollieLogger = Tools::getValue(Config::MOLLIE_DEBUG_LOG); - $mollieApi = Tools::getValue(Config::MOLLIE_API); - $mollieQrEnabled = (bool)Tools::getValue(Config::MOLLIE_QRENABLED); - $mollieMethodCountriesEnabled = (bool)Tools::getValue(Config::MOLLIE_METHOD_COUNTRIES); - $mollieMethodCountriesDisplayEnabled = (bool)Tools::getValue(Config::MOLLIE_METHOD_COUNTRIES_DISPLAY); - $mollieErrors = Tools::getValue(Config::MOLLIE_DISPLAY_ERRORS); - - $mollieShipMain = Tools::getValue(Config::MOLLIE_AUTO_SHIP_MAIN); - if (!isset($mollieErrors)) { - $mollieErrors = false; - } else { - $mollieErrors = ($mollieErrors == 1); - } - - if (empty($errors)) { - Configuration::updateValue(Config::MOLLIE_API_KEY, $mollieApiKey); - Configuration::updateValue(Config::MOLLIE_PROFILE_ID, $mollieProfileId); - Configuration::updateValue(Config::MOLLIE_PAYMENTSCREEN_LOCALE, $molliePaymentscreenLocale); - Configuration::updateValue(Config::MOLLIE_IFRAME, $mollieIFrameEnabled); - Configuration::updateValue(Config::MOLLIE_IMAGES, $mollieImages); - Configuration::updateValue(Config::MOLLIE_ISSUERS, $mollieIssuers); - Configuration::updateValue(Config::MOLLIE_QRENABLED, (bool)$mollieQrEnabled); - Configuration::updateValue(Config::MOLLIE_METHOD_COUNTRIES, (bool)$mollieMethodCountriesEnabled); - Configuration::updateValue(Config::MOLLIE_METHOD_COUNTRIES_DISPLAY, (bool)$mollieMethodCountriesDisplayEnabled); - Configuration::updateValue(Config::MOLLIE_CSS, $mollieCss); - Configuration::updateValue(Config::MOLLIE_DISPLAY_ERRORS, (int)$mollieErrors); - Configuration::updateValue(Config::MOLLIE_DEBUG_LOG, (int)$mollieLogger); - Configuration::updateValue(Config::MOLLIE_API, $mollieApi); - Configuration::updateValue( - Config::MOLLIE_AUTO_SHIP_STATUSES, - json_encode($this->getStatusesValue(Config::MOLLIE_AUTO_SHIP_STATUSES)) - ); - Configuration::updateValue(Config::MOLLIE_AUTO_SHIP_MAIN, (bool)$mollieShipMain); - Configuration::updateValue( - Config::MOLLIE_TRACKING_URLS, - json_encode(@json_decode(Tools::getValue(Config::MOLLIE_TRACKING_URLS))) - ); - $carriers = \Carrier::getCarriers( - Context::getContext()->language->id, - false, - false, - false, - null, - Carrier::ALL_CARRIERS - ); - foreach ($carriers as $carrier) { - $urlSource = Tools::getValue(Config::MOLLIE_CARRIER_URL_SOURCE . $carrier['id_carrier']); - $customUrl = Tools::getValue(Config::MOLLIE_CARRIER_CUSTOM_URL . $carrier['id_carrier']); - $this->carrierInformationService->saveMolCarrierInfo($carrier['id_carrier'], $urlSource, $customUrl); - } - - foreach (array_keys(Config::getStatuses()) as $name) { - $name = Tools::strtoupper($name); - $new = (int)Tools::getValue("MOLLIE_STATUS_{$name}"); - Configuration::updateValue("MOLLIE_STATUS_{$name}", $new); - Config::getStatuses()[Tools::strtolower($name)] = $new; - - if ($name != PaymentStatus::STATUS_OPEN) { - Configuration::updateValue( - "MOLLIE_MAIL_WHEN_{$name}", - Tools::getValue("MOLLIE_MAIL_WHEN_{$name}") ? true : false - ); - } - } - - if ($mollieApiKey) { - try { - $this->module->api->setApiKey($mollieApiKey); - } catch (Exception $e) { - $errors[] = $e->getMessage(); - Configuration::updateValue(Config::MOLLIE_API_KEY, null); - return $this->module->l('Wrong API Key!'); - } - } - - $resultMessage = $this->module->l('The configuration has been saved!'); - } else { - $resultMessage = []; - foreach ($errors as $error) { - $resultMessage[] = $error; - } - } - - return $resultMessage; - } - - /** - * Get all status values from the form. - * - * @param $key string The key that is used in the HelperForm - * - * @return array Array with statuses - * - * @throws PrestaShopDatabaseException - * @throws PrestaShopException - * - * @since 3.3.0 - */ - private function getStatusesValue($key) - { - $statesEnabled = []; - $context = Context::getContext(); - foreach (OrderState::getOrderStates($context->language->id) as $state) { - if (Tools::isSubmit($key . '_' . $state['id_order_state'])) { - $statesEnabled[] = $state['id_order_state']; - } - } - - return $statesEnabled; - } + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Service; + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use _PhpScoper5ea00cc67502b\Mollie\Api\Types\PaymentStatus; +use Carrier; +use Configuration; +use Context; +use Exception; +use Mollie; +use Mollie\Config\Config; +use Mollie\Repository\CountryRepository; +use Mollie\Repository\PaymentMethodRepository; +use MolPaymentMethodIssuer; +use OrderState; +use PrestaShopDatabaseException; +use PrestaShopException; +use Tools; + +class SettingsSaveService +{ + + /** + * @var Mollie + */ + private $module; + /** + * @var CountryRepository + */ + private $countryRepository; + /** + * @var PaymentMethodRepository + */ + private $paymentMethodRepository; + /** + * @var PaymentMethodService + */ + private $paymentMethodService; + /** + * @var ApiService + */ + private $apiService; + /** + * @var MolCarrierInformationService + */ + private $carrierInformationService; + + public function __construct( + Mollie $module, + CountryRepository $countryRepository, + PaymentMethodRepository $paymentMethodRepository, + PaymentMethodService $paymentMethodService, + ApiService $apiService, + MolCarrierInformationService $carrierInformationService + ) { + $this->module = $module; + $this->countryRepository = $countryRepository; + $this->paymentMethodRepository = $paymentMethodRepository; + $this->paymentMethodService = $paymentMethodService; + $this->apiService = $apiService; + $this->carrierInformationService = $carrierInformationService; + } + + /** + * @param array $errors + * + * @return string + * @throws ApiException + * @throws PrestaShopDatabaseException + * @throws PrestaShopException + */ + public function saveSettings(&$errors = []) + { + $mollieApiKey = Tools::getValue(Config::MOLLIE_API_KEY); + $mollieProfileId = Tools::getValue(Config::MOLLIE_PROFILE_ID); + + if (strpos($mollieApiKey, 'live') !== 0 && strpos($mollieApiKey, 'test') !== 0) { + $errors[] = $this->module->l('The API key needs to start with test or live.'); + } + + if (Tools::getValue(Config::METHODS_CONFIG) && json_decode(Tools::getValue(Config::METHODS_CONFIG))) { + Configuration::updateValue( + Config::METHODS_CONFIG, + json_encode(@json_decode(Tools::getValue(Config::METHODS_CONFIG))) + ); + } + + if ($this->module->api->methods !== null && Configuration::get(Config::MOLLIE_API_KEY)) { + foreach ($this->apiService->getMethodsForConfig($this->module->api, $this->module->getPathUri()) as $method) { + try { + $paymentMethod = $this->paymentMethodService->savePaymentMethod($method); + } catch (Exception $e) { + $errors[] = $this->module->l('Something went wrong. Couldn\'t save your payment methods'); + } + + + if (!$this->paymentMethodRepository->deletePaymentMethodIssuersByPaymentMethodId($paymentMethod->id)) { + $errors[] = $this->module->l('Something went wrong. Couldn\'t delete old payment methods issuers'); + } + + if ($method['issuers']) { + $paymentMethodIssuer = new MolPaymentMethodIssuer(); + $paymentMethodIssuer->issuers_json = json_encode($method['issuers']); + $paymentMethodIssuer->id_payment_method = $paymentMethod->id; + try { + $paymentMethodIssuer->add(); + } catch (Exception $e) { + $errors[] = $this->module->l('Something went wrong. Couldn\'t save your payment methods issuer'); + } + } + + $countries = Tools::getValue(Config::MOLLIE_METHOD_CERTAIN_COUNTRIES . $method['id']); + $this->countryRepository->updatePaymentMethodCountries($method['id'], $countries); + } + } + + $molliePaymentscreenLocale = Tools::getValue(Config::MOLLIE_PAYMENTSCREEN_LOCALE); + $mollieIFrameEnabled = Tools::getValue(Config::MOLLIE_IFRAME); + $mollieImages = Tools::getValue(Config::MOLLIE_IMAGES); + $mollieIssuers = Tools::getValue(Config::MOLLIE_ISSUERS); + $mollieCss = Tools::getValue(Config::MOLLIE_CSS); + if (!isset($mollieCss)) { + $mollieCss = ''; + } + $mollieLogger = Tools::getValue(Config::MOLLIE_DEBUG_LOG); + $mollieApi = Tools::getValue(Config::MOLLIE_API); + $mollieQrEnabled = (bool)Tools::getValue(Config::MOLLIE_QRENABLED); + $mollieMethodCountriesEnabled = (bool)Tools::getValue(Config::MOLLIE_METHOD_COUNTRIES); + $mollieMethodCountriesDisplayEnabled = (bool)Tools::getValue(Config::MOLLIE_METHOD_COUNTRIES_DISPLAY); + $mollieErrors = Tools::getValue(Config::MOLLIE_DISPLAY_ERRORS); + + $mollieShipMain = Tools::getValue(Config::MOLLIE_AUTO_SHIP_MAIN); + if (!isset($mollieErrors)) { + $mollieErrors = false; + } else { + $mollieErrors = ($mollieErrors == 1); + } + + if (empty($errors)) { + Configuration::updateValue(Config::MOLLIE_API_KEY, $mollieApiKey); + Configuration::updateValue(Config::MOLLIE_PROFILE_ID, $mollieProfileId); + Configuration::updateValue(Config::MOLLIE_PAYMENTSCREEN_LOCALE, $molliePaymentscreenLocale); + Configuration::updateValue(Config::MOLLIE_IFRAME, $mollieIFrameEnabled); + Configuration::updateValue(Config::MOLLIE_IMAGES, $mollieImages); + Configuration::updateValue(Config::MOLLIE_ISSUERS, $mollieIssuers); + Configuration::updateValue(Config::MOLLIE_QRENABLED, (bool)$mollieQrEnabled); + Configuration::updateValue(Config::MOLLIE_METHOD_COUNTRIES, (bool)$mollieMethodCountriesEnabled); + Configuration::updateValue(Config::MOLLIE_METHOD_COUNTRIES_DISPLAY, (bool)$mollieMethodCountriesDisplayEnabled); + Configuration::updateValue(Config::MOLLIE_CSS, $mollieCss); + Configuration::updateValue(Config::MOLLIE_DISPLAY_ERRORS, (int)$mollieErrors); + Configuration::updateValue(Config::MOLLIE_DEBUG_LOG, (int)$mollieLogger); + Configuration::updateValue(Config::MOLLIE_API, $mollieApi); + Configuration::updateValue( + Config::MOLLIE_AUTO_SHIP_STATUSES, + json_encode($this->getStatusesValue(Config::MOLLIE_AUTO_SHIP_STATUSES)) + ); + Configuration::updateValue(Config::MOLLIE_AUTO_SHIP_MAIN, (bool)$mollieShipMain); + Configuration::updateValue( + Config::MOLLIE_TRACKING_URLS, + json_encode(@json_decode(Tools::getValue(Config::MOLLIE_TRACKING_URLS))) + ); + $carriers = Carrier::getCarriers( + Context::getContext()->language->id, + false, + false, + false, + null, + Carrier::ALL_CARRIERS + ); + foreach ($carriers as $carrier) { + $urlSource = Tools::getValue(Config::MOLLIE_CARRIER_URL_SOURCE . $carrier['id_carrier']); + $customUrl = Tools::getValue(Config::MOLLIE_CARRIER_CUSTOM_URL . $carrier['id_carrier']); + $this->carrierInformationService->saveMolCarrierInfo($carrier['id_carrier'], $urlSource, $customUrl); + } + + foreach (array_keys(Config::getStatuses()) as $name) { + $name = Tools::strtoupper($name); + $new = (int)Tools::getValue("MOLLIE_STATUS_{$name}"); + Configuration::updateValue("MOLLIE_STATUS_{$name}", $new); + Config::getStatuses()[Tools::strtolower($name)] = $new; + + if ($name != PaymentStatus::STATUS_OPEN) { + Configuration::updateValue( + "MOLLIE_MAIL_WHEN_{$name}", + Tools::getValue("MOLLIE_MAIL_WHEN_{$name}") ? true : false + ); + } + } + + if ($mollieApiKey) { + try { + $this->module->api->setApiKey($mollieApiKey); + } catch (Exception $e) { + $errors[] = $e->getMessage(); + Configuration::updateValue(Config::MOLLIE_API_KEY, null); + return $this->module->l('Wrong API Key!'); + } + } + + $resultMessage = $this->module->l('The configuration has been saved!'); + } else { + $resultMessage = []; + foreach ($errors as $error) { + $resultMessage[] = $error; + } + } + + return $resultMessage; + } + + /** + * Get all status values from the form. + * + * @param $key string The key that is used in the HelperForm + * + * @return array Array with statuses + * + * @throws PrestaShopDatabaseException + * @throws PrestaShopException + * + * @since 3.3.0 + */ + private function getStatusesValue($key) + { + $statesEnabled = []; + $context = Context::getContext(); + foreach (OrderState::getOrderStates($context->language->id) as $state) { + if (Tools::isSubmit($key . '_' . $state['id_order_state'])) { + $statesEnabled[] = $state['id_order_state']; + } + } + + return $statesEnabled; + } } \ No newline at end of file diff --git a/src/Service/ShipService.php b/src/Service/ShipService.php index 452a039b7..203621ef0 100644 --- a/src/Service/ShipService.php +++ b/src/Service/ShipService.php @@ -1,64 +1,97 @@ -module = $module; - } - - /** - * @param string $transactionId - * @param array $lines - * @param array|null $tracking - * - * @return array - * - * @since 3.3.0 - */ - public function doShipOrderLines($transactionId, $lines = [], $tracking = null) - { - try { - /** @var MollieOrderAlias $payment */ - $order = $this->module->api->orders->get($transactionId, ['embed' => 'payments']); - $shipment = [ - 'lines' => array_map(function ($line) { - return array_intersect_key( - (array)$line, - array_flip([ - 'id', - 'quantity', - ])); - }, $lines), - ]; - if ($tracking && !empty($tracking['carrier']) && !empty($tracking['code'])) { - $shipment['tracking'] = $tracking; - } - $order->createShipment($shipment); - } catch (ApiException $e) { - return [ - 'success' => false, - 'message' => $this->module->l('The product(s) could not be shipped!'), - 'detailed' => $e->getMessage(), - ]; - } - - return [ - 'success' => true, - 'message' => '', - 'detailed' => '', - ]; - } - + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Service; + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use Mollie; +use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Order as MollieOrderAlias; + +class ShipService +{ + /** + * @var Mollie + */ + private $module; + + public function __construct(Mollie $module) + { + $this->module = $module; + } + + /** + * @param string $transactionId + * @param array $lines + * @param array|null $tracking + * + * @return array + * + * @since 3.3.0 + */ + public function doShipOrderLines($transactionId, $lines = [], $tracking = null) + { + try { + /** @var MollieOrderAlias $payment */ + $order = $this->module->api->orders->get($transactionId, ['embed' => 'payments']); + $shipment = [ + 'lines' => array_map(function ($line) { + return array_intersect_key( + (array)$line, + array_flip([ + 'id', + 'quantity', + ])); + }, $lines), + ]; + if ($tracking && !empty($tracking['carrier']) && !empty($tracking['code'])) { + $shipment['tracking'] = $tracking; + } + $order->createShipment($shipment); + } catch (ApiException $e) { + return [ + 'success' => false, + 'message' => $this->module->l('The product(s) could not be shipped!'), + 'detailed' => $e->getMessage(), + ]; + } + + return [ + 'success' => true, + 'message' => '', + 'detailed' => '', + ]; + } + } \ No newline at end of file diff --git a/src/Service/ShipmentService.php b/src/Service/ShipmentService.php index 2c0f95d91..e6ecd543e 100644 --- a/src/Service/ShipmentService.php +++ b/src/Service/ShipmentService.php @@ -1,164 +1,199 @@ -orderShipmentRepository = $orderShipmentRepository; - $this->informationRepository = $informationRepository; - } - - /** - * Get shipment information - * - * @param int $idOrder - * - * @return array|null - * - * @throws PrestaShopDatabaseException - * @throws \PrestaShopException - * @since 3.3.0 - */ - public function getShipmentInformation($orderReference) - { - $order = Order::getByReference($orderReference)[0]; - if (!Validate::isLoadedObject($order)) { - return null; - } - $invoiceAddress = new Address($order->id_address_invoice); - $deliveryAddress = new Address($order->id_address_delivery); - $carrierInformationId = $this->informationRepository->getMollieCarrierInformationIdByCarrierId($order->id_carrier); - $carrierInformation = new \MolCarrierInformation($carrierInformationId); - if (!Validate::isLoadedObject($invoiceAddress) - || !Validate::isLoadedObject($deliveryAddress) - || !$carrierInformation - ) { - return []; - } - - if ($carrierInformation === Config::MOLLIE_CARRIER_NO_TRACKING_INFO) { - return []; - } - - $langId = Context::getContext()->language->id; - if ($carrierInformation->url_source === Config::MOLLIE_CARRIER_MODULE) { - $carrier = new Carrier($order->id_carrier); - if (in_array($carrier->external_module_name, ['postnl', 'myparcel'])) { - $table = $carrier->external_module_name === 'postnl' ? 'postnlmod_order' : 'myparcel_order'; - - try { - $info = $this->orderShipmentRepository->getShipmentInformation($table, $order->id); - if ($info['tracktrace'] && $info['postcode']) { - $postcode = Tools::strtoupper(str_replace(' ', '', $info['postcode'])); - $langIso = Tools::strtoupper(Language::getIsoById($langId)); - $countryIso = Tools::strtoupper(Country::getIsoById($deliveryAddress->id_country)); - $tracktrace = $info['tracktrace']; - - return [ - 'tracking' => [ - 'carrier' => 'PostNL', - 'code' => $info['tracktrace'], - 'url' => "http://postnl.nl/tracktrace/?L={$langIso}&B={$tracktrace}&P={$postcode}&D={$countryIso}&T=C", - ], - ]; - } - } catch (PrestaShopDatabaseException $e) { - return []; - } - } - - return []; - } - - if ($carrierInformation->url_source === Config::MOLLIE_CARRIER_CARRIER) { - $carrier = new Carrier($order->id_carrier); - $shippingNumber = $order->shipping_number; - if (!$shippingNumber && method_exists($order, 'getIdOrderCarrier')) { - $orderCarrier = new OrderCarrier($order->getIdOrderCarrier()); - $shippingNumber = $orderCarrier->tracking_number; - } - - if (!$shippingNumber || !$carrier->name) { - return []; - } - - return [ - 'tracking' => [ - 'carrier' => $carrier->name, - 'code' => $shippingNumber, - 'url' => str_replace('@', $shippingNumber, $carrier->url), - ], - ]; - } - - if ($carrierInformation->url_source === Config::MOLLIE_CARRIER_CUSTOM) { - $carrier = new Carrier($order->id_carrier); - $shippingNumber = $order->shipping_number; - if (!$shippingNumber && method_exists($order, 'getIdOrderCarrier')) { - $orderCarrier = new OrderCarrier($order->getIdOrderCarrier()); - $shippingNumber = $orderCarrier->tracking_number; - } - - $invoicePostcode = Tools::strtoupper(str_replace(' ', '', $invoiceAddress->postcode)); - $invoiceCountryIso = Tools::strtoupper(Country::getIsoById($invoiceAddress->id_country)); - $deliveryPostcode = Tools::strtoupper(str_replace(' ', '', $deliveryAddress->postcode)); - $deliveryCountryIso = Tools::strtoupper(Country::getIsoById($deliveryAddress->id_country)); - - $langIso = Tools::strtoupper(Language::getIsoById($langId)); - - $info = [ - '@' => $shippingNumber, - '%%shipping_number%%' => $shippingNumber, - '%%invoice.country_iso%%' => $invoiceCountryIso, - '%%invoice.postcode%%' => $invoicePostcode, - '%%delivery.country_iso%%' => $deliveryCountryIso, - '%%delivery.postcode%%' => $deliveryPostcode, - '%%lang_iso%%' => $langIso, - ]; - - return [ - 'tracking' => [ - 'carrier' => $carrier->name, - 'code' => $shippingNumber, - 'url' => str_ireplace( - array_keys($info), - array_values($info), - $carrierInformation->url_source - ), - ], - ]; - } - - return []; - } - + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Service; + +use Address; +use Carrier; +use Context; +use Country; +use Language; +use MolCarrierInformation; +use Mollie\Config\Config; +use Mollie\Repository\MolCarrierInformationRepository; +use Mollie\Repository\OrderShipmentRepository; +use Order; +use OrderCarrier; +use PrestaShopDatabaseException; +use PrestaShopException; +use Tools; +use Validate; + +class ShipmentService +{ + + /** + * @var OrderShipmentRepository + */ + private $orderShipmentRepository; + + /** + * @var MolCarrierInformationRepository + */ + private $informationRepository; + + public function __construct( + OrderShipmentRepository $orderShipmentRepository, + MolCarrierInformationRepository $informationRepository + ) { + $this->orderShipmentRepository = $orderShipmentRepository; + $this->informationRepository = $informationRepository; + } + + /** + * Get shipment information + * + * @param int $idOrder + * + * @return array|null + * + * @throws PrestaShopDatabaseException + * @throws PrestaShopException + * @since 3.3.0 + */ + public function getShipmentInformation($orderReference) + { + $order = Order::getByReference($orderReference)[0]; + if (!Validate::isLoadedObject($order)) { + return null; + } + $invoiceAddress = new Address($order->id_address_invoice); + $deliveryAddress = new Address($order->id_address_delivery); + $carrierInformationId = $this->informationRepository->getMollieCarrierInformationIdByCarrierId($order->id_carrier); + $carrierInformation = new MolCarrierInformation($carrierInformationId); + if (!Validate::isLoadedObject($invoiceAddress) + || !Validate::isLoadedObject($deliveryAddress) + || !$carrierInformation + ) { + return []; + } + + if ($carrierInformation === Config::MOLLIE_CARRIER_NO_TRACKING_INFO) { + return []; + } + + $langId = Context::getContext()->language->id; + if ($carrierInformation->url_source === Config::MOLLIE_CARRIER_MODULE) { + $carrier = new Carrier($order->id_carrier); + if (in_array($carrier->external_module_name, ['postnl', 'myparcel'])) { + $table = $carrier->external_module_name === 'postnl' ? 'postnlmod_order' : 'myparcel_order'; + + try { + $info = $this->orderShipmentRepository->getShipmentInformation($table, $order->id); + if ($info['tracktrace'] && $info['postcode']) { + $postcode = Tools::strtoupper(str_replace(' ', '', $info['postcode'])); + $langIso = Tools::strtoupper(Language::getIsoById($langId)); + $countryIso = Tools::strtoupper(Country::getIsoById($deliveryAddress->id_country)); + $tracktrace = $info['tracktrace']; + + return [ + 'tracking' => [ + 'carrier' => 'PostNL', + 'code' => $info['tracktrace'], + 'url' => "http://postnl.nl/tracktrace/?L={$langIso}&B={$tracktrace}&P={$postcode}&D={$countryIso}&T=C", + ], + ]; + } + } catch (PrestaShopDatabaseException $e) { + return []; + } + } + + return []; + } + + if ($carrierInformation->url_source === Config::MOLLIE_CARRIER_CARRIER) { + $carrier = new Carrier($order->id_carrier); + $shippingNumber = $order->shipping_number; + if (!$shippingNumber && method_exists($order, 'getIdOrderCarrier')) { + $orderCarrier = new OrderCarrier($order->getIdOrderCarrier()); + $shippingNumber = $orderCarrier->tracking_number; + } + + if (!$shippingNumber || !$carrier->name) { + return []; + } + + return [ + 'tracking' => [ + 'carrier' => $carrier->name, + 'code' => $shippingNumber, + 'url' => str_replace('@', $shippingNumber, $carrier->url), + ], + ]; + } + + if ($carrierInformation->url_source === Config::MOLLIE_CARRIER_CUSTOM) { + $carrier = new Carrier($order->id_carrier); + $shippingNumber = $order->shipping_number; + if (!$shippingNumber && method_exists($order, 'getIdOrderCarrier')) { + $orderCarrier = new OrderCarrier($order->getIdOrderCarrier()); + $shippingNumber = $orderCarrier->tracking_number; + } + + $invoicePostcode = Tools::strtoupper(str_replace(' ', '', $invoiceAddress->postcode)); + $invoiceCountryIso = Tools::strtoupper(Country::getIsoById($invoiceAddress->id_country)); + $deliveryPostcode = Tools::strtoupper(str_replace(' ', '', $deliveryAddress->postcode)); + $deliveryCountryIso = Tools::strtoupper(Country::getIsoById($deliveryAddress->id_country)); + + $langIso = Tools::strtoupper(Language::getIsoById($langId)); + + $info = [ + '@' => $shippingNumber, + '%%shipping_number%%' => $shippingNumber, + '%%invoice.country_iso%%' => $invoiceCountryIso, + '%%invoice.postcode%%' => $invoicePostcode, + '%%delivery.country_iso%%' => $deliveryCountryIso, + '%%delivery.postcode%%' => $deliveryPostcode, + '%%lang_iso%%' => $langIso, + ]; + + return [ + 'tracking' => [ + 'carrier' => $carrier->name, + 'code' => $shippingNumber, + 'url' => str_ireplace( + array_keys($info), + array_values($info), + $carrierInformation->custom_url + ), + ], + ]; + } + + return []; + } + } \ No newline at end of file diff --git a/src/Service/UrlPathService.php b/src/Service/UrlPathService.php index 39cc7a32d..983fd5a1d 100644 --- a/src/Service/UrlPathService.php +++ b/src/Service/UrlPathService.php @@ -1,80 +1,113 @@ -module = $module; - } - - /** - * Retrieve recursively all classes in a directory and its subdirectories - * - * @param string $path Relative path from root to the directory - * - * @return array - * - * @since 3.3.0 - */ - public function getClassesFromDir($path) - { - $classes = []; - $rootDir = $this->normalizeDirectory(_PS_ROOT_DIR_); - - foreach (scandir($rootDir . $path) as $file) { - if ($file[0] != '.') { - if (is_dir($rootDir . $path . $file)) { - $classes = array_merge($classes, $this->getClassesFromDir($path . $file . '/')); - } elseif (Tools::substr($file, -4) == '.php') { - $content = Tools::file_get_contents($rootDir . $path . $file); - - $namespacePattern = '[\\a-z0-9_]*[\\]'; - $pattern = '#\W((abstract\s+)?class|interface)\s+(?P' . $this->module->display($this->module->getPathUri(), 'views/templates/front/classname.tpl') . basename($file, '.php') . '(?:Core)?)' . '(?:\s+extends\s+' . $namespacePattern . '[a-z][a-z0-9_]*)?(?:\s+implements\s+' . $namespacePattern . '[a-z][\\a-z0-9_]*(?:\s*,\s*' . $namespacePattern . '[a-z][\\a-z0-9_]*)*)?\s*\{#i'; - - if (preg_match($pattern, $content, $m)) { - $classes[$m['classname']] = [ - 'path' => $path . $file, - 'type' => trim($m[1]), - 'override' => true, - ]; - - if (Tools::substr($m['classname'], -4) == 'Core') { - $classes[Tools::substr($m['classname'], 0, -4)] = [ - 'path' => '', - 'type' => $classes[$m['classname']]['type'], - 'override' => true, - ]; - } - } - } - } - } - - return $classes; - } - - /** - * Normalize directory - * - * @param string $directory - * - * @return string - * - * @since 3.3.0 - */ - private function normalizeDirectory($directory) - { - return rtrim($directory, '/\\') . DIRECTORY_SEPARATOR; - } + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Service; + +use Mollie; +use Tools; + +class UrlPathService +{ + + /** + * @var Mollie + */ + private $module; + + public function __construct(Mollie $module) + { + $this->module = $module; + } + + /** + * Retrieve recursively all classes in a directory and its subdirectories + * + * @param string $path Relative path from root to the directory + * + * @return array + * + * @since 3.3.0 + */ + public function getClassesFromDir($path) + { + $classes = []; + $rootDir = $this->normalizeDirectory(_PS_ROOT_DIR_); + + foreach (scandir($rootDir . $path) as $file) { + if ($file[0] != '.') { + if (is_dir($rootDir . $path . $file)) { + $classes = array_merge($classes, $this->getClassesFromDir($path . $file . '/')); + } elseif (Tools::substr($file, -4) == '.php') { + $content = Tools::file_get_contents($rootDir . $path . $file); + + $namespacePattern = '[\\a-z0-9_]*[\\]'; + $pattern = '#\W((abstract\s+)?class|interface)\s+(?P' . $this->module->display($this->module->getPathUri(), 'views/templates/front/classname.tpl') . basename($file, '.php') . '(?:Core)?)' . '(?:\s+extends\s+' . $namespacePattern . '[a-z][a-z0-9_]*)?(?:\s+implements\s+' . $namespacePattern . '[a-z][\\a-z0-9_]*(?:\s*,\s*' . $namespacePattern . '[a-z][\\a-z0-9_]*)*)?\s*\{#i'; + + if (preg_match($pattern, $content, $m)) { + $classes[$m['classname']] = [ + 'path' => $path . $file, + 'type' => trim($m[1]), + 'override' => true, + ]; + + if (Tools::substr($m['classname'], -4) == 'Core') { + $classes[Tools::substr($m['classname'], 0, -4)] = [ + 'path' => '', + 'type' => $classes[$m['classname']]['type'], + 'override' => true, + ]; + } + } + } + } + } + + return $classes; + } + + /** + * Normalize directory + * + * @param string $directory + * + * @return string + * + * @since 3.3.0 + */ + private function normalizeDirectory($directory) + { + return rtrim($directory, '/\\') . DIRECTORY_SEPARATOR; + } } \ No newline at end of file diff --git a/src/Service/index.php b/src/Service/index.php new file mode 100644 index 000000000..9e462a606 --- /dev/null +++ b/src/Service/index.php @@ -0,0 +1,44 @@ + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/src/Utility/AssortUtility.php b/src/Utility/AssortUtility.php index 92afe7569..7d37d6bb1 100644 --- a/src/Utility/AssortUtility.php +++ b/src/Utility/AssortUtility.php @@ -1,29 +1,62 @@ - $va) { - $sorter[$ii] = $va[$key]; - } - asort($sorter); - foreach ($sorter as $ii => $va) { - $ret[$ii] = $array[$ii]; - } - $array = $ret; - } + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Utility; + +class AssortUtility +{ + /** + * 2D array sort by key + * + * @param mixed $array + * @param mixed $key + * + * @since 3.3.0 + */ + public static function aasort(&$array, $key) + { + $sorter = []; + $ret = []; + reset($array); + foreach ($array as $ii => $va) { + $sorter[$ii] = $va[$key]; + } + asort($sorter); + foreach ($sorter as $ii => $va) { + $ret[$ii] = $array[$ii]; + } + $array = $ret; + } } \ No newline at end of file diff --git a/src/Utility/CartPriceUtility.php b/src/Utility/CartPriceUtility.php index e5e6227ca..7165a2e35 100644 --- a/src/Utility/CartPriceUtility.php +++ b/src/Utility/CartPriceUtility.php @@ -1,63 +1,96 @@ -getPrecision() > 0) { - // Go for a new pass if there's still a difference after the current one - $index = $index > 0 ? $index : $qty; - $difference = $difference->minus($decreaseNumber); - // Apply the rounding difference at the current index - $spreadTotals[$index--] += $newTotal < $amount ? 0.01 : -0.01; - } - // At the end, compensate for floating point inaccuracy and apply to the last index (points at the lowest amount) - if (round(abs($amount - array_sum($spreadTotals)), Config::API_ROUNDING_PRECISION) >= 0.01) { - $spreadTotals[count($spreadTotals) - 1] += 0.01; - } - - // Group the amounts and return the unit prices at the indices, with the quantities as values - return array_count_values(array_map('strval', $spreadTotals)); - } - - /** - * Check if the rounding mode is supported by the Orders API - * - * @return bool - * - * @since 3.3.2 - */ - public static function checkRoundingMode() - { - return (int)Configuration::get('PS_PRICE_ROUND_MODE') !== 2; - } + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Utility; + +use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number; +use Configuration; +use Mollie\Config\Config; + +class CartPriceUtility +{ + /** + * Spread the amount evenly + * + * @param float $amount + * @param int $qty + * + * @return array Spread amounts + * + * @since 3.3.3 + */ + public static function spreadAmountEvenly($amount, $qty) + { + // Start with a freshly rounded amount + $amount = (float)round($amount, Config::API_ROUNDING_PRECISION); + // Estimate a target spread amount to begin with + $spreadTotals = array_fill(1, $qty, round($amount / $qty, Config::API_ROUNDING_PRECISION)); + $newTotal = $spreadTotals[1] * $qty; + // Calculate the difference between applying this amount only and the total amount given + $difference = abs(round($newTotal - $amount, Config::API_ROUNDING_PRECISION)); + // Start at the last index + $index = $qty; + // Keep going until there's no longer a difference + $difference = new Number((string) $difference); + $decreaseNumber = new Number('0.01'); + // Keep going until there's no longer a difference + while ($difference->getPrecision() > 0) { + // Go for a new pass if there's still a difference after the current one + $index = $index > 0 ? $index : $qty; + $difference = $difference->minus($decreaseNumber); + // Apply the rounding difference at the current index + $spreadTotals[$index--] += $newTotal < $amount ? 0.01 : -0.01; + } + // At the end, compensate for floating point inaccuracy and apply to the last index (points at the lowest amount) + if (round(abs($amount - array_sum($spreadTotals)), Config::API_ROUNDING_PRECISION) >= 0.01) { + $spreadTotals[count($spreadTotals) - 1] += 0.01; + } + + // Group the amounts and return the unit prices at the indices, with the quantities as values + return array_count_values(array_map('strval', $spreadTotals)); + } + + /** + * Check if the rounding mode is supported by the Orders API + * + * @return bool + * + * @since 3.3.2 + */ + public static function checkRoundingMode() + { + return (int)Configuration::get('PS_PRICE_ROUND_MODE') !== 2; + } } \ No newline at end of file diff --git a/src/Utility/EnvironmentUtility.php b/src/Utility/EnvironmentUtility.php index 0b859522d..f5beb5943 100644 --- a/src/Utility/EnvironmentUtility.php +++ b/src/Utility/EnvironmentUtility.php @@ -1,30 +1,63 @@ - + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Utility; + +use Tools; + +class EnvironmentUtility +{ + /** + * Check if local domain + * + * @param string|null $host + * + * @return bool + * + * @since 3.3.2 + */ + public static function isLocalEnvironment($host = null) + { + if (!$host) { + $host = Tools::getHttpHost(false, false, true); + } + $hostParts = explode('.', $host); + $tld = end($hostParts); + + return in_array($tld, ['localhost', 'test', 'dev', 'app', 'local', 'invalid', 'example']) + || (filter_var($host, FILTER_VALIDATE_IP) + && !filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)); + } } \ No newline at end of file diff --git a/src/Utility/ImageUtility.php b/src/Utility/ImageUtility.php index 39420afb5..ddc648659 100644 --- a/src/Utility/ImageUtility.php +++ b/src/Utility/ImageUtility.php @@ -1,17 +1,50 @@ - + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Utility; + +use Mollie\Config\Config; + +class ImageUtility +{ + public static function setOptionImage($image, $imageConfig) + { + if ($imageConfig === Config::LOGOS_NORMAL) { + return $image['svg']; + } elseif ($imageConfig === Config::LOGOS_BIG) { + return $image['size2x']; + } + } } \ No newline at end of file diff --git a/src/Utility/LocaleUtility.php b/src/Utility/LocaleUtility.php index 62eb0524e..9d0956d70 100644 --- a/src/Utility/LocaleUtility.php +++ b/src/Utility/LocaleUtility.php @@ -1,136 +1,169 @@ -language instanceof Language) { - $language = Context::getContext()->language->iso_code; - } else { - $language = 'en'; - } - $supportedLanguages = [ - 'de', - 'en', - 'es', - 'fr', - 'nl', - 'ca', - 'pt', - 'it', - 'no', - 'sv', - 'fi', - 'da', - 'is', - 'hu', - 'pl', - 'lv', - 'lt', - ]; - - $supportedLocales = [ - 'en_US', - 'de_AT', - 'de_CH', - 'de_DE', - 'es_ES', - 'fr_BE', - 'fr_FR', - 'nl_BE', - 'nl_NL', - 'ca_ES', - 'pt_PT', - 'it_IT', - 'nb_NO', - 'sv_SE', - 'fi_FI', - 'da_DK', - 'is_IS', - 'hu_HU', - 'pl_PL', - 'lv_LV', - 'lt_LT', - ]; - - $langIso = Tools::strtolower($language); - if (!in_array($langIso, $supportedLanguages)) { - $langIso = 'en'; - } - $countryIso = Tools::strtoupper(Configuration::get('PS_LOCALE_COUNTRY')); - if (!in_array("{$langIso}_{$countryIso}", $supportedLocales)) { - switch ($langIso) { - case 'de': - $countryIso = 'DE'; - break; - case 'ca': - case 'es': - $countryIso = 'ES'; - break; - case 'fr': - $countryIso = 'FR'; - break; - case 'nl': - $countryIso = 'NL'; - break; - case 'pt': - $countryIso = 'PT'; - break; - case 'it': - $countryIso = 'IT'; - break; - case 'no': - case 'nn': - $langIso = 'nb'; - $countryIso = 'NO'; - break; - case 'sv': - $countryIso = 'SE'; - break; - case 'fi': - $countryIso = 'FI'; - break; - case 'da': - $countryIso = 'DK'; - break; - case 'is': - $countryIso = 'IS'; - break; - case 'hu': - $countryIso = 'hu'; - break; - case 'pl': - $countryIso = 'PL'; - break; - case 'lv': - $countryIso = 'LV'; - break; - case 'lt': - $countryIso = 'LT'; - break; - default: - $countryIso = 'US'; - } - } - - return "{$langIso}_{$countryIso}"; - } - + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Utility; + +use Configuration; +use Context; +use Language; +use Tools; + +class LocaleUtility +{ + /** + * Get webshop locale + * + * @return string + * + * @throws PrestaShopException + * + * @since 3.0.0 + */ + public static function getWebshopLocale() + { + // Current language + if (Context::getContext()->language instanceof Language) { + $language = Context::getContext()->language->iso_code; + } else { + $language = 'en'; + } + $supportedLanguages = [ + 'de', + 'en', + 'es', + 'fr', + 'nl', + 'ca', + 'pt', + 'it', + 'no', + 'sv', + 'fi', + 'da', + 'is', + 'hu', + 'pl', + 'lv', + 'lt', + ]; + + $supportedLocales = [ + 'en_US', + 'de_AT', + 'de_CH', + 'de_DE', + 'es_ES', + 'fr_BE', + 'fr_FR', + 'nl_BE', + 'nl_NL', + 'ca_ES', + 'pt_PT', + 'it_IT', + 'nb_NO', + 'sv_SE', + 'fi_FI', + 'da_DK', + 'is_IS', + 'hu_HU', + 'pl_PL', + 'lv_LV', + 'lt_LT', + ]; + + $langIso = Tools::strtolower($language); + if (!in_array($langIso, $supportedLanguages)) { + $langIso = 'en'; + } + $countryIso = Tools::strtoupper(Configuration::get('PS_LOCALE_COUNTRY')); + if (!in_array("{$langIso}_{$countryIso}", $supportedLocales)) { + switch ($langIso) { + case 'de': + $countryIso = 'DE'; + break; + case 'ca': + case 'es': + $countryIso = 'ES'; + break; + case 'fr': + $countryIso = 'FR'; + break; + case 'nl': + $countryIso = 'NL'; + break; + case 'pt': + $countryIso = 'PT'; + break; + case 'it': + $countryIso = 'IT'; + break; + case 'no': + case 'nn': + $langIso = 'nb'; + $countryIso = 'NO'; + break; + case 'sv': + $countryIso = 'SE'; + break; + case 'fi': + $countryIso = 'FI'; + break; + case 'da': + $countryIso = 'DK'; + break; + case 'is': + $countryIso = 'IS'; + break; + case 'hu': + $countryIso = 'hu'; + break; + case 'pl': + $countryIso = 'PL'; + break; + case 'lv': + $countryIso = 'LV'; + break; + case 'lt': + $countryIso = 'LT'; + break; + default: + $countryIso = 'US'; + } + } + + return "{$langIso}_{$countryIso}"; + } + } \ No newline at end of file diff --git a/src/Utility/MenuLocationUtility.php b/src/Utility/MenuLocationUtility.php index 84dbc7a27..069ba8ac6 100644 --- a/src/Utility/MenuLocationUtility.php +++ b/src/Utility/MenuLocationUtility.php @@ -1,58 +1,93 @@ -language->id; - } - - return implode(' > ', array_reverse(array_unique(array_map(function ($tab) use ($idLang) { - return $tab->name[$idLang]; - }, static::getTabTreeByClass($class))))); - } - - /** - * Get the entire tab tree by tab class name - * - * @param string $class - * - * @return Tab[]|null - * - * @throws \PrestaShopDatabaseException - * @throws \PrestaShopException - * @since 3.3.2 - */ - public static function getTabTreeByClass($class) - { - $tabs = []; - $depth = 10; - $tab = Tab::getInstanceFromClassName($class); - while (Validate::isLoadedObject($tab) && $depth > 0) { - $depth--; - $tabs[] = $tab; - $tab = new Tab($tab->id_parent); - } - - return $tabs; - } + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Utility; + +use Context; +use PrestaShopDatabaseException; +use PrestaShopException; +use Tab; +use Validate; + +class MenuLocationUtility +{ + /** + * Get page location + * + * @param string $class + * @param int|null $idLang + * + * @return string + * + * @throws PrestaShopDatabaseException + * @throws PrestaShopException + * @since 3.3.2 + */ + public static function getMenuLocation($class, $idLang = null) + { + if (!$idLang) { + $idLang = Context::getContext()->language->id; + } + + return implode(' > ', array_reverse(array_unique(array_map(function ($tab) use ($idLang) { + return $tab->name[$idLang]; + }, static::getTabTreeByClass($class))))); + } + + /** + * Get the entire tab tree by tab class name + * + * @param string $class + * + * @return Tab[]|null + * + * @throws PrestaShopDatabaseException + * @throws PrestaShopException + * @since 3.3.2 + */ + public static function getTabTreeByClass($class) + { + $tabs = []; + $depth = 10; + $tab = Tab::getInstanceFromClassName($class); + while (Validate::isLoadedObject($tab) && $depth > 0) { + $depth--; + $tabs[] = $tab; + $tab = new Tab($tab->id_parent); + } + + return $tabs; + } } \ No newline at end of file diff --git a/src/Utility/PaymentFeeUtility.php b/src/Utility/PaymentFeeUtility.php index dc28c15bb..8922f5a9c 100644 --- a/src/Utility/PaymentFeeUtility.php +++ b/src/Utility/PaymentFeeUtility.php @@ -1,51 +1,84 @@ -surcharge) { - case Config::FEE_FIXED_FEE: - $totalFeePrice = new Number($paymentMethod->surcharge_fixed_amount); - break; - case Config::FEE_PERCENTAGE: - $totalCartPrice = new Number((string) $totalCartPrice); - $surchargePercentage = new Number($paymentMethod->surcharge_percentage); - $maxPercentage = new Number('100'); - $totalFeePrice = $totalCartPrice->times( - $surchargePercentage->dividedBy( - $maxPercentage - ) - ); - break; - case Config::FEE_FIXED_FEE_AND_PERCENTAGE: - $totalCartPrice = new Number((string) $totalCartPrice); - $surchargePercentage = new Number($paymentMethod->surcharge_percentage); - $maxPercentage = new Number('100'); - $surchargeFixedPrice = new Number($paymentMethod->surcharge_fixed_amount); - $totalFeePrice = $totalCartPrice->times( - $surchargePercentage->dividedBy( - $maxPercentage - ) - )->plus($surchargeFixedPrice); - break; - case Config::FEE_NO_FEE: - default: - return false; - } - - $surchargeMaxValue = new Number($paymentMethod->surcharge_limit); - $zero = new Number('0'); - if ($surchargeMaxValue->isGreaterThan($zero) && $totalFeePrice->isGreaterOrEqualThan($surchargeMaxValue)) { - $totalFeePrice = $surchargeMaxValue; - } - - return $totalFeePrice->toPrecision(2); - } + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Utility; + +use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number; +use Mollie\Config\Config; +use MolPaymentMethod; + +class PaymentFeeUtility +{ + public static function getPaymentFee(MolPaymentMethod $paymentMethod, $totalCartPrice) + { + switch ($paymentMethod->surcharge) { + case Config::FEE_FIXED_FEE: + $totalFeePrice = new Number($paymentMethod->surcharge_fixed_amount); + break; + case Config::FEE_PERCENTAGE: + $totalCartPrice = new Number((string) $totalCartPrice); + $surchargePercentage = new Number($paymentMethod->surcharge_percentage); + $maxPercentage = new Number('100'); + $totalFeePrice = $totalCartPrice->times( + $surchargePercentage->dividedBy( + $maxPercentage + ) + ); + break; + case Config::FEE_FIXED_FEE_AND_PERCENTAGE: + $totalCartPrice = new Number((string) $totalCartPrice); + $surchargePercentage = new Number($paymentMethod->surcharge_percentage); + $maxPercentage = new Number('100'); + $surchargeFixedPrice = new Number($paymentMethod->surcharge_fixed_amount); + $totalFeePrice = $totalCartPrice->times( + $surchargePercentage->dividedBy( + $maxPercentage + ) + )->plus($surchargeFixedPrice); + break; + case Config::FEE_NO_FEE: + default: + return false; + } + + $surchargeMaxValue = new Number($paymentMethod->surcharge_limit); + $zero = new Number('0'); + if ($surchargeMaxValue->isGreaterThan($zero) && $totalFeePrice->isGreaterOrEqualThan($surchargeMaxValue)) { + $totalFeePrice = $surchargeMaxValue; + } + + return $totalFeePrice->toPrecision(2); + } } \ No newline at end of file diff --git a/src/Utility/TagsUtility.php b/src/Utility/TagsUtility.php index 0314218a7..5f9d59646 100644 --- a/src/Utility/TagsUtility.php +++ b/src/Utility/TagsUtility.php @@ -1,39 +1,72 @@ - $tag) { - // Make positions start at 1 so that it behaves similar to the %1$d etc. sprintf positional params - $position = $index + 1; - // extract tag name - $match = []; - if (preg_match('/^\s*<\s*(\w+)/', $tag, $match)) { - $opener = $tag; - $closer = ''; - - $string = str_replace('[' . $position . ']', $opener, $string); - $string = str_replace('[/' . $position . ']', $closer, $string); - $string = str_replace('[' . $position . '/]', $opener . $closer, $string); - } - } - } - - return $string; - } + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Utility; + +class TagsUtility +{ + /** + * Post process tags in (translated) strings + * + * @param string $string + * @param array $tags + * + * @return string + * + * @since 3.2.0 + */ + public static function ppTags($string, $tags = []) + { + // If tags were explicitly provided, we want to use them *after* the translation string is escaped. + if (!empty($tags)) { + foreach ($tags as $index => $tag) { + // Make positions start at 1 so that it behaves similar to the %1$d etc. sprintf positional params + $position = $index + 1; + // extract tag name + $match = []; + if (preg_match('/^\s*<\s*(\w+)/', $tag, $match)) { + $opener = $tag; + $closer = ''; + + $string = str_replace('[' . $position . ']', $opener, $string); + $string = str_replace('[/' . $position . ']', $closer, $string); + $string = str_replace('[' . $position . '/]', $opener . $closer, $string); + } + } + } + + return $string; + } } \ No newline at end of file diff --git a/src/Utility/TextGeneratorUtility.php b/src/Utility/TextGeneratorUtility.php index b9199ffb3..20779fd7c 100644 --- a/src/Utility/TextGeneratorUtility.php +++ b/src/Utility/TextGeneratorUtility.php @@ -1,53 +1,86 @@ -id_customer) { - $buyer = new Customer($cart->id_customer); - } - - $filters = [ - '%' => $cartId, - '{cart.id}' => $cartId, - '{order.reference}' => $orderReference, - '{customer.firstname}' => $buyer == null ? '' : $buyer->firstname, - '{customer.lastname}' => $buyer == null ? '' : $buyer->lastname, - '{customer.company}' => $buyer == null ? '' : $buyer->company, - ]; - - $content = str_ireplace( - array_keys($filters), - array_values($filters), - $methodDescription - ); - - return $content; - } - + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Utility; + +use Cart; +use Customer; + +class TextGeneratorUtility +{ + /** + * Generate a description from the Cart + * + * @param Cart|int $cartId Cart or Cart ID + * @param string $orderReference Order reference + * + * @return string Description + * + * @throws PrestaShopException + * @throws CoreException + * @since 3.0.0 + */ + public static function generateDescriptionFromCart($methodDescription, $cartId, $orderReference = '') + { + if ($cartId instanceof Cart) { + $cart = $cartId; + } else { + $cart = new Cart($cartId); + } + + $buyer = null; + if ($cart->id_customer) { + $buyer = new Customer($cart->id_customer); + } + + $filters = [ + '%' => $cartId, + '{cart.id}' => $cartId, + '{order.reference}' => $orderReference, + '{customer.firstname}' => $buyer == null ? '' : $buyer->firstname, + '{customer.lastname}' => $buyer == null ? '' : $buyer->lastname, + '{customer.company}' => $buyer == null ? '' : $buyer->company, + ]; + + $content = str_ireplace( + array_keys($filters), + array_values($filters), + $methodDescription + ); + + return $content; + } + } \ No newline at end of file diff --git a/src/Utility/UrlPathUtility.php b/src/Utility/UrlPathUtility.php index 243bc44d6..390b06d45 100644 --- a/src/Utility/UrlPathUtility.php +++ b/src/Utility/UrlPathUtility.php @@ -1,129 +1,162 @@ - $cssMediaType]; - } - - return $mediaUri; - } - - /** - * Test if directory is writable - * - * @param string $dir Directory path, absolute or relative - * @param bool $recursive - * @param null $fullReport - * @param bool $absolute Is absolute path to directory - * - * @return bool - * - * @since 3.0.2 - */ - public static function testDir($dir, $recursive = false, &$fullReport = null, $absolute = false) - { - if ($absolute) { - $absoluteDir = $dir; - } else { - $absoluteDir = rtrim(_PS_ROOT_DIR_, '\\/') . DIRECTORY_SEPARATOR . trim($dir, '\\/'); - } - - if (!file_exists($absoluteDir)) { - $fullReport = sprintf('Directory %s does not exist.', $absoluteDir); - - return false; - } - - if (!is_writable($absoluteDir)) { - $fullReport = sprintf('Directory %s is not writable.', $absoluteDir); - - return false; - } - - if ($recursive) { - foreach (scandir($absoluteDir, SCANDIR_SORT_NONE) as $item) { - $path = $absoluteDir . DIRECTORY_SEPARATOR . $item; - - if (in_array($item, ['.', '..', '.git']) - || is_link($path)) { - continue; - } - - if (is_dir($path)) { - if (!static::testDir($path, $recursive, $fullReport, true)) { - return false; - } - } - - if (!is_writable($path)) { - $fullReport = sprintf('File %s is not writable.', $path); - - return false; - } - } - } - - return true; - } - - /** - * Get the webpack chunks for a given entry name - * - * @param string $entry Entry name - * - * @return array Array with chunk files, should be loaded in the given order - * - * @since 3.4.0 - */ - public static function getWebpackChunks($entry) - { - static $manifest = null; - if (!$manifest) { - $manifest = []; - foreach (include(_PS_MODULE_DIR_ . 'mollie/views/js/dist/manifest.php') as $chunk) { - $manifest[$chunk['name']] = array_map(function ($chunk) { - return \Mollie\Utility\UrlPathUtility::getMediaPath(_PS_MODULE_DIR_ . "mollie/views/js/dist/{$chunk}"); - }, $chunk['files']); - } - } - - return isset($manifest[$entry]) ? $manifest[$entry] : []; - } + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +namespace Mollie\Utility; + +use Tools; + +class UrlPathUtility +{ + /** + * @param string $mediaUri + * @param string|null $cssMediaType + * + * @return array|bool|mixed|string + * + * @since 1.0.0 + * @version 1.0.0 Initial version + */ + public static function getMediaPath($mediaUri, $cssMediaType = null) + { + if (is_array($mediaUri) || $mediaUri === null || empty($mediaUri)) { + return false; + } + + $urlData = parse_url($mediaUri); + if (!is_array($urlData)) { + return false; + } + + if (!array_key_exists('host', $urlData)) { + $mediaUri = '/' . ltrim(str_replace(str_replace(['/', '\\'], DIRECTORY_SEPARATOR, _PS_ROOT_DIR_), __PS_BASE_URI__, $mediaUri), '/\\'); + // remove PS_BASE_URI on _PS_ROOT_DIR_ for the following + $fileUri = _PS_ROOT_DIR_ . Tools::str_replace_once(__PS_BASE_URI__, DIRECTORY_SEPARATOR, $mediaUri); + + if (!@filemtime($fileUri) || @filesize($fileUri) === 0) { + return false; + } + + $mediaUri = str_replace('//', '/', $mediaUri); + } + + if ($cssMediaType) { + return [$mediaUri => $cssMediaType]; + } + + return $mediaUri; + } + + /** + * Test if directory is writable + * + * @param string $dir Directory path, absolute or relative + * @param bool $recursive + * @param null $fullReport + * @param bool $absolute Is absolute path to directory + * + * @return bool + * + * @since 3.0.2 + */ + public static function testDir($dir, $recursive = false, &$fullReport = null, $absolute = false) + { + if ($absolute) { + $absoluteDir = $dir; + } else { + $absoluteDir = rtrim(_PS_ROOT_DIR_, '\\/') . DIRECTORY_SEPARATOR . trim($dir, '\\/'); + } + + if (!file_exists($absoluteDir)) { + $fullReport = sprintf('Directory %s does not exist.', $absoluteDir); + + return false; + } + + if (!is_writable($absoluteDir)) { + $fullReport = sprintf('Directory %s is not writable.', $absoluteDir); + + return false; + } + + if ($recursive) { + foreach (scandir($absoluteDir, SCANDIR_SORT_NONE) as $item) { + $path = $absoluteDir . DIRECTORY_SEPARATOR . $item; + + if (in_array($item, ['.', '..', '.git']) + || is_link($path)) { + continue; + } + + if (is_dir($path)) { + if (!static::testDir($path, $recursive, $fullReport, true)) { + return false; + } + } + + if (!is_writable($path)) { + $fullReport = sprintf('File %s is not writable.', $path); + + return false; + } + } + } + + return true; + } + + /** + * Get the webpack chunks for a given entry name + * + * @param string $entry Entry name + * + * @return array Array with chunk files, should be loaded in the given order + * + * @since 3.4.0 + */ + public static function getWebpackChunks($entry) + { + static $manifest = null; + if (!$manifest) { + $manifest = []; + foreach (include(_PS_MODULE_DIR_ . 'mollie/views/js/dist/manifest.php') as $chunk) { + $manifest[$chunk['name']] = array_map(function ($chunk) { + return UrlPathUtility::getMediaPath(_PS_MODULE_DIR_ . "mollie/views/js/dist/{$chunk}"); + }, $chunk['files']); + } + } + + return isset($manifest[$entry]) ? $manifest[$entry] : []; + } } \ No newline at end of file diff --git a/src/Utility/index.php b/src/Utility/index.php new file mode 100644 index 000000000..9e462a606 --- /dev/null +++ b/src/Utility/index.php @@ -0,0 +1,44 @@ + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/src/index.php b/src/index.php new file mode 100644 index 000000000..9e462a606 --- /dev/null +++ b/src/index.php @@ -0,0 +1,44 @@ + + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/upgrade/Upgrade-4.0.0.php b/upgrade/Upgrade-4.0.0.php index f609e9780..25eb9c398 100644 --- a/upgrade/Upgrade-4.0.0.php +++ b/upgrade/Upgrade-4.0.0.php @@ -42,6 +42,7 @@ */ function upgrade_module_4_0_0() { + $sql = []; $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'mol_payment_method` ( `id_payment_method` INT(64) NOT NULL PRIMARY KEY AUTO_INCREMENT, `id_method` VARCHAR(64) NOT NULL, diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index dc02dfb11..261261b99 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -12,6 +12,8 @@ namespace Composer\Autoload; +use InvalidArgumentException; + /** * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. * @@ -151,7 +153,7 @@ public function add($prefix, $paths, $prepend = false) * @param array|string $paths The PSR-4 base directories * @param bool $prepend Whether to prepend the directories * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException */ public function addPsr4($prefix, $paths, $prepend = false) { @@ -172,7 +174,7 @@ public function addPsr4($prefix, $paths, $prepend = false) // Register directories for a new namespace. $length = strlen($prefix); if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + throw new InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); } $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; $this->prefixDirsPsr4[$prefix] = (array) $paths; @@ -214,7 +216,7 @@ public function set($prefix, $paths) * @param string $prefix The prefix/namespace, with trailing '\\' * @param array|string $paths The PSR-4 base directories * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException */ public function setPsr4($prefix, $paths) { @@ -223,7 +225,7 @@ public function setPsr4($prefix, $paths) } else { $length = strlen($prefix); if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + throw new InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); } $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; $this->prefixDirsPsr4[$prefix] = (array) $paths; diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index e5f91332c..df1cf9e6c 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,6 +2,9 @@ // autoload_real.php @generated by Composer +use Composer\Autoload\ClassLoader; +use Composer\Autoload\ComposerStaticInitc2b58ae5c6462b5d003510a1194fafcf; + class ComposerAutoloaderInitc2b58ae5c6462b5d003510a1194fafcf { private static $loader; @@ -20,14 +23,14 @@ public static function getLoader() } spl_autoload_register(array('ComposerAutoloaderInitc2b58ae5c6462b5d003510a1194fafcf', 'loadClassLoader'), true, true); - self::$loader = $loader = new \Composer\Autoload\ClassLoader(); + self::$loader = $loader = new ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInitc2b58ae5c6462b5d003510a1194fafcf', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInitc2b58ae5c6462b5d003510a1194fafcf::getInitializer($loader)); + call_user_func(ComposerStaticInitc2b58ae5c6462b5d003510a1194fafcf::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 39b76e9bf..b78a3f51f 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,6 +4,8 @@ namespace Composer\Autoload; +use Closure; + class ComposerStaticInitc2b58ae5c6462b5d003510a1194fafcf { public static $files = array ( @@ -716,7 +718,7 @@ class ComposerStaticInitc2b58ae5c6462b5d003510a1194fafcf public static function getInitializer(ClassLoader $loader) { - return \Closure::bind(function () use ($loader) { + return Closure::bind(function () use ($loader) { $loader->prefixLengthsPsr4 = ComposerStaticInitc2b58ae5c6462b5d003510a1194fafcf::$prefixLengthsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInitc2b58ae5c6462b5d003510a1194fafcf::$prefixDirsPsr4; $loader->classMap = ComposerStaticInitc2b58ae5c6462b5d003510a1194fafcf::$classMap; diff --git a/vendor/composer/ca-bundle/README.md b/vendor/composer/ca-bundle/README.md index d8205ec53..16d615d18 100644 --- a/vendor/composer/ca-bundle/README.md +++ b/vendor/composer/ca-bundle/README.md @@ -39,9 +39,9 @@ Basic usage #### To use with curl ```php -$curl = curl_init("https://example.org/"); +use Composer\CaBundle\CaBundle;$curl = curl_init("https://example.org/"); -$caPathOrFile = \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath(); +$caPathOrFile = CaBundle::getSystemCaRootBundlePath(); if (is_dir($caPathOrFile)) { curl_setopt($curl, CURLOPT_CAPATH, $caPathOrFile); } else { @@ -60,7 +60,7 @@ $opts = array( ) ); -$caPathOrFile = \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath(); +$caPathOrFile = CaBundle::getSystemCaRootBundlePath(); if (is_dir($caPathOrFile)) { $opts['ssl']['capath'] = $caPathOrFile; } else { @@ -74,8 +74,8 @@ $result = file_get_contents('https://example.com', false, $context); #### To use with Guzzle ```php -$client = new \GuzzleHttp\Client([ - \GuzzleHttp\RequestOptions::VERIFY => \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath() +use Composer\CaBundle\CaBundle;use GuzzleHttp\Client;use GuzzleHttp\RequestOptions;$client = new Client([ + RequestOptions::VERIFY => CaBundle::getSystemCaRootBundlePath() ]); ``` diff --git a/vendor/composer/ca-bundle/index.php b/vendor/composer/ca-bundle/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/composer/ca-bundle/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/composer/ca-bundle/res/index.php b/vendor/composer/ca-bundle/res/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/composer/ca-bundle/res/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/composer/ca-bundle/src/CaBundle.php b/vendor/composer/ca-bundle/src/CaBundle.php index f86c6ea3f..d18e0ecbe 100644 --- a/vendor/composer/ca-bundle/src/CaBundle.php +++ b/vendor/composer/ca-bundle/src/CaBundle.php @@ -12,6 +12,38 @@ use _PhpScoper5ea00cc67502b\Psr\Log\LoggerInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Process\PhpProcess; +use Exception; +use function array_merge; +use function class_exists; +use function count; +use function defined; +use function dirname; +use function file_get_contents; +use function file_put_contents; +use function getenv; +use function glob; +use function ini_get; +use function is_dir; +use function is_file; +use function is_readable; +use function openssl_x509_parse; +use function preg_match; +use function preg_quote; +use function preg_replace; +use function preg_split; +use function realpath; +use function register_shutdown_function; +use function sprintf; +use function strlen; +use function strpos; +use function sys_get_temp_dir; +use function tempnam; +use function trim; +use function unlink; +use const PHP_SAPI; +use const PHP_VERSION; +use const PHP_VERSION_ID; + /** * @author Chris Smith * @author Jordi Boggiano @@ -58,7 +90,7 @@ class CaBundle * @param LoggerInterface $logger optional logger for information about which CA files were loaded * @return string path to a CA bundle file or directory */ - public static function getSystemCaRootBundlePath(\_PhpScoper5ea00cc67502b\Psr\Log\LoggerInterface $logger = null) + public static function getSystemCaRootBundlePath(LoggerInterface $logger = null) { if (self::$caPath !== null) { return self::$caPath; @@ -70,8 +102,8 @@ public static function getSystemCaRootBundlePath(\_PhpScoper5ea00cc67502b\Psr\Lo // If SSL_CERT_DIR env variable points to a valid certificate/bundle, use that. // This mimics how OpenSSL uses the SSL_CERT_FILE env variable. $caBundlePaths[] = self::getEnvVariable('SSL_CERT_DIR'); - $caBundlePaths[] = \ini_get('openssl.cafile'); - $caBundlePaths[] = \ini_get('openssl.capath'); + $caBundlePaths[] = ini_get('openssl.cafile'); + $caBundlePaths[] = ini_get('openssl.capath'); $otherLocations = array( '/etc/pki/tls/certs/ca-bundle.crt', // Fedora, RHEL, CentOS (ca-certificates package) @@ -98,9 +130,9 @@ public static function getSystemCaRootBundlePath(\_PhpScoper5ea00cc67502b\Psr\Lo '/usr/local/etc/openssl@1.1/cert.pem', ); foreach ($otherLocations as $location) { - $otherLocations[] = \dirname($location); + $otherLocations[] = dirname($location); } - $caBundlePaths = \array_merge($caBundlePaths, $otherLocations); + $caBundlePaths = array_merge($caBundlePaths, $otherLocations); foreach ($caBundlePaths as $caBundle) { if (self::caFileUsable($caBundle, $logger)) { return self::$caPath = $caBundle; @@ -124,10 +156,10 @@ public static function getBundledCaBundlePath() $caBundleFile = __DIR__ . '/../res/cacert.pem'; // cURL does not understand 'phar://' paths // see https://github.com/composer/ca-bundle/issues/10 - if (0 === \strpos($caBundleFile, 'phar://')) { - \file_put_contents($tempCaBundleFile = \tempnam(\sys_get_temp_dir(), 'openssl-ca-bundle-'), \file_get_contents($caBundleFile)); - \register_shutdown_function(function () use($tempCaBundleFile) { - @\unlink($tempCaBundleFile); + if (0 === strpos($caBundleFile, 'phar://')) { + file_put_contents($tempCaBundleFile = tempnam(sys_get_temp_dir(), 'openssl-ca-bundle-'), file_get_contents($caBundleFile)); + register_shutdown_function(function () use($tempCaBundleFile) { + @unlink($tempCaBundleFile); }); $caBundleFile = $tempCaBundleFile; } @@ -141,27 +173,27 @@ public static function getBundledCaBundlePath() * * @return bool */ - public static function validateCaFile($filename, \_PhpScoper5ea00cc67502b\Psr\Log\LoggerInterface $logger = null) + public static function validateCaFile($filename, LoggerInterface $logger = null) { - static $warned = \false; + static $warned = false; if (isset(self::$caFileValidity[$filename])) { return self::$caFileValidity[$filename]; } - $contents = \file_get_contents($filename); + $contents = file_get_contents($filename); // assume the CA is valid if php is vulnerable to // https://www.sektioneins.de/advisories/advisory-012013-php-openssl_x509_parse-memory-corruption-vulnerability.html if (!static::isOpensslParseSafe()) { if (!$warned && $logger) { - $logger->warning(\sprintf('Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.', \PHP_VERSION)); - $warned = \true; + $logger->warning(sprintf('Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.', PHP_VERSION)); + $warned = true; } $isValid = !empty($contents); } else { - $contents = \preg_replace("/^(\\-+(?:BEGIN|END))\\s+TRUSTED\\s+(CERTIFICATE\\-+)\$/m", '$1 $2', $contents); - $isValid = (bool) \openssl_x509_parse($contents); + $contents = preg_replace("/^(\\-+(?:BEGIN|END))\\s+TRUSTED\\s+(CERTIFICATE\\-+)\$/m", '$1 $2', $contents); + $isValid = (bool) openssl_x509_parse($contents); } if ($logger) { - $logger->debug('Checked CA file ' . \realpath($filename) . ': ' . ($isValid ? 'valid' : 'invalid')); + $logger->debug('Checked CA file ' . realpath($filename) . ': ' . ($isValid ? 'valid' : 'invalid')); } return self::$caFileValidity[$filename] = $isValid; } @@ -178,35 +210,35 @@ public static function isOpensslParseSafe() if (null !== self::$useOpensslParse) { return self::$useOpensslParse; } - if (\PHP_VERSION_ID >= 50600) { - return self::$useOpensslParse = \true; + if (PHP_VERSION_ID >= 50600) { + return self::$useOpensslParse = true; } // Vulnerable: // PHP 5.3.0 - PHP 5.3.27 // PHP 5.4.0 - PHP 5.4.22 // PHP 5.5.0 - PHP 5.5.6 - if (\PHP_VERSION_ID < 50400 && \PHP_VERSION_ID >= 50328 || \PHP_VERSION_ID < 50500 && \PHP_VERSION_ID >= 50423 || \PHP_VERSION_ID < 50600 && \PHP_VERSION_ID >= 50507) { + if (PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50328 || PHP_VERSION_ID < 50500 && PHP_VERSION_ID >= 50423 || PHP_VERSION_ID < 50600 && PHP_VERSION_ID >= 50507) { // This version of PHP has the fix for CVE-2013-6420 applied. - return self::$useOpensslParse = \true; + return self::$useOpensslParse = true; } - if (\defined('PHP_WINDOWS_VERSION_BUILD')) { + if (defined('PHP_WINDOWS_VERSION_BUILD')) { // Windows is probably insecure in this case. - return self::$useOpensslParse = \false; + return self::$useOpensslParse = false; } $compareDistroVersionPrefix = function ($prefix, $fixedVersion) { - $regex = '{^' . \preg_quote($prefix) . '([0-9]+)$}'; - if (\preg_match($regex, \PHP_VERSION, $m)) { + $regex = '{^' . preg_quote($prefix) . '([0-9]+)$}'; + if (preg_match($regex, PHP_VERSION, $m)) { return (int) $m[1] >= $fixedVersion; } - return \false; + return false; }; // Hard coded list of PHP distributions with the fix backported. if ($compareDistroVersionPrefix('5.3.3-7+squeeze', 18) || $compareDistroVersionPrefix('5.4.4-14+deb7u', 7) || $compareDistroVersionPrefix('5.3.10-1ubuntu3.', 9)) { - return self::$useOpensslParse = \true; + return self::$useOpensslParse = true; } // Symfony Process component is missing so we assume it is unsafe at this point - if (!\class_exists('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Process\\PhpProcess')) { - return self::$useOpensslParse = \false; + if (!class_exists('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Process\\PhpProcess')) { + return self::$useOpensslParse = false; } // This is where things get crazy, because distros backport security // fixes the chances are on NIX systems the fix has been applied but @@ -224,22 +256,22 @@ public static function isOpensslParseSafe() var_dump(PHP_VERSION, $info['issuer']['emailAddress'], $info['validFrom_time_t']); EOT; - $script = '<' . "?php\n" . \sprintf($script, $cert); + $script = '<' . "?php\n" . sprintf($script, $cert); try { - $process = new \_PhpScoper5ea00cc67502b\Symfony\Component\Process\PhpProcess($script); + $process = new PhpProcess($script); $process->mustRun(); - } catch (\Exception $e) { + } catch (Exception $e) { // In the case of any exceptions just accept it is not possible to // determine the safety of openssl_x509_parse and bail out. - return self::$useOpensslParse = \false; + return self::$useOpensslParse = false; } - $output = \preg_split('{\\r?\\n}', \trim($process->getOutput())); - $errorOutput = \trim($process->getErrorOutput()); - if (\count($output) === 3 && $output[0] === \sprintf('string(%d) "%s"', \strlen(\PHP_VERSION), \PHP_VERSION) && $output[1] === 'string(27) "stefan.esser@sektioneins.de"' && $output[2] === 'int(-1)' && \preg_match('{openssl_x509_parse\\(\\): illegal (?:ASN1 data type for|length in) timestamp in - on line \\d+}', $errorOutput)) { + $output = preg_split('{\\r?\\n}', trim($process->getOutput())); + $errorOutput = trim($process->getErrorOutput()); + if (count($output) === 3 && $output[0] === sprintf('string(%d) "%s"', strlen(PHP_VERSION), PHP_VERSION) && $output[1] === 'string(27) "stefan.esser@sektioneins.de"' && $output[2] === 'int(-1)' && preg_match('{openssl_x509_parse\\(\\): illegal (?:ASN1 data type for|length in) timestamp in - on line \\d+}', $errorOutput)) { // This PHP has the fix backported probably by a distro security team. - return self::$useOpensslParse = \true; + return self::$useOpensslParse = true; } - return self::$useOpensslParse = \false; + return self::$useOpensslParse = false; } /** * Resets the static caches @@ -255,17 +287,17 @@ private static function getEnvVariable($name) if (isset($_SERVER[$name])) { return (string) $_SERVER[$name]; } - if (\PHP_SAPI === 'cli' && ($value = \getenv($name)) !== \false && $value !== null) { + if (PHP_SAPI === 'cli' && ($value = getenv($name)) !== false && $value !== null) { return (string) $value; } - return \false; + return false; } - private static function caFileUsable($certFile, \_PhpScoper5ea00cc67502b\Psr\Log\LoggerInterface $logger = null) + private static function caFileUsable($certFile, LoggerInterface $logger = null) { - return $certFile && @\is_file($certFile) && @\is_readable($certFile) && static::validateCaFile($certFile, $logger); + return $certFile && @is_file($certFile) && @is_readable($certFile) && static::validateCaFile($certFile, $logger); } private static function caDirUsable($certDir) { - return $certDir && @\is_dir($certDir) && @\is_readable($certDir) && \glob($certDir . '/*'); + return $certDir && @is_dir($certDir) && @is_readable($certDir) && glob($certDir . '/*'); } } diff --git a/vendor/composer/ca-bundle/src/index.php b/vendor/composer/ca-bundle/src/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/composer/ca-bundle/src/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/composer/index.php b/vendor/composer/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/composer/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/guzzlehttp/guzzle/README.md b/vendor/guzzlehttp/guzzle/README.md index 5fdb6c5f4..6cd392fe6 100644 --- a/vendor/guzzlehttp/guzzle/README.md +++ b/vendor/guzzlehttp/guzzle/README.md @@ -20,7 +20,7 @@ trivial to integrate with web services. - Middleware system allows you to augment and compose client behavior. ```php -$client = new \GuzzleHttp\Client(); +use GuzzleHttp\Client;use GuzzleHttp\Psr7\Request;$client = new Client(); $response = $client->request('GET', 'https://api.github.com/repos/guzzle/guzzle'); echo $response->getStatusCode(); # 200 @@ -28,7 +28,7 @@ echo $response->getHeaderLine('content-type'); # 'application/json; charset=utf8 echo $response->getBody(); # '{"id": 1420053, "name": "guzzle", ...}' # Send an asynchronous request. -$request = new \GuzzleHttp\Psr7\Request('GET', 'http://httpbin.org'); +$request = new Request('GET', 'http://httpbin.org'); $promise = $client->sendAsync($request)->then(function ($response) { echo 'I completed! ' . $response->getBody(); }); diff --git a/vendor/guzzlehttp/guzzle/UPGRADING.md b/vendor/guzzlehttp/guzzle/UPGRADING.md index 91d1dcc99..eaff5d06a 100644 --- a/vendor/guzzlehttp/guzzle/UPGRADING.md +++ b/vendor/guzzlehttp/guzzle/UPGRADING.md @@ -675,7 +675,7 @@ PHP requests are now implemented through the `GuzzleHttp\Adapter\StreamAdapter`. - You can now enable E_USER_DEPRECATED warnings to see if you are using any deprecated methods.: ```php -\Guzzle\Common\Version::$emitWarnings = true; +use Guzzle\Common\Version;Version::$emitWarnings = true; ``` The following APIs and options have been marked as deprecated: @@ -860,7 +860,7 @@ $builder = Guzzle\Service\Builder\ServiceBuilder::factory('/path/to/config.json' $builder->addListener('service_builder.create_client', function ($event) use ($multi) { $event['client']->setCurlMulti($multi); } -}); +}) ``` ### No default path @@ -905,9 +905,9 @@ Change `\Guzzle\Service\Inspector::fromConfig` to `\Guzzle\Common\Collection::fr **Before** ```php -use Guzzle\Service\Inspector; +use Guzzle\Service\Client;use Guzzle\Service\Inspector; -class YourClient extends \Guzzle\Service\Client +class YourClient extends Client { public static function factory($config = array()) { @@ -931,9 +931,9 @@ class YourClient extends \Guzzle\Service\Client **After** ```php -use Guzzle\Common\Collection; +use Guzzle\Common\Collection;use Guzzle\Service\Client; -class YourClient extends \Guzzle\Service\Client +class YourClient extends Client { public static function factory($config = array()) { @@ -1135,9 +1135,9 @@ Now `Guzzle\Plugin\Log\LogPlugin` and `Guzzle\Log` respectively. ```php use Guzzle\Common\Log\ClosureLogAdapter; -use Guzzle\Http\Plugin\LogPlugin; +use Guzzle\Http\Client;use Guzzle\Http\Plugin\LogPlugin; -/** @var \Guzzle\Http\Client */ +/** @var Client */ $client; // $verbosity is an integer indicating desired message verbosity level @@ -1147,11 +1147,11 @@ $client->addSubscriber(new LogPlugin(new ClosureLogAdapter(function($m) { echo $ **After** ```php -use Guzzle\Log\ClosureLogAdapter; +use Guzzle\Http\Client;use Guzzle\Log\ClosureLogAdapter; use Guzzle\Log\MessageFormatter; use Guzzle\Plugin\Log\LogPlugin; -/** @var \Guzzle\Http\Client */ +/** @var Client */ $client; // $format is a string indicating desired message format -- @see MessageFormatter diff --git a/vendor/guzzlehttp/guzzle/index.php b/vendor/guzzlehttp/guzzle/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/guzzlehttp/guzzle/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/guzzlehttp/guzzle/src/Client.php b/vendor/guzzlehttp/guzzle/src/Client.php index 615b52fb8..53301da7c 100644 --- a/vendor/guzzlehttp/guzzle/src/Client.php +++ b/vendor/guzzlehttp/guzzle/src/Client.php @@ -6,9 +6,41 @@ use _PhpScoper5ea00cc67502b\GuzzleHttp\Exception\InvalidArgumentException; use _PhpScoper5ea00cc67502b\GuzzleHttp\Promise; use _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7; +use _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\MultipartStream; +use _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Request; +use _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\UriResolver; use _PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface; +use Exception; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\Promise\promise_for; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\Promise\rejection_for; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\_caseless_remove; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\modify_request; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\stream_for; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\uri_for; +use function array_key_exists; +use function array_keys; +use function base64_encode; +use function count; +use function explode; +use function getenv; +use function http_build_query; +use function is_array; +use function is_bool; +use function is_callable; +use function is_string; +use function php_sapi_name; +use function str_replace; +use function strtolower; +use function substr; +use const CURLAUTH_DIGEST; +use const CURLAUTH_NTLM; +use const CURLOPT_HTTPAUTH; +use const CURLOPT_USERPWD; +use const IDNA_DEFAULT; +use const PHP_QUERY_RFC3986; + /** * @method ResponseInterface get(string|UriInterface $uri, array $options = []) * @method ResponseInterface head(string|UriInterface $uri, array $options = []) @@ -23,7 +55,7 @@ * @method Promise\PromiseInterface patchAsync(string|UriInterface $uri, array $options = []) * @method Promise\PromiseInterface deleteAsync(string|UriInterface $uri, array $options = []) */ -class Client implements \_PhpScoper5ea00cc67502b\GuzzleHttp\ClientInterface +class Client implements ClientInterface { /** @var array Default request options */ private $config; @@ -62,13 +94,13 @@ class Client implements \_PhpScoper5ea00cc67502b\GuzzleHttp\ClientInterface public function __construct(array $config = []) { if (!isset($config['handler'])) { - $config['handler'] = \_PhpScoper5ea00cc67502b\GuzzleHttp\HandlerStack::create(); - } elseif (!\is_callable($config['handler'])) { + $config['handler'] = HandlerStack::create(); + } elseif (!is_callable($config['handler'])) { throw new \InvalidArgumentException('handler must be a callable'); } // Convert the base_uri to a UriInterface if (isset($config['base_uri'])) { - $config['base_uri'] = \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\uri_for($config['base_uri']); + $config['base_uri'] = uri_for($config['base_uri']); } $this->configureDefaults($config); } @@ -80,12 +112,12 @@ public function __construct(array $config = []) */ public function __call($method, $args) { - if (\count($args) < 1) { + if (count($args) < 1) { throw new \InvalidArgumentException('Magic request methods require a URI and optional options array'); } $uri = $args[0]; $opts = isset($args[1]) ? $args[1] : []; - return \substr($method, -5) === 'Async' ? $this->requestAsync(\substr($method, 0, -5), $uri, $opts) : $this->request($method, $uri, $opts); + return substr($method, -5) === 'Async' ? $this->requestAsync(substr($method, 0, -5), $uri, $opts) : $this->request($method, $uri, $opts); } /** * Asynchronously send an HTTP request. @@ -95,7 +127,7 @@ public function __call($method, $args) * * @return Promise\PromiseInterface */ - public function sendAsync(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options = []) + public function sendAsync(RequestInterface $request, array $options = []) { // Merge the base URI into the request URI if needed. $options = $this->prepareDefaults($options); @@ -110,9 +142,9 @@ public function sendAsync(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInter * @return ResponseInterface * @throws GuzzleException */ - public function send(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options = []) + public function send(RequestInterface $request, array $options = []) { - $options[\_PhpScoper5ea00cc67502b\GuzzleHttp\RequestOptions::SYNCHRONOUS] = \true; + $options[RequestOptions::SYNCHRONOUS] = true; return $this->sendAsync($request, $options)->wait(); } /** @@ -138,10 +170,10 @@ public function requestAsync($method, $uri = '', array $options = []) $version = isset($options['version']) ? $options['version'] : '1.1'; // Merge the URI into the base URI. $uri = $this->buildUri($uri, $options); - if (\is_array($body)) { + if (is_array($body)) { $this->invalidBody(); } - $request = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Request($method, $uri, $headers, $body, $version); + $request = new Request($method, $uri, $headers, $body, $version); // Remove the option so that they are not doubly-applied. unset($options['headers'], $options['body'], $options['version']); return $this->transfer($request, $options); @@ -162,7 +194,7 @@ public function requestAsync($method, $uri = '', array $options = []) */ public function request($method, $uri = '', array $options = []) { - $options[\_PhpScoper5ea00cc67502b\GuzzleHttp\RequestOptions::SYNCHRONOUS] = \true; + $options[RequestOptions::SYNCHRONOUS] = true; return $this->requestAsync($method, $uri, $options)->wait(); } /** @@ -188,13 +220,13 @@ public function getConfig($option = null) private function buildUri($uri, array $config) { // for BC we accept null which would otherwise fail in uri_for - $uri = \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\uri_for($uri === null ? '' : $uri); + $uri = uri_for($uri === null ? '' : $uri); if (isset($config['base_uri'])) { - $uri = \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\UriResolver::resolve(\_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\uri_for($config['base_uri']), $uri); + $uri = UriResolver::resolve(uri_for($config['base_uri']), $uri); } - if (isset($config['idn_conversion']) && $config['idn_conversion'] !== \false) { - $idnOptions = $config['idn_conversion'] === \true ? \IDNA_DEFAULT : $config['idn_conversion']; - $uri = \_PhpScoper5ea00cc67502b\GuzzleHttp\Utils::idnUriConvert($uri, $idnOptions); + if (isset($config['idn_conversion']) && $config['idn_conversion'] !== false) { + $idnOptions = $config['idn_conversion'] === true ? IDNA_DEFAULT : $config['idn_conversion']; + $uri = Utils::idnUriConvert($uri, $idnOptions); } return $uri->getScheme() === '' && $uri->getHost() !== '' ? $uri->withScheme('http') : $uri; } @@ -206,32 +238,32 @@ private function buildUri($uri, array $config) */ private function configureDefaults(array $config) { - $defaults = ['allow_redirects' => \_PhpScoper5ea00cc67502b\GuzzleHttp\RedirectMiddleware::$defaultSettings, 'http_errors' => \true, 'decode_content' => \true, 'verify' => \true, 'cookies' => \false, 'idn_conversion' => \true]; + $defaults = ['allow_redirects' => RedirectMiddleware::$defaultSettings, 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false, 'idn_conversion' => true]; // Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set. // We can only trust the HTTP_PROXY environment variable in a CLI // process due to the fact that PHP has no reliable mechanism to // get environment variables that start with "HTTP_". - if (\php_sapi_name() === 'cli' && \getenv('HTTP_PROXY')) { - $defaults['proxy']['http'] = \getenv('HTTP_PROXY'); + if (php_sapi_name() === 'cli' && getenv('HTTP_PROXY')) { + $defaults['proxy']['http'] = getenv('HTTP_PROXY'); } - if ($proxy = \getenv('HTTPS_PROXY')) { + if ($proxy = getenv('HTTPS_PROXY')) { $defaults['proxy']['https'] = $proxy; } - if ($noProxy = \getenv('NO_PROXY')) { - $cleanedNoProxy = \str_replace(' ', '', $noProxy); - $defaults['proxy']['no'] = \explode(',', $cleanedNoProxy); + if ($noProxy = getenv('NO_PROXY')) { + $cleanedNoProxy = str_replace(' ', '', $noProxy); + $defaults['proxy']['no'] = explode(',', $cleanedNoProxy); } $this->config = $config + $defaults; - if (!empty($config['cookies']) && $config['cookies'] === \true) { - $this->config['cookies'] = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\CookieJar(); + if (!empty($config['cookies']) && $config['cookies'] === true) { + $this->config['cookies'] = new CookieJar(); } // Add the default user-agent header. if (!isset($this->config['headers'])) { $this->config['headers'] = ['User-Agent' => default_user_agent()]; } else { // Add the User-Agent header if one was not already set. - foreach (\array_keys($this->config['headers']) as $name) { - if (\strtolower($name) === 'user-agent') { + foreach (array_keys($this->config['headers']) as $name) { + if (strtolower($name) === 'user-agent') { return; } } @@ -255,12 +287,12 @@ private function prepareDefaults(array $options) } // Special handling for headers is required as they are added as // conditional headers and as headers passed to a request ctor. - if (\array_key_exists('headers', $options)) { + if (array_key_exists('headers', $options)) { // Allows default headers to be unset. if ($options['headers'] === null) { $defaults['_conditional'] = []; unset($options['headers']); - } elseif (!\is_array($options['headers'])) { + } elseif (!is_array($options['headers'])) { throw new \InvalidArgumentException('headers must be an array'); } } @@ -284,7 +316,7 @@ private function prepareDefaults(array $options) * * @return Promise\PromiseInterface */ - private function transfer(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options) + private function transfer(RequestInterface $request, array $options) { // save_to -> sink if (isset($options['save_to'])) { @@ -300,9 +332,9 @@ private function transfer(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInter /** @var HandlerStack $handler */ $handler = $options['handler']; try { - return \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\promise_for($handler($request, $options)); - } catch (\Exception $e) { - return \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\rejection_for($e); + return promise_for($handler($request, $options)); + } catch (Exception $e) { + return rejection_for($e); } } /** @@ -313,7 +345,7 @@ private function transfer(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInter * * @return RequestInterface */ - private function applyOptions(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array &$options) + private function applyOptions(RequestInterface $request, array &$options) { $modify = ['set_headers' => []]; if (isset($options['headers'])) { @@ -324,61 +356,61 @@ private function applyOptions(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestI if (isset($options['multipart'])) { throw new \InvalidArgumentException('You cannot use ' . 'form_params and multipart at the same time. Use the ' . 'form_params option if you want to send application/' . 'x-www-form-urlencoded requests, and the multipart ' . 'option to send multipart/form-data requests.'); } - $options['body'] = \http_build_query($options['form_params'], '', '&'); + $options['body'] = http_build_query($options['form_params'], '', '&'); unset($options['form_params']); // Ensure that we don't have the header in different case and set the new value. - $options['_conditional'] = \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\_caseless_remove(['Content-Type'], $options['_conditional']); + $options['_conditional'] = _caseless_remove(['Content-Type'], $options['_conditional']); $options['_conditional']['Content-Type'] = 'application/x-www-form-urlencoded'; } if (isset($options['multipart'])) { - $options['body'] = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\MultipartStream($options['multipart']); + $options['body'] = new MultipartStream($options['multipart']); unset($options['multipart']); } if (isset($options['json'])) { - $options['body'] = \_PhpScoper5ea00cc67502b\GuzzleHttp\json_encode($options['json']); + $options['body'] = json_encode($options['json']); unset($options['json']); // Ensure that we don't have the header in different case and set the new value. - $options['_conditional'] = \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\_caseless_remove(['Content-Type'], $options['_conditional']); + $options['_conditional'] = _caseless_remove(['Content-Type'], $options['_conditional']); $options['_conditional']['Content-Type'] = 'application/json'; } - if (!empty($options['decode_content']) && $options['decode_content'] !== \true) { + if (!empty($options['decode_content']) && $options['decode_content'] !== true) { // Ensure that we don't have the header in different case and set the new value. - $options['_conditional'] = \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\_caseless_remove(['Accept-Encoding'], $options['_conditional']); + $options['_conditional'] = _caseless_remove(['Accept-Encoding'], $options['_conditional']); $modify['set_headers']['Accept-Encoding'] = $options['decode_content']; } if (isset($options['body'])) { - if (\is_array($options['body'])) { + if (is_array($options['body'])) { $this->invalidBody(); } - $modify['body'] = \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\stream_for($options['body']); + $modify['body'] = stream_for($options['body']); unset($options['body']); } - if (!empty($options['auth']) && \is_array($options['auth'])) { + if (!empty($options['auth']) && is_array($options['auth'])) { $value = $options['auth']; - $type = isset($value[2]) ? \strtolower($value[2]) : 'basic'; + $type = isset($value[2]) ? strtolower($value[2]) : 'basic'; switch ($type) { case 'basic': // Ensure that we don't have the header in different case and set the new value. - $modify['set_headers'] = \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\_caseless_remove(['Authorization'], $modify['set_headers']); - $modify['set_headers']['Authorization'] = 'Basic ' . \base64_encode("{$value[0]}:{$value[1]}"); + $modify['set_headers'] = _caseless_remove(['Authorization'], $modify['set_headers']); + $modify['set_headers']['Authorization'] = 'Basic ' . base64_encode("{$value[0]}:{$value[1]}"); break; case 'digest': // @todo: Do not rely on curl - $options['curl'][\CURLOPT_HTTPAUTH] = \CURLAUTH_DIGEST; - $options['curl'][\CURLOPT_USERPWD] = "{$value[0]}:{$value[1]}"; + $options['curl'][CURLOPT_HTTPAUTH] = CURLAUTH_DIGEST; + $options['curl'][CURLOPT_USERPWD] = "{$value[0]}:{$value[1]}"; break; case 'ntlm': - $options['curl'][\CURLOPT_HTTPAUTH] = \CURLAUTH_NTLM; - $options['curl'][\CURLOPT_USERPWD] = "{$value[0]}:{$value[1]}"; + $options['curl'][CURLOPT_HTTPAUTH] = CURLAUTH_NTLM; + $options['curl'][CURLOPT_USERPWD] = "{$value[0]}:{$value[1]}"; break; } } if (isset($options['query'])) { $value = $options['query']; - if (\is_array($value)) { - $value = \http_build_query($value, null, '&', \PHP_QUERY_RFC3986); + if (is_array($value)) { + $value = http_build_query($value, null, '&', PHP_QUERY_RFC3986); } - if (!\is_string($value)) { + if (!is_string($value)) { throw new \InvalidArgumentException('query must be a string or array'); } $modify['query'] = $value; @@ -387,15 +419,15 @@ private function applyOptions(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestI // Ensure that sink is not an invalid value. if (isset($options['sink'])) { // TODO: Add more sink validation? - if (\is_bool($options['sink'])) { + if (is_bool($options['sink'])) { throw new \InvalidArgumentException('sink must not be a boolean'); } } - $request = \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\modify_request($request, $modify); - if ($request->getBody() instanceof \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\MultipartStream) { + $request = modify_request($request, $modify); + if ($request->getBody() instanceof MultipartStream) { // Use a multipart/form-data POST if a Content-Type is not set. // Ensure that we don't have the header in different case and set the new value. - $options['_conditional'] = \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\_caseless_remove(['Content-Type'], $options['_conditional']); + $options['_conditional'] = _caseless_remove(['Content-Type'], $options['_conditional']); $options['_conditional']['Content-Type'] = 'multipart/form-data; boundary=' . $request->getBody()->getBoundary(); } // Merge in conditional headers if they are not present. @@ -407,7 +439,7 @@ private function applyOptions(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestI $modify['set_headers'][$k] = $v; } } - $request = \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\modify_request($request, $modify); + $request = modify_request($request, $modify); // Don't pass this internal value along to middleware/handlers. unset($options['_conditional']); } diff --git a/vendor/guzzlehttp/guzzle/src/ClientInterface.php b/vendor/guzzlehttp/guzzle/src/ClientInterface.php index a92997ded..ce7223b1b 100644 --- a/vendor/guzzlehttp/guzzle/src/ClientInterface.php +++ b/vendor/guzzlehttp/guzzle/src/ClientInterface.php @@ -26,7 +26,7 @@ interface ClientInterface * @return ResponseInterface * @throws GuzzleException */ - public function send(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options = []); + public function send(RequestInterface $request, array $options = []); /** * Asynchronously send an HTTP request. * @@ -36,7 +36,7 @@ public function send(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface * * @return PromiseInterface */ - public function sendAsync(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options = []); + public function sendAsync(RequestInterface $request, array $options = []); /** * Create and send an HTTP request. * diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php index 5582cf04a..218007451 100644 --- a/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php +++ b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php @@ -4,10 +4,23 @@ use _PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface; +use ArrayIterator; +use RuntimeException; +use function array_filter; +use function array_map; +use function array_values; +use function count; +use function implode; +use function is_scalar; +use function strcasecmp; +use function strpos; +use function strrpos; +use function substr; + /** * Cookie jar that stores cookies as an array */ -class CookieJar implements \_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\CookieJarInterface +class CookieJar implements CookieJarInterface { /** @var SetCookie[] Loaded cookie data */ private $cookies = []; @@ -20,12 +33,12 @@ class CookieJar implements \_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\CookieJarI * arrays that can be used with the SetCookie * constructor */ - public function __construct($strictMode = \false, $cookieArray = []) + public function __construct($strictMode = false, $cookieArray = []) { $this->strictMode = $strictMode; foreach ($cookieArray as $cookie) { - if (!$cookie instanceof \_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\SetCookie) { - $cookie = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\SetCookie($cookie); + if (!$cookie instanceof SetCookie) { + $cookie = new SetCookie($cookie); } $this->setCookie($cookie); } @@ -42,7 +55,7 @@ public static function fromArray(array $cookies, $domain) { $cookieJar = new self(); foreach ($cookies as $name => $value) { - $cookieJar->setCookie(new \_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\SetCookie(['Domain' => $domain, 'Name' => $name, 'Value' => $value, 'Discard' => \true])); + $cookieJar->setCookie(new SetCookie(['Domain' => $domain, 'Name' => $name, 'Value' => $value, 'Discard' => true])); } return $cookieJar; } @@ -61,14 +74,14 @@ public static function getCookieValue($value) * @param bool $allowSessionCookies If we should persist session cookies * @return bool */ - public static function shouldPersist(\_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\SetCookie $cookie, $allowSessionCookies = \false) + public static function shouldPersist(SetCookie $cookie, $allowSessionCookies = false) { if ($cookie->getExpires() || $allowSessionCookies) { if (!$cookie->getDiscard()) { - return \true; + return true; } } - return \false; + return false; } /** * Finds and returns the cookie based on the name @@ -79,11 +92,11 @@ public static function shouldPersist(\_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\ public function getCookieByName($name) { // don't allow a non string name - if ($name === null || !\is_scalar($name)) { + if ($name === null || !is_scalar($name)) { return null; } foreach ($this->cookies as $cookie) { - if ($cookie->getName() !== null && \strcasecmp($cookie->getName(), $name) === 0) { + if ($cookie->getName() !== null && strcasecmp($cookie->getName(), $name) === 0) { return $cookie; } } @@ -91,7 +104,7 @@ public function getCookieByName($name) } public function toArray() { - return \array_map(function (\_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\SetCookie $cookie) { + return array_map(function (SetCookie $cookie) { return $cookie->toArray(); }, $this->getIterator()->getArrayCopy()); } @@ -101,41 +114,41 @@ public function clear($domain = null, $path = null, $name = null) $this->cookies = []; return; } elseif (!$path) { - $this->cookies = \array_filter($this->cookies, function (\_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\SetCookie $cookie) use($domain) { + $this->cookies = array_filter($this->cookies, function (SetCookie $cookie) use($domain) { return !$cookie->matchesDomain($domain); }); } elseif (!$name) { - $this->cookies = \array_filter($this->cookies, function (\_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\SetCookie $cookie) use($path, $domain) { + $this->cookies = array_filter($this->cookies, function (SetCookie $cookie) use($path, $domain) { return !($cookie->matchesPath($path) && $cookie->matchesDomain($domain)); }); } else { - $this->cookies = \array_filter($this->cookies, function (\_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\SetCookie $cookie) use($path, $domain, $name) { + $this->cookies = array_filter($this->cookies, function (SetCookie $cookie) use($path, $domain, $name) { return !($cookie->getName() == $name && $cookie->matchesPath($path) && $cookie->matchesDomain($domain)); }); } } public function clearSessionCookies() { - $this->cookies = \array_filter($this->cookies, function (\_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\SetCookie $cookie) { + $this->cookies = array_filter($this->cookies, function (SetCookie $cookie) { return !$cookie->getDiscard() && $cookie->getExpires(); }); } - public function setCookie(\_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\SetCookie $cookie) + public function setCookie(SetCookie $cookie) { // If the name string is empty (but not 0), ignore the set-cookie // string entirely. $name = $cookie->getName(); if (!$name && $name !== '0') { - return \false; + return false; } // Only allow cookies with set and valid domain, name, value $result = $cookie->validate(); - if ($result !== \true) { + if ($result !== true) { if ($this->strictMode) { - throw new \RuntimeException('Invalid cookie: ' . $result); + throw new RuntimeException('Invalid cookie: ' . $result); } else { $this->removeCookieIfEmpty($cookie); - return \false; + return false; } } // Resolve conflicts with previously set cookies @@ -163,28 +176,28 @@ public function setCookie(\_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\SetCookie $ continue; } // The cookie exists, so no need to continue - return \false; + return false; } $this->cookies[] = $cookie; - return \true; + return true; } public function count() { - return \count($this->cookies); + return count($this->cookies); } public function getIterator() { - return new \ArrayIterator(\array_values($this->cookies)); + return new ArrayIterator(array_values($this->cookies)); } - public function extractCookies(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, \_PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface $response) + public function extractCookies(RequestInterface $request, ResponseInterface $response) { if ($cookieHeader = $response->getHeader('Set-Cookie')) { foreach ($cookieHeader as $cookie) { - $sc = \_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\SetCookie::fromString($cookie); + $sc = SetCookie::fromString($cookie); if (!$sc->getDomain()) { $sc->setDomain($request->getUri()->getHost()); } - if (0 !== \strpos($sc->getPath(), '/')) { + if (0 !== strpos($sc->getPath(), '/')) { $sc->setPath($this->getCookiePathFromRequest($request)); } $this->setCookie($sc); @@ -199,24 +212,24 @@ public function extractCookies(\_PhpScoper5ea00cc67502b\Psr\Http\Message\Request * @param RequestInterface $request * @return string */ - private function getCookiePathFromRequest(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request) + private function getCookiePathFromRequest(RequestInterface $request) { $uriPath = $request->getUri()->getPath(); if ('' === $uriPath) { return '/'; } - if (0 !== \strpos($uriPath, '/')) { + if (0 !== strpos($uriPath, '/')) { return '/'; } if ('/' === $uriPath) { return '/'; } - if (0 === ($lastSlashPos = \strrpos($uriPath, '/'))) { + if (0 === ($lastSlashPos = strrpos($uriPath, '/'))) { return '/'; } - return \substr($uriPath, 0, $lastSlashPos); + return substr($uriPath, 0, $lastSlashPos); } - public function withCookieHeader(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request) + public function withCookieHeader(RequestInterface $request) { $values = []; $uri = $request->getUri(); @@ -228,7 +241,7 @@ public function withCookieHeader(\_PhpScoper5ea00cc67502b\Psr\Http\Message\Reque $values[] = $cookie->getName() . '=' . $cookie->getValue(); } } - return $values ? $request->withHeader('Cookie', \implode('; ', $values)) : $request; + return $values ? $request->withHeader('Cookie', implode('; ', $values)) : $request; } /** * If a cookie already exists and the server asks to set it again with a @@ -236,7 +249,7 @@ public function withCookieHeader(\_PhpScoper5ea00cc67502b\Psr\Http\Message\Reque * * @param SetCookie $cookie */ - private function removeCookieIfEmpty(\_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\SetCookie $cookie) + private function removeCookieIfEmpty(SetCookie $cookie) { $cookieValue = $cookie->getValue(); if ($cookieValue === null || $cookieValue === '') { diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php index 5070e6020..1a72e6202 100644 --- a/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php +++ b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php @@ -4,6 +4,9 @@ use _PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface; +use Countable; +use IteratorAggregate; + /** * Stores HTTP cookies. * @@ -14,7 +17,7 @@ * * @link http://docs.python.org/2/library/cookielib.html Inspiration */ -interface CookieJarInterface extends \Countable, \IteratorAggregate +interface CookieJarInterface extends Countable, IteratorAggregate { /** * Create a request with added cookie headers. @@ -26,14 +29,14 @@ interface CookieJarInterface extends \Countable, \IteratorAggregate * * @return RequestInterface returns the modified request. */ - public function withCookieHeader(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request); + public function withCookieHeader(RequestInterface $request); /** * Extract cookies from an HTTP response and store them in the CookieJar. * * @param RequestInterface $request Request that was sent * @param ResponseInterface $response Response that was received */ - public function extractCookies(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, \_PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface $response); + public function extractCookies(RequestInterface $request, ResponseInterface $response); /** * Sets a cookie in the cookie jar. * @@ -41,7 +44,7 @@ public function extractCookies(\_PhpScoper5ea00cc67502b\Psr\Http\Message\Request * * @return bool Returns true on success or false on failure */ - public function setCookie(\_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\SetCookie $cookie); + public function setCookie(SetCookie $cookie); /** * Remove cookies currently held in the cookie jar. * diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php b/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php index c651bf5d6..f362b6091 100644 --- a/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php +++ b/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php @@ -2,10 +2,19 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Cookie; +use RuntimeException; +use function file_exists; +use function file_get_contents; +use function file_put_contents; +use function is_array; +use function json_decode; +use function strlen; +use const LOCK_EX; + /** * Persists non-session cookies using a JSON formatted file */ -class FileCookieJar extends \_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\CookieJar +class FileCookieJar extends CookieJar { /** @var string filename */ private $filename; @@ -18,14 +27,14 @@ class FileCookieJar extends \_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\CookieJar * @param bool $storeSessionCookies Set to true to store session cookies * in the cookie jar. * - * @throws \RuntimeException if the file cannot be found or created + * @throws RuntimeException if the file cannot be found or created */ - public function __construct($cookieFile, $storeSessionCookies = \false) + public function __construct($cookieFile, $storeSessionCookies = false) { parent::__construct(); $this->filename = $cookieFile; $this->storeSessionCookies = $storeSessionCookies; - if (\file_exists($cookieFile)) { + if (file_exists($cookieFile)) { $this->load($cookieFile); } } @@ -40,20 +49,20 @@ public function __destruct() * Saves the cookies to a file. * * @param string $filename File to save - * @throws \RuntimeException if the file cannot be found or created + * @throws RuntimeException if the file cannot be found or created */ public function save($filename) { $json = []; foreach ($this as $cookie) { /** @var SetCookie $cookie */ - if (\_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) { + if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) { $json[] = $cookie->toArray(); } } $jsonStr = \_PhpScoper5ea00cc67502b\GuzzleHttp\json_encode($json); - if (\false === \file_put_contents($filename, $jsonStr, \LOCK_EX)) { - throw new \RuntimeException("Unable to save file {$filename}"); + if (false === file_put_contents($filename, $jsonStr, LOCK_EX)) { + throw new RuntimeException("Unable to save file {$filename}"); } } /** @@ -62,23 +71,23 @@ public function save($filename) * Old cookies are kept unless overwritten by newly loaded ones. * * @param string $filename Cookie file to load. - * @throws \RuntimeException if the file cannot be loaded. + * @throws RuntimeException if the file cannot be loaded. */ public function load($filename) { - $json = \file_get_contents($filename); - if (\false === $json) { - throw new \RuntimeException("Unable to load file {$filename}"); + $json = file_get_contents($filename); + if (false === $json) { + throw new RuntimeException("Unable to load file {$filename}"); } elseif ($json === '') { return; } - $data = \_PhpScoper5ea00cc67502b\GuzzleHttp\json_decode($json, \true); - if (\is_array($data)) { - foreach (\json_decode($json, \true) as $cookie) { - $this->setCookie(new \_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\SetCookie($cookie)); + $data = \_PhpScoper5ea00cc67502b\GuzzleHttp\json_decode($json, true); + if (is_array($data)) { + foreach (json_decode($json, true) as $cookie) { + $this->setCookie(new SetCookie($cookie)); } - } elseif (\strlen($data)) { - throw new \RuntimeException("Invalid cookie file: {$filename}"); + } elseif (strlen($data)) { + throw new RuntimeException("Invalid cookie file: {$filename}"); } } } diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php b/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php index f47ae310b..75c7d5a0c 100644 --- a/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php +++ b/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php @@ -2,10 +2,16 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Cookie; +use RuntimeException; +use function is_array; +use function json_decode; +use function json_encode; +use function strlen; + /** * Persists cookies in the client session */ -class SessionCookieJar extends \_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\CookieJar +class SessionCookieJar extends CookieJar { /** @var string session key */ private $sessionKey; @@ -19,7 +25,7 @@ class SessionCookieJar extends \_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\Cookie * @param bool $storeSessionCookies Set to true to store session cookies * in the cookie jar. */ - public function __construct($sessionKey, $storeSessionCookies = \false) + public function __construct($sessionKey, $storeSessionCookies = false) { parent::__construct(); $this->sessionKey = $sessionKey; @@ -41,11 +47,11 @@ public function save() $json = []; foreach ($this as $cookie) { /** @var SetCookie $cookie */ - if (\_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) { + if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) { $json[] = $cookie->toArray(); } } - $_SESSION[$this->sessionKey] = \json_encode($json); + $_SESSION[$this->sessionKey] = json_encode($json); } /** * Load the contents of the client session into the data array @@ -55,13 +61,13 @@ protected function load() if (!isset($_SESSION[$this->sessionKey])) { return; } - $data = \json_decode($_SESSION[$this->sessionKey], \true); - if (\is_array($data)) { + $data = json_decode($_SESSION[$this->sessionKey], true); + if (is_array($data)) { foreach ($data as $cookie) { - $this->setCookie(new \_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\SetCookie($cookie)); + $this->setCookie(new SetCookie($cookie)); } - } elseif (\strlen($data)) { - throw new \RuntimeException("Invalid cookie data"); + } elseif (strlen($data)) { + throw new RuntimeException("Invalid cookie data"); } } } diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php b/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php index 8f6ba8082..dd8d6febe 100644 --- a/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php +++ b/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php @@ -2,13 +2,34 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Cookie; +use function array_filter; +use function array_keys; +use function array_map; +use function array_replace; +use function explode; +use function filter_var; +use function gmdate; +use function is_numeric; +use function ltrim; +use function preg_match; +use function preg_quote; +use function rtrim; +use function strcasecmp; +use function strlen; +use function strpos; +use function strtotime; +use function substr; +use function time; +use function trim; +use const FILTER_VALIDATE_IP; + /** * Set-Cookie object */ class SetCookie { /** @var array */ - private static $defaults = ['Name' => null, 'Value' => null, 'Domain' => null, 'Path' => '/', 'Max-Age' => null, 'Expires' => null, 'Secure' => \false, 'Discard' => \false, 'HttpOnly' => \false]; + private static $defaults = ['Name' => null, 'Value' => null, 'Domain' => null, 'Path' => '/', 'Max-Age' => null, 'Expires' => null, 'Secure' => false, 'Discard' => false, 'HttpOnly' => false]; /** @var array Cookie data */ private $data; /** @@ -23,23 +44,23 @@ public static function fromString($cookie) // Create the default return array $data = self::$defaults; // Explode the cookie string using a series of semicolons - $pieces = \array_filter(\array_map('trim', \explode(';', $cookie))); + $pieces = array_filter(array_map('trim', explode(';', $cookie))); // The name of the cookie (first kvp) must exist and include an equal sign. - if (empty($pieces[0]) || !\strpos($pieces[0], '=')) { + if (empty($pieces[0]) || !strpos($pieces[0], '=')) { return new self($data); } // Add the cookie pieces into the parsed data array foreach ($pieces as $part) { - $cookieParts = \explode('=', $part, 2); - $key = \trim($cookieParts[0]); - $value = isset($cookieParts[1]) ? \trim($cookieParts[1], " \n\r\t\0\v") : \true; + $cookieParts = explode('=', $part, 2); + $key = trim($cookieParts[0]); + $value = isset($cookieParts[1]) ? trim($cookieParts[1], " \n\r\t\0\v") : true; // Only check for non-cookies when cookies have been found if (empty($data['Name'])) { $data['Name'] = $key; $data['Value'] = $value; } else { - foreach (\array_keys(self::$defaults) as $search) { - if (!\strcasecmp($search, $key)) { + foreach (array_keys(self::$defaults) as $search) { + if (!strcasecmp($search, $key)) { $data[$search] = $value; continue 2; } @@ -54,12 +75,12 @@ public static function fromString($cookie) */ public function __construct(array $data = []) { - $this->data = \array_replace(self::$defaults, $data); + $this->data = array_replace(self::$defaults, $data); // Extract the Expires value and turn it into a UNIX timestamp if needed if (!$this->getExpires() && $this->getMaxAge()) { // Calculate the Expires date - $this->setExpires(\time() + $this->getMaxAge()); - } elseif ($this->getExpires() && !\is_numeric($this->getExpires())) { + $this->setExpires(time() + $this->getMaxAge()); + } elseif ($this->getExpires() && !is_numeric($this->getExpires())) { $this->setExpires($this->getExpires()); } } @@ -67,15 +88,15 @@ public function __toString() { $str = $this->data['Name'] . '=' . $this->data['Value'] . '; '; foreach ($this->data as $k => $v) { - if ($k !== 'Name' && $k !== 'Value' && $v !== null && $v !== \false) { + if ($k !== 'Name' && $k !== 'Value' && $v !== null && $v !== false) { if ($k === 'Expires') { - $str .= 'Expires=' . \gmdate('_PhpScoper5ea00cc67502b\\D, d M Y H:i:s \\G\\M\\T', $v) . '; '; + $str .= 'Expires=' . gmdate('_PhpScoper5ea00cc67502b\\D, d M Y H:i:s \\G\\M\\T', $v) . '; '; } else { - $str .= ($v === \true ? $k : "{$k}={$v}") . '; '; + $str .= ($v === true ? $k : "{$k}={$v}") . '; '; } } } - return \rtrim($str, '; '); + return rtrim($str, '; '); } public function toArray() { @@ -187,7 +208,7 @@ public function getExpires() */ public function setExpires($timestamp) { - $this->data['Expires'] = \is_numeric($timestamp) ? (int) $timestamp : \strtotime($timestamp); + $this->data['Expires'] = is_numeric($timestamp) ? (int) $timestamp : strtotime($timestamp); } /** * Get whether or not this is a secure cookie @@ -265,18 +286,18 @@ public function matchesPath($requestPath) $cookiePath = $this->getPath(); // Match on exact matches or when path is the default empty "/" if ($cookiePath === '/' || $cookiePath == $requestPath) { - return \true; + return true; } // Ensure that the cookie-path is a prefix of the request path. - if (0 !== \strpos($requestPath, $cookiePath)) { - return \false; + if (0 !== strpos($requestPath, $cookiePath)) { + return false; } // Match if the last character of the cookie-path is "/" - if (\substr($cookiePath, -1, 1) === '/') { - return \true; + if (substr($cookiePath, -1, 1) === '/') { + return true; } // Match if the first character not included in cookie path is "/" - return \substr($requestPath, \strlen($cookiePath), 1) === '/'; + return substr($requestPath, strlen($cookiePath), 1) === '/'; } /** * Check if the cookie matches a domain value @@ -289,17 +310,17 @@ public function matchesDomain($domain) { // Remove the leading '.' as per spec in RFC 6265. // http://tools.ietf.org/html/rfc6265#section-5.2.3 - $cookieDomain = \ltrim($this->getDomain(), '.'); + $cookieDomain = ltrim($this->getDomain(), '.'); // Domain not set or exact match. - if (!$cookieDomain || !\strcasecmp($domain, $cookieDomain)) { - return \true; + if (!$cookieDomain || !strcasecmp($domain, $cookieDomain)) { + return true; } // Matching the subdomain according to RFC 6265. // http://tools.ietf.org/html/rfc6265#section-5.1.3 - if (\filter_var($domain, \FILTER_VALIDATE_IP)) { - return \false; + if (filter_var($domain, FILTER_VALIDATE_IP)) { + return false; } - return (bool) \preg_match('/\\.' . \preg_quote($cookieDomain, '/') . '$/', $domain); + return (bool) preg_match('/\\.' . preg_quote($cookieDomain, '/') . '$/', $domain); } /** * Check if the cookie is expired @@ -308,7 +329,7 @@ public function matchesDomain($domain) */ public function isExpired() { - return $this->getExpires() !== null && \time() > $this->getExpires(); + return $this->getExpires() !== null && time() > $this->getExpires(); } /** * Check if the cookie is valid according to RFC 6265 @@ -319,25 +340,25 @@ public function validate() { // Names must not be empty, but can be 0 $name = $this->getName(); - if (empty($name) && !\is_numeric($name)) { + if (empty($name) && !is_numeric($name)) { return 'The cookie name must not be empty'; } // Check if any of the invalid characters are present in the cookie name - if (\preg_match('/[\\x00-\\x20\\x22\\x28-\\x29\\x2c\\x2f\\x3a-\\x40\\x5c\\x7b\\x7d\\x7f]/', $name)) { + if (preg_match('/[\\x00-\\x20\\x22\\x28-\\x29\\x2c\\x2f\\x3a-\\x40\\x5c\\x7b\\x7d\\x7f]/', $name)) { return 'Cookie name must not contain invalid characters: ASCII ' . 'Control characters (0-31;127), space, tab and the ' . 'following characters: ()<>@,;:\\"/?={}'; } // Value must not be empty, but can be 0 $value = $this->getValue(); - if (empty($value) && !\is_numeric($value)) { + if (empty($value) && !is_numeric($value)) { return 'The cookie value must not be empty'; } // Domains must not be empty, but can be 0 // A "0" is not a valid internet domain, but may be used as server name // in a private network. $domain = $this->getDomain(); - if (empty($domain) && !\is_numeric($domain)) { + if (empty($domain) && !is_numeric($domain)) { return 'The cookie domain must not be empty'; } - return \true; + return true; } } diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/index.php b/vendor/guzzlehttp/guzzle/src/Cookie/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Cookie/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php b/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php index 2bd979c39..a8ab56fe7 100644 --- a/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php +++ b/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php @@ -4,15 +4,19 @@ use _PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface; +use Exception; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * Exception when an HTTP error occurs (4xx or 5xx error) */ -class BadResponseException extends \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\RequestException +class BadResponseException extends RequestException { - public function __construct($message, \_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, \_PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface $response = null, \Exception $previous = null, array $handlerContext = []) + public function __construct($message, RequestInterface $request, ResponseInterface $response = null, Exception $previous = null, array $handlerContext = []) { if (null === $response) { - @\trigger_error('Instantiating the ' . __CLASS__ . ' class without a Response is deprecated since version 6.3 and will be removed in 7.0.', \E_USER_DEPRECATED); + @trigger_error('Instantiating the ' . __CLASS__ . ' class without a Response is deprecated since version 6.3 and will be removed in 7.0.', E_USER_DEPRECATED); } parent::__construct($message, $request, $response, $previous, $handlerContext); } diff --git a/vendor/guzzlehttp/guzzle/src/Exception/ClientException.php b/vendor/guzzlehttp/guzzle/src/Exception/ClientException.php index 1502d8f6b..6cc6fb41c 100644 --- a/vendor/guzzlehttp/guzzle/src/Exception/ClientException.php +++ b/vendor/guzzlehttp/guzzle/src/Exception/ClientException.php @@ -5,6 +5,6 @@ /** * Exception when a client error is encountered (4xx codes) */ -class ClientException extends \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\BadResponseException +class ClientException extends BadResponseException { } diff --git a/vendor/guzzlehttp/guzzle/src/Exception/ConnectException.php b/vendor/guzzlehttp/guzzle/src/Exception/ConnectException.php index f5f13f2a0..cbf344e5c 100644 --- a/vendor/guzzlehttp/guzzle/src/Exception/ConnectException.php +++ b/vendor/guzzlehttp/guzzle/src/Exception/ConnectException.php @@ -3,14 +3,16 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Exception; use _PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface; +use Exception; + /** * Exception thrown when a connection cannot be established. * * Note that no response is present for a ConnectException */ -class ConnectException extends \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\RequestException +class ConnectException extends RequestException { - public function __construct($message, \_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, \Exception $previous = null, array $handlerContext = []) + public function __construct($message, RequestInterface $request, Exception $previous = null, array $handlerContext = []) { parent::__construct($message, $request, null, $previous, $handlerContext); } @@ -26,6 +28,6 @@ public function getResponse() */ public function hasResponse() { - return \false; + return false; } } diff --git a/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php b/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php index b2809db8c..308aa60d3 100644 --- a/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php +++ b/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php @@ -3,14 +3,16 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Exception; use Throwable; -if (\interface_exists(\Throwable::class)) { - interface GuzzleException extends \Throwable +use function interface_exists; + +if (interface_exists(Throwable::class)) { + interface GuzzleException extends Throwable { } } else { /** * @method string getMessage() - * @method \Throwable|null getPrevious() + * @method Throwable|null getPrevious() * @method mixed getCode() * @method string getFile() * @method int getLine() diff --git a/vendor/guzzlehttp/guzzle/src/Exception/InvalidArgumentException.php b/vendor/guzzlehttp/guzzle/src/Exception/InvalidArgumentException.php index 41b915855..ae22679ae 100644 --- a/vendor/guzzlehttp/guzzle/src/Exception/InvalidArgumentException.php +++ b/vendor/guzzlehttp/guzzle/src/Exception/InvalidArgumentException.php @@ -2,6 +2,6 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Exception; -final class InvalidArgumentException extends \InvalidArgumentException implements \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\GuzzleException +final class InvalidArgumentException extends \InvalidArgumentException implements GuzzleException { } diff --git a/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php b/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php index 0327e425a..989f0090a 100644 --- a/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php +++ b/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php @@ -6,10 +6,17 @@ use _PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface; +use Exception; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\get_message_body_summary; +use function floor; +use function sprintf; +use function strpos; +use function substr; + /** * HTTP Request exception */ -class RequestException extends \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\TransferException +class RequestException extends TransferException { /** @var RequestInterface */ private $request; @@ -17,10 +24,10 @@ class RequestException extends \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\Tra private $response; /** @var array */ private $handlerContext; - public function __construct($message, \_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, \_PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface $response = null, \Exception $previous = null, array $handlerContext = []) + public function __construct($message, RequestInterface $request, ResponseInterface $response = null, Exception $previous = null, array $handlerContext = []) { // Set the code of the exception if the response is set and not future. - $code = $response && !$response instanceof \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface ? $response->getStatusCode() : 0; + $code = $response && !$response instanceof PromiseInterface ? $response->getStatusCode() : 0; parent::__construct($message, $code, $previous); $this->request = $request; $this->response = $response; @@ -30,36 +37,36 @@ public function __construct($message, \_PhpScoper5ea00cc67502b\Psr\Http\Message\ * Wrap non-RequestExceptions with a RequestException * * @param RequestInterface $request - * @param \Exception $e + * @param Exception $e * * @return RequestException */ - public static function wrapException(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, \Exception $e) + public static function wrapException(RequestInterface $request, Exception $e) { - return $e instanceof \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\RequestException ? $e : new \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\RequestException($e->getMessage(), $request, null, $e); + return $e instanceof RequestException ? $e : new RequestException($e->getMessage(), $request, null, $e); } /** * Factory method to create a new exception with a normalized error message * * @param RequestInterface $request Request * @param ResponseInterface $response Response received - * @param \Exception $previous Previous exception + * @param Exception $previous Previous exception * @param array $ctx Optional handler context. * * @return self */ - public static function create(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, \_PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface $response = null, \Exception $previous = null, array $ctx = []) + public static function create(RequestInterface $request, ResponseInterface $response = null, Exception $previous = null, array $ctx = []) { if (!$response) { return new self('Error completing request', $request, null, $previous, $ctx); } - $level = (int) \floor($response->getStatusCode() / 100); + $level = (int) floor($response->getStatusCode() / 100); if ($level === 4) { $label = 'Client error'; - $className = \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\ClientException::class; + $className = ClientException::class; } elseif ($level === 5) { $label = 'Server error'; - $className = \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\ServerException::class; + $className = ServerException::class; } else { $label = 'Unsuccessful request'; $className = __CLASS__; @@ -68,7 +75,7 @@ public static function create(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestI $uri = static::obfuscateUri($uri); // Client Error: `GET /` resulted in a `404 Not Found` response: // ... (truncated) - $message = \sprintf('%s: `%s %s` resulted in a `%s %s` response', $label, $request->getMethod(), $uri, $response->getStatusCode(), $response->getReasonPhrase()); + $message = sprintf('%s: `%s %s` resulted in a `%s %s` response', $label, $request->getMethod(), $uri, $response->getStatusCode(), $response->getReasonPhrase()); $summary = static::getResponseBodySummary($response); if ($summary !== null) { $message .= ":\n{$summary}\n"; @@ -84,9 +91,9 @@ public static function create(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestI * * @return string|null */ - public static function getResponseBodySummary(\_PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface $response) + public static function getResponseBodySummary(ResponseInterface $response) { - return \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\get_message_body_summary($response); + return get_message_body_summary($response); } /** * Obfuscates URI if there is a username and a password present @@ -95,11 +102,11 @@ public static function getResponseBodySummary(\_PhpScoper5ea00cc67502b\Psr\Http\ * * @return UriInterface */ - private static function obfuscateUri(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $uri) + private static function obfuscateUri(UriInterface $uri) { $userInfo = $uri->getUserInfo(); - if (\false !== ($pos = \strpos($userInfo, ':'))) { - return $uri->withUserInfo(\substr($userInfo, 0, $pos), '***'); + if (false !== ($pos = strpos($userInfo, ':'))) { + return $uri->withUserInfo(substr($userInfo, 0, $pos), '***'); } return $uri; } diff --git a/vendor/guzzlehttp/guzzle/src/Exception/SeekException.php b/vendor/guzzlehttp/guzzle/src/Exception/SeekException.php index 9f52550ab..2f804720a 100644 --- a/vendor/guzzlehttp/guzzle/src/Exception/SeekException.php +++ b/vendor/guzzlehttp/guzzle/src/Exception/SeekException.php @@ -3,13 +3,15 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Exception; use _PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface; +use RuntimeException; + /** * Exception thrown when a seek fails on a stream. */ -class SeekException extends \RuntimeException implements \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\GuzzleException +class SeekException extends RuntimeException implements GuzzleException { private $stream; - public function __construct(\_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface $stream, $pos = 0, $msg = '') + public function __construct(StreamInterface $stream, $pos = 0, $msg = '') { $this->stream = $stream; $msg = $msg ?: 'Could not seek the stream to position ' . $pos; diff --git a/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php b/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php index 49884fb35..f7c7f3e60 100644 --- a/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php +++ b/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php @@ -5,6 +5,6 @@ /** * Exception when a server error is encountered (5xx codes) */ -class ServerException extends \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\BadResponseException +class ServerException extends BadResponseException { } diff --git a/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php b/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php index ae2543ffd..ded143ec5 100644 --- a/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php +++ b/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php @@ -2,6 +2,6 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Exception; -class TooManyRedirectsException extends \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\RequestException +class TooManyRedirectsException extends RequestException { } diff --git a/vendor/guzzlehttp/guzzle/src/Exception/TransferException.php b/vendor/guzzlehttp/guzzle/src/Exception/TransferException.php index 74b7c49c9..0c1f37279 100644 --- a/vendor/guzzlehttp/guzzle/src/Exception/TransferException.php +++ b/vendor/guzzlehttp/guzzle/src/Exception/TransferException.php @@ -2,6 +2,8 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Exception; -class TransferException extends \RuntimeException implements \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\GuzzleException +use RuntimeException; + +class TransferException extends RuntimeException implements GuzzleException { } diff --git a/vendor/guzzlehttp/guzzle/src/Exception/index.php b/vendor/guzzlehttp/guzzle/src/Exception/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Exception/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php b/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php index 3f4117f60..aed868835 100644 --- a/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php +++ b/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php @@ -9,10 +9,102 @@ use _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\LazyOpenStream; use _PhpScoper5ea00cc67502b\GuzzleHttp\TransferStats; use _PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface; +use Exception; +use GuzzleHttp\Promise\PromiseInterface; +use InvalidArgumentException; +use RuntimeException; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\debug_resource; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\is_host_in_noproxy; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\Promise\rejection_for; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\stream_for; +use function array_keys; +use function array_pop; +use function array_replace; +use function array_shift; +use function call_user_func; +use function call_user_func_array; +use function count; +use function curl_close; +use function curl_error; +use function curl_getinfo; +use function curl_init; +use function curl_reset; +use function curl_setopt; +use function curl_setopt_array; +use function curl_version; +use function defined; +use function dirname; +use function file_exists; +use function fopen; +use function func_get_args; +use function is_array; +use function is_callable; +use function is_dir; +use function is_link; +use function is_resource; +use function is_string; +use function readlink; +use function sprintf; +use function strcasecmp; +use function strlen; +use function strtoupper; +use function substr; +use function trim; +use function version_compare; +use const CURL_HTTP_VERSION_1_0; +use const CURL_HTTP_VERSION_1_1; +use const CURL_HTTP_VERSION_2_0; +use const CURL_IPRESOLVE_V4; +use const CURL_IPRESOLVE_V6; +use const CURLE_COULDNT_CONNECT; +use const CURLE_COULDNT_RESOLVE_HOST; +use const CURLE_GOT_NOTHING; +use const CURLE_OPERATION_TIMEOUTED; +use const CURLE_SSL_CONNECT_ERROR; +use const CURLINFO_APPCONNECT_TIME; +use const CURLOPT_CAINFO; +use const CURLOPT_CAPATH; +use const CURLOPT_CONNECTTIMEOUT; +use const CURLOPT_CONNECTTIMEOUT_MS; +use const CURLOPT_CUSTOMREQUEST; +use const CURLOPT_ENCODING; +use const CURLOPT_FILE; +use const CURLOPT_HEADER; +use const CURLOPT_HEADERFUNCTION; +use const CURLOPT_HTTP_VERSION; +use const CURLOPT_HTTPHEADER; +use const CURLOPT_INFILE; +use const CURLOPT_INFILESIZE; +use const CURLOPT_IPRESOLVE; +use const CURLOPT_NOBODY; +use const CURLOPT_NOPROGRESS; +use const CURLOPT_NOSIGNAL; +use const CURLOPT_POSTFIELDS; +use const CURLOPT_PROGRESSFUNCTION; +use const CURLOPT_PROTOCOLS; +use const CURLOPT_PROXY; +use const CURLOPT_READFUNCTION; +use const CURLOPT_RETURNTRANSFER; +use const CURLOPT_SSL_VERIFYHOST; +use const CURLOPT_SSL_VERIFYPEER; +use const CURLOPT_SSLCERT; +use const CURLOPT_SSLCERTPASSWD; +use const CURLOPT_SSLKEY; +use const CURLOPT_SSLKEYPASSWD; +use const CURLOPT_STDERR; +use const CURLOPT_TIMEOUT_MS; +use const CURLOPT_UPLOAD; +use const CURLOPT_URL; +use const CURLOPT_VERBOSE; +use const CURLOPT_WRITEFUNCTION; +use const CURLPROTO_HTTP; +use const CURLPROTO_HTTPS; +use const PHP_OS; + /** * Creates curl resources from a request */ -class CurlFactory implements \_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\CurlFactoryInterface +class CurlFactory implements CurlFactoryInterface { const CURL_VERSION_STR = 'curl_version'; const LOW_CURL_VERSION_NUMBER = '7.21.2'; @@ -27,13 +119,13 @@ public function __construct($maxHandles) { $this->maxHandles = $maxHandles; } - public function create(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options) + public function create(RequestInterface $request, array $options) { if (isset($options['curl']['body_as_string'])) { $options['_body_as_string'] = $options['curl']['body_as_string']; unset($options['curl']['body_as_string']); } - $easy = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\EasyHandle(); + $easy = new EasyHandle(); $easy->request = $request; $easy->options = $options; $conf = $this->getDefaultConf($easy); @@ -43,29 +135,29 @@ public function create(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterfac unset($conf['_headers']); // Add handler options from the request configuration options if (isset($options['curl'])) { - $conf = \array_replace($conf, $options['curl']); + $conf = array_replace($conf, $options['curl']); } - $conf[\CURLOPT_HEADERFUNCTION] = $this->createHeaderFn($easy); - $easy->handle = $this->handles ? \array_pop($this->handles) : \curl_init(); - \curl_setopt_array($easy->handle, $conf); + $conf[CURLOPT_HEADERFUNCTION] = $this->createHeaderFn($easy); + $easy->handle = $this->handles ? array_pop($this->handles) : curl_init(); + curl_setopt_array($easy->handle, $conf); return $easy; } - public function release(\_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\EasyHandle $easy) + public function release(EasyHandle $easy) { $resource = $easy->handle; unset($easy->handle); - if (\count($this->handles) >= $this->maxHandles) { - \curl_close($resource); + if (count($this->handles) >= $this->maxHandles) { + curl_close($resource); } else { // Remove all callback functions as they can hold onto references // and are not cleaned up by curl_reset. Using curl_setopt_array // does not work for some reason, so removing each one // individually. - \curl_setopt($resource, \CURLOPT_HEADERFUNCTION, null); - \curl_setopt($resource, \CURLOPT_READFUNCTION, null); - \curl_setopt($resource, \CURLOPT_WRITEFUNCTION, null); - \curl_setopt($resource, \CURLOPT_PROGRESSFUNCTION, null); - \curl_reset($resource); + curl_setopt($resource, CURLOPT_HEADERFUNCTION, null); + curl_setopt($resource, CURLOPT_READFUNCTION, null); + curl_setopt($resource, CURLOPT_WRITEFUNCTION, null); + curl_setopt($resource, CURLOPT_PROGRESSFUNCTION, null); + curl_reset($resource); $this->handles[] = $resource; } } @@ -77,9 +169,9 @@ public function release(\_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\EasyHandle $ * @param EasyHandle $easy * @param CurlFactoryInterface $factory Dictates how the handle is released * - * @return \GuzzleHttp\Promise\PromiseInterface + * @return PromiseInterface */ - public static function finish(callable $handler, \_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\EasyHandle $easy, \_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\CurlFactoryInterface $factory) + public static function finish(callable $handler, EasyHandle $easy, CurlFactoryInterface $factory) { if (isset($easy->options['on_stats'])) { self::invokeStats($easy); @@ -94,20 +186,20 @@ public static function finish(callable $handler, \_PhpScoper5ea00cc67502b\Guzzle if ($body->isSeekable()) { $body->rewind(); } - return new \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\FulfilledPromise($easy->response); + return new FulfilledPromise($easy->response); } - private static function invokeStats(\_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\EasyHandle $easy) + private static function invokeStats(EasyHandle $easy) { - $curlStats = \curl_getinfo($easy->handle); - $curlStats['appconnect_time'] = \curl_getinfo($easy->handle, \CURLINFO_APPCONNECT_TIME); - $stats = new \_PhpScoper5ea00cc67502b\GuzzleHttp\TransferStats($easy->request, $easy->response, $curlStats['total_time'], $easy->errno, $curlStats); - \call_user_func($easy->options['on_stats'], $stats); + $curlStats = curl_getinfo($easy->handle); + $curlStats['appconnect_time'] = curl_getinfo($easy->handle, CURLINFO_APPCONNECT_TIME); + $stats = new TransferStats($easy->request, $easy->response, $curlStats['total_time'], $easy->errno, $curlStats); + call_user_func($easy->options['on_stats'], $stats); } - private static function finishError(callable $handler, \_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\EasyHandle $easy, \_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\CurlFactoryInterface $factory) + private static function finishError(callable $handler, EasyHandle $easy, CurlFactoryInterface $factory) { // Get error information and release the handle to the factory. - $ctx = ['errno' => $easy->errno, 'error' => \curl_error($easy->handle), 'appconnect_time' => \curl_getinfo($easy->handle, \CURLINFO_APPCONNECT_TIME)] + \curl_getinfo($easy->handle); - $ctx[self::CURL_VERSION_STR] = \curl_version()['version']; + $ctx = ['errno' => $easy->errno, 'error' => curl_error($easy->handle), 'appconnect_time' => curl_getinfo($easy->handle, CURLINFO_APPCONNECT_TIME)] + curl_getinfo($easy->handle); + $ctx[self::CURL_VERSION_STR] = curl_version()['version']; $factory->release($easy); // Retry when nothing is present or when curl failed to rewind. if (empty($easy->options['_err_message']) && (!$easy->errno || $easy->errno == 65)) { @@ -115,40 +207,40 @@ private static function finishError(callable $handler, \_PhpScoper5ea00cc67502b\ } return self::createRejection($easy, $ctx); } - private static function createRejection(\_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\EasyHandle $easy, array $ctx) + private static function createRejection(EasyHandle $easy, array $ctx) { - static $connectionErrors = [\CURLE_OPERATION_TIMEOUTED => \true, \CURLE_COULDNT_RESOLVE_HOST => \true, \CURLE_COULDNT_CONNECT => \true, \CURLE_SSL_CONNECT_ERROR => \true, \CURLE_GOT_NOTHING => \true]; + static $connectionErrors = [CURLE_OPERATION_TIMEOUTED => true, CURLE_COULDNT_RESOLVE_HOST => true, CURLE_COULDNT_CONNECT => true, CURLE_SSL_CONNECT_ERROR => true, CURLE_GOT_NOTHING => true]; // If an exception was encountered during the onHeaders event, then // return a rejected promise that wraps that exception. if ($easy->onHeadersException) { - return \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\rejection_for(new \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\RequestException('An error was encountered during the on_headers event', $easy->request, $easy->response, $easy->onHeadersException, $ctx)); + return rejection_for(new RequestException('An error was encountered during the on_headers event', $easy->request, $easy->response, $easy->onHeadersException, $ctx)); } - if (\version_compare($ctx[self::CURL_VERSION_STR], self::LOW_CURL_VERSION_NUMBER)) { - $message = \sprintf('cURL error %s: %s (%s)', $ctx['errno'], $ctx['error'], 'see https://curl.haxx.se/libcurl/c/libcurl-errors.html'); + if (version_compare($ctx[self::CURL_VERSION_STR], self::LOW_CURL_VERSION_NUMBER)) { + $message = sprintf('cURL error %s: %s (%s)', $ctx['errno'], $ctx['error'], 'see https://curl.haxx.se/libcurl/c/libcurl-errors.html'); } else { - $message = \sprintf('cURL error %s: %s (%s) for %s', $ctx['errno'], $ctx['error'], 'see https://curl.haxx.se/libcurl/c/libcurl-errors.html', $easy->request->getUri()); + $message = sprintf('cURL error %s: %s (%s) for %s', $ctx['errno'], $ctx['error'], 'see https://curl.haxx.se/libcurl/c/libcurl-errors.html', $easy->request->getUri()); } // Create a connection exception if it was a specific error code. - $error = isset($connectionErrors[$easy->errno]) ? new \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\ConnectException($message, $easy->request, null, $ctx) : new \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\RequestException($message, $easy->request, $easy->response, null, $ctx); - return \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\rejection_for($error); + $error = isset($connectionErrors[$easy->errno]) ? new ConnectException($message, $easy->request, null, $ctx) : new RequestException($message, $easy->request, $easy->response, null, $ctx); + return rejection_for($error); } - private function getDefaultConf(\_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\EasyHandle $easy) + private function getDefaultConf(EasyHandle $easy) { - $conf = ['_headers' => $easy->request->getHeaders(), \CURLOPT_CUSTOMREQUEST => $easy->request->getMethod(), \CURLOPT_URL => (string) $easy->request->getUri()->withFragment(''), \CURLOPT_RETURNTRANSFER => \false, \CURLOPT_HEADER => \false, \CURLOPT_CONNECTTIMEOUT => 150]; - if (\defined('CURLOPT_PROTOCOLS')) { - $conf[\CURLOPT_PROTOCOLS] = \CURLPROTO_HTTP | \CURLPROTO_HTTPS; + $conf = ['_headers' => $easy->request->getHeaders(), CURLOPT_CUSTOMREQUEST => $easy->request->getMethod(), CURLOPT_URL => (string) $easy->request->getUri()->withFragment(''), CURLOPT_RETURNTRANSFER => false, CURLOPT_HEADER => false, CURLOPT_CONNECTTIMEOUT => 150]; + if (defined('CURLOPT_PROTOCOLS')) { + $conf[CURLOPT_PROTOCOLS] = CURLPROTO_HTTP | CURLPROTO_HTTPS; } $version = $easy->request->getProtocolVersion(); if ($version == 1.1) { - $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_1_1; + $conf[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1; } elseif ($version == 2.0) { - $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_2_0; + $conf[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2_0; } else { - $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_1_0; + $conf[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_0; } return $conf; } - private function applyMethod(\_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\EasyHandle $easy, array &$conf) + private function applyMethod(EasyHandle $easy, array &$conf) { $body = $easy->request->getBody(); $size = $body->getSize(); @@ -160,47 +252,47 @@ private function applyMethod(\_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\EasyHan if ($method === 'PUT' || $method === 'POST') { // See http://tools.ietf.org/html/rfc7230#section-3.3.2 if (!$easy->request->hasHeader('Content-Length')) { - $conf[\CURLOPT_HTTPHEADER][] = 'Content-Length: 0'; + $conf[CURLOPT_HTTPHEADER][] = 'Content-Length: 0'; } } elseif ($method === 'HEAD') { - $conf[\CURLOPT_NOBODY] = \true; - unset($conf[\CURLOPT_WRITEFUNCTION], $conf[\CURLOPT_READFUNCTION], $conf[\CURLOPT_FILE], $conf[\CURLOPT_INFILE]); + $conf[CURLOPT_NOBODY] = true; + unset($conf[CURLOPT_WRITEFUNCTION], $conf[CURLOPT_READFUNCTION], $conf[CURLOPT_FILE], $conf[CURLOPT_INFILE]); } } - private function applyBody(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options, array &$conf) + private function applyBody(RequestInterface $request, array $options, array &$conf) { $size = $request->hasHeader('Content-Length') ? (int) $request->getHeaderLine('Content-Length') : null; // Send the body as a string if the size is less than 1MB OR if the // [curl][body_as_string] request value is set. if ($size !== null && $size < 1000000 || !empty($options['_body_as_string'])) { - $conf[\CURLOPT_POSTFIELDS] = (string) $request->getBody(); + $conf[CURLOPT_POSTFIELDS] = (string) $request->getBody(); // Don't duplicate the Content-Length header $this->removeHeader('Content-Length', $conf); $this->removeHeader('Transfer-Encoding', $conf); } else { - $conf[\CURLOPT_UPLOAD] = \true; + $conf[CURLOPT_UPLOAD] = true; if ($size !== null) { - $conf[\CURLOPT_INFILESIZE] = $size; + $conf[CURLOPT_INFILESIZE] = $size; $this->removeHeader('Content-Length', $conf); } $body = $request->getBody(); if ($body->isSeekable()) { $body->rewind(); } - $conf[\CURLOPT_READFUNCTION] = function ($ch, $fd, $length) use($body) { + $conf[CURLOPT_READFUNCTION] = function ($ch, $fd, $length) use($body) { return $body->read($length); }; } // If the Expect header is not present, prevent curl from adding it if (!$request->hasHeader('Expect')) { - $conf[\CURLOPT_HTTPHEADER][] = 'Expect:'; + $conf[CURLOPT_HTTPHEADER][] = 'Expect:'; } // cURL sometimes adds a content-type by default. Prevent this. if (!$request->hasHeader('Content-Type')) { - $conf[\CURLOPT_HTTPHEADER][] = 'Content-Type:'; + $conf[CURLOPT_HTTPHEADER][] = 'Content-Type:'; } } - private function applyHeaders(\_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\EasyHandle $easy, array &$conf) + private function applyHeaders(EasyHandle $easy, array &$conf) { foreach ($conf['_headers'] as $name => $values) { foreach ($values as $value) { @@ -208,15 +300,15 @@ private function applyHeaders(\_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\EasyHa if ($value === '') { // cURL requires a special format for empty headers. // See https://github.com/guzzle/guzzle/issues/1882 for more details. - $conf[\CURLOPT_HTTPHEADER][] = "{$name};"; + $conf[CURLOPT_HTTPHEADER][] = "{$name};"; } else { - $conf[\CURLOPT_HTTPHEADER][] = "{$name}: {$value}"; + $conf[CURLOPT_HTTPHEADER][] = "{$name}: {$value}"; } } } // Remove the Accept header if one was not set if (!$easy->request->hasHeader('Accept')) { - $conf[\CURLOPT_HTTPHEADER][] = 'Accept:'; + $conf[CURLOPT_HTTPHEADER][] = 'Accept:'; } } /** @@ -227,35 +319,35 @@ private function applyHeaders(\_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\EasyHa */ private function removeHeader($name, array &$options) { - foreach (\array_keys($options['_headers']) as $key) { - if (!\strcasecmp($key, $name)) { + foreach (array_keys($options['_headers']) as $key) { + if (!strcasecmp($key, $name)) { unset($options['_headers'][$key]); return; } } } - private function applyHandlerOptions(\_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\EasyHandle $easy, array &$conf) + private function applyHandlerOptions(EasyHandle $easy, array &$conf) { $options = $easy->options; if (isset($options['verify'])) { - if ($options['verify'] === \false) { - unset($conf[\CURLOPT_CAINFO]); - $conf[\CURLOPT_SSL_VERIFYHOST] = 0; - $conf[\CURLOPT_SSL_VERIFYPEER] = \false; + if ($options['verify'] === false) { + unset($conf[CURLOPT_CAINFO]); + $conf[CURLOPT_SSL_VERIFYHOST] = 0; + $conf[CURLOPT_SSL_VERIFYPEER] = false; } else { - $conf[\CURLOPT_SSL_VERIFYHOST] = 2; - $conf[\CURLOPT_SSL_VERIFYPEER] = \true; - if (\is_string($options['verify'])) { + $conf[CURLOPT_SSL_VERIFYHOST] = 2; + $conf[CURLOPT_SSL_VERIFYPEER] = true; + if (is_string($options['verify'])) { // Throw an error if the file/folder/link path is not valid or doesn't exist. - if (!\file_exists($options['verify'])) { - throw new \InvalidArgumentException("SSL CA bundle not found: {$options['verify']}"); + if (!file_exists($options['verify'])) { + throw new InvalidArgumentException("SSL CA bundle not found: {$options['verify']}"); } // If it's a directory or a link to a directory use CURLOPT_CAPATH. // If not, it's probably a file, or a link to a file, so use CURLOPT_CAINFO. - if (\is_dir($options['verify']) || \is_link($options['verify']) && \is_dir(\readlink($options['verify']))) { - $conf[\CURLOPT_CAPATH] = $options['verify']; + if (is_dir($options['verify']) || is_link($options['verify']) && is_dir(readlink($options['verify']))) { + $conf[CURLOPT_CAPATH] = $options['verify']; } else { - $conf[\CURLOPT_CAINFO] = $options['verify']; + $conf[CURLOPT_CAINFO] = $options['verify']; } } } @@ -263,108 +355,108 @@ private function applyHandlerOptions(\_PhpScoper5ea00cc67502b\GuzzleHttp\Handler if (!empty($options['decode_content'])) { $accept = $easy->request->getHeaderLine('Accept-Encoding'); if ($accept) { - $conf[\CURLOPT_ENCODING] = $accept; + $conf[CURLOPT_ENCODING] = $accept; } else { - $conf[\CURLOPT_ENCODING] = ''; + $conf[CURLOPT_ENCODING] = ''; // Don't let curl send the header over the wire - $conf[\CURLOPT_HTTPHEADER][] = 'Accept-Encoding:'; + $conf[CURLOPT_HTTPHEADER][] = 'Accept-Encoding:'; } } if (isset($options['sink'])) { $sink = $options['sink']; - if (!\is_string($sink)) { - $sink = \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\stream_for($sink); - } elseif (!\is_dir(\dirname($sink))) { + if (!is_string($sink)) { + $sink = stream_for($sink); + } elseif (!is_dir(dirname($sink))) { // Ensure that the directory exists before failing in curl. - throw new \RuntimeException(\sprintf('Directory %s does not exist for sink value of %s', \dirname($sink), $sink)); + throw new RuntimeException(sprintf('Directory %s does not exist for sink value of %s', dirname($sink), $sink)); } else { - $sink = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\LazyOpenStream($sink, 'w+'); + $sink = new LazyOpenStream($sink, 'w+'); } $easy->sink = $sink; - $conf[\CURLOPT_WRITEFUNCTION] = function ($ch, $write) use($sink) { + $conf[CURLOPT_WRITEFUNCTION] = function ($ch, $write) use($sink) { return $sink->write($write); }; } else { // Use a default temp stream if no sink was set. - $conf[\CURLOPT_FILE] = \fopen('php://temp', 'w+'); - $easy->sink = \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\stream_for($conf[\CURLOPT_FILE]); + $conf[CURLOPT_FILE] = fopen('php://temp', 'w+'); + $easy->sink = stream_for($conf[CURLOPT_FILE]); } - $timeoutRequiresNoSignal = \false; + $timeoutRequiresNoSignal = false; if (isset($options['timeout'])) { $timeoutRequiresNoSignal |= $options['timeout'] < 1; - $conf[\CURLOPT_TIMEOUT_MS] = $options['timeout'] * 1000; + $conf[CURLOPT_TIMEOUT_MS] = $options['timeout'] * 1000; } // CURL default value is CURL_IPRESOLVE_WHATEVER if (isset($options['force_ip_resolve'])) { if ('v4' === $options['force_ip_resolve']) { - $conf[\CURLOPT_IPRESOLVE] = \CURL_IPRESOLVE_V4; + $conf[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V4; } elseif ('v6' === $options['force_ip_resolve']) { - $conf[\CURLOPT_IPRESOLVE] = \CURL_IPRESOLVE_V6; + $conf[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V6; } } if (isset($options['connect_timeout'])) { $timeoutRequiresNoSignal |= $options['connect_timeout'] < 1; - $conf[\CURLOPT_CONNECTTIMEOUT_MS] = $options['connect_timeout'] * 1000; + $conf[CURLOPT_CONNECTTIMEOUT_MS] = $options['connect_timeout'] * 1000; } - if ($timeoutRequiresNoSignal && \strtoupper(\substr(\PHP_OS, 0, 3)) !== 'WIN') { - $conf[\CURLOPT_NOSIGNAL] = \true; + if ($timeoutRequiresNoSignal && strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { + $conf[CURLOPT_NOSIGNAL] = true; } if (isset($options['proxy'])) { - if (!\is_array($options['proxy'])) { - $conf[\CURLOPT_PROXY] = $options['proxy']; + if (!is_array($options['proxy'])) { + $conf[CURLOPT_PROXY] = $options['proxy']; } else { $scheme = $easy->request->getUri()->getScheme(); if (isset($options['proxy'][$scheme])) { $host = $easy->request->getUri()->getHost(); - if (!isset($options['proxy']['no']) || !\_PhpScoper5ea00cc67502b\GuzzleHttp\is_host_in_noproxy($host, $options['proxy']['no'])) { - $conf[\CURLOPT_PROXY] = $options['proxy'][$scheme]; + if (!isset($options['proxy']['no']) || !is_host_in_noproxy($host, $options['proxy']['no'])) { + $conf[CURLOPT_PROXY] = $options['proxy'][$scheme]; } } } } if (isset($options['cert'])) { $cert = $options['cert']; - if (\is_array($cert)) { - $conf[\CURLOPT_SSLCERTPASSWD] = $cert[1]; + if (is_array($cert)) { + $conf[CURLOPT_SSLCERTPASSWD] = $cert[1]; $cert = $cert[0]; } - if (!\file_exists($cert)) { - throw new \InvalidArgumentException("SSL certificate not found: {$cert}"); + if (!file_exists($cert)) { + throw new InvalidArgumentException("SSL certificate not found: {$cert}"); } - $conf[\CURLOPT_SSLCERT] = $cert; + $conf[CURLOPT_SSLCERT] = $cert; } if (isset($options['ssl_key'])) { - if (\is_array($options['ssl_key'])) { - if (\count($options['ssl_key']) === 2) { - list($sslKey, $conf[\CURLOPT_SSLKEYPASSWD]) = $options['ssl_key']; + if (is_array($options['ssl_key'])) { + if (count($options['ssl_key']) === 2) { + [$sslKey, $conf[CURLOPT_SSLKEYPASSWD]] = $options['ssl_key']; } else { - list($sslKey) = $options['ssl_key']; + [$sslKey] = $options['ssl_key']; } } $sslKey = isset($sslKey) ? $sslKey : $options['ssl_key']; - if (!\file_exists($sslKey)) { - throw new \InvalidArgumentException("SSL private key not found: {$sslKey}"); + if (!file_exists($sslKey)) { + throw new InvalidArgumentException("SSL private key not found: {$sslKey}"); } - $conf[\CURLOPT_SSLKEY] = $sslKey; + $conf[CURLOPT_SSLKEY] = $sslKey; } if (isset($options['progress'])) { $progress = $options['progress']; - if (!\is_callable($progress)) { - throw new \InvalidArgumentException('progress client option must be callable'); + if (!is_callable($progress)) { + throw new InvalidArgumentException('progress client option must be callable'); } - $conf[\CURLOPT_NOPROGRESS] = \false; - $conf[\CURLOPT_PROGRESSFUNCTION] = function () use($progress) { - $args = \func_get_args(); + $conf[CURLOPT_NOPROGRESS] = false; + $conf[CURLOPT_PROGRESSFUNCTION] = function () use($progress) { + $args = func_get_args(); // PHP 5.5 pushed the handle onto the start of the args - if (\is_resource($args[0])) { - \array_shift($args); + if (is_resource($args[0])) { + array_shift($args); } - \call_user_func_array($progress, $args); + call_user_func_array($progress, $args); }; } if (!empty($options['debug'])) { - $conf[\CURLOPT_STDERR] = \_PhpScoper5ea00cc67502b\GuzzleHttp\debug_resource($options['debug']); - $conf[\CURLOPT_VERBOSE] = \true; + $conf[CURLOPT_STDERR] = debug_resource($options['debug']); + $conf[CURLOPT_VERBOSE] = true; } } /** @@ -376,7 +468,7 @@ private function applyHandlerOptions(\_PhpScoper5ea00cc67502b\GuzzleHttp\Handler * error, causing the request to be sent through curl_multi_info_read() * without an error status. */ - private static function retryFailedRewind(callable $handler, \_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\EasyHandle $easy, array $ctx) + private static function retryFailedRewind(callable $handler, EasyHandle $easy, array $ctx) { try { // Only rewind if the body has been read from. @@ -384,7 +476,7 @@ private static function retryFailedRewind(callable $handler, \_PhpScoper5ea00cc6 if ($body->tell() > 0) { $body->rewind(); } - } catch (\RuntimeException $e) { + } catch (RuntimeException $e) { $ctx['error'] = 'The connection unexpectedly failed without ' . 'providing an error. The request would have been retried, ' . 'but attempting to rewind the request body failed. ' . 'Exception: ' . $e; return self::createRejection($easy, $ctx); } @@ -399,25 +491,25 @@ private static function retryFailedRewind(callable $handler, \_PhpScoper5ea00cc6 } return $handler($easy->request, $easy->options); } - private function createHeaderFn(\_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\EasyHandle $easy) + private function createHeaderFn(EasyHandle $easy) { if (isset($easy->options['on_headers'])) { $onHeaders = $easy->options['on_headers']; - if (!\is_callable($onHeaders)) { - throw new \InvalidArgumentException('on_headers must be callable'); + if (!is_callable($onHeaders)) { + throw new InvalidArgumentException('on_headers must be callable'); } } else { $onHeaders = null; } return function ($ch, $h) use($onHeaders, $easy, &$startingResponse) { - $value = \trim($h); + $value = trim($h); if ($value === '') { - $startingResponse = \true; + $startingResponse = true; $easy->createResponse(); if ($onHeaders !== null) { try { $onHeaders($easy->response); - } catch (\Exception $e) { + } catch (Exception $e) { // Associate the exception with the handle and trigger // a curl header write error by returning 0. $easy->onHeadersException = $e; @@ -425,12 +517,12 @@ private function createHeaderFn(\_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\Easy } } } elseif ($startingResponse) { - $startingResponse = \false; + $startingResponse = false; $easy->headers = [$value]; } else { $easy->headers[] = $value; } - return \strlen($h); + return strlen($h); }; } } diff --git a/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php b/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php index 3c8095298..a0ea7b3b3 100644 --- a/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php +++ b/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php @@ -3,6 +3,8 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Handler; use _PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface; +use RuntimeException; + interface CurlFactoryInterface { /** @@ -12,9 +14,9 @@ interface CurlFactoryInterface * @param array $options Transfer options * * @return EasyHandle - * @throws \RuntimeException when an option cannot be applied + * @throws RuntimeException when an option cannot be applied */ - public function create(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options); + public function create(RequestInterface $request, array $options); /** * Release an easy handle, allowing it to be reused or closed. * @@ -22,5 +24,5 @@ public function create(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterfac * * @param EasyHandle $easy */ - public function release(\_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\EasyHandle $easy); + public function release(EasyHandle $easy); } diff --git a/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php b/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php index bc7682e2a..185858591 100644 --- a/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php +++ b/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php @@ -4,6 +4,10 @@ use _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7; use _PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface; +use function curl_errno; +use function curl_exec; +use function usleep; + /** * HTTP handler that uses cURL easy handles as a transport layer. * @@ -24,16 +28,16 @@ class CurlHandler */ public function __construct(array $options = []) { - $this->factory = isset($options['handle_factory']) ? $options['handle_factory'] : new \_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\CurlFactory(3); + $this->factory = isset($options['handle_factory']) ? $options['handle_factory'] : new CurlFactory(3); } - public function __invoke(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options) + public function __invoke(RequestInterface $request, array $options) { if (isset($options['delay'])) { - \usleep($options['delay'] * 1000); + usleep($options['delay'] * 1000); } $easy = $this->factory->create($request, $options); - \curl_exec($easy->handle); - $easy->errno = \curl_errno($easy->handle); - return \_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\CurlFactory::finish($this, $easy, $this->factory); + curl_exec($easy->handle); + $easy->errno = curl_errno($easy->handle); + return CurlFactory::finish($this, $easy, $this->factory); } } diff --git a/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php b/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php index e197c2716..ebeac640c 100644 --- a/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php +++ b/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php @@ -7,6 +7,23 @@ use _PhpScoper5ea00cc67502b\GuzzleHttp\Promise\Promise; use _PhpScoper5ea00cc67502b\GuzzleHttp\Utils; use _PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface; +use BadMethodCallException; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\Promise\queue; +use function curl_close; +use function curl_multi_add_handle; +use function curl_multi_close; +use function curl_multi_exec; +use function curl_multi_info_read; +use function curl_multi_init; +use function curl_multi_remove_handle; +use function curl_multi_select; +use function curl_multi_setopt; +use function getenv; +use function max; +use function usleep; +use const CURLM_CALL_MULTI_PERFORM; +use const PHP_INT_MAX; + /** * Returns an asynchronous response using curl_multi_* functions. * @@ -38,10 +55,10 @@ class CurlMultiHandler */ public function __construct(array $options = []) { - $this->factory = isset($options['handle_factory']) ? $options['handle_factory'] : new \_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\CurlFactory(50); + $this->factory = isset($options['handle_factory']) ? $options['handle_factory'] : new CurlFactory(50); if (isset($options['select_timeout'])) { $this->selectTimeout = $options['select_timeout']; - } elseif ($selectTimeout = \getenv('GUZZLE_CURL_SELECT_TIMEOUT')) { + } elseif ($selectTimeout = getenv('GUZZLE_CURL_SELECT_TIMEOUT')) { $this->selectTimeout = $selectTimeout; } else { $this->selectTimeout = 1; @@ -51,29 +68,29 @@ public function __construct(array $options = []) public function __get($name) { if ($name === '_mh') { - $this->_mh = \curl_multi_init(); + $this->_mh = curl_multi_init(); foreach ($this->options as $option => $value) { // A warning is raised in case of a wrong option. - \curl_multi_setopt($this->_mh, $option, $value); + curl_multi_setopt($this->_mh, $option, $value); } // Further calls to _mh will return the value directly, without entering the // __get() method at all. return $this->_mh; } - throw new \BadMethodCallException(); + throw new BadMethodCallException(); } public function __destruct() { if (isset($this->_mh)) { - \curl_multi_close($this->_mh); + curl_multi_close($this->_mh); unset($this->_mh); } } - public function __invoke(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options) + public function __invoke(RequestInterface $request, array $options) { $easy = $this->factory->create($request, $options); $id = (int) $easy->handle; - $promise = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\Promise([$this, 'execute'], function () use($id) { + $promise = new Promise([$this, 'execute'], function () use($id) { return $this->cancel($id); }); $this->addRequest(['easy' => $easy, 'deferred' => $promise]); @@ -86,22 +103,22 @@ public function tick() { // Add any delayed handles if needed. if ($this->delays) { - $currentTime = \_PhpScoper5ea00cc67502b\GuzzleHttp\Utils::currentTime(); + $currentTime = Utils::currentTime(); foreach ($this->delays as $id => $delay) { if ($currentTime >= $delay) { unset($this->delays[$id]); - \curl_multi_add_handle($this->_mh, $this->handles[$id]['easy']->handle); + curl_multi_add_handle($this->_mh, $this->handles[$id]['easy']->handle); } } } // Step through the task queue which may add additional requests. - \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\queue()->run(); - if ($this->active && \curl_multi_select($this->_mh, $this->selectTimeout) === -1) { + queue()->run(); + if ($this->active && curl_multi_select($this->_mh, $this->selectTimeout) === -1) { // Perform a usleep if a select returns -1. // See: https://bugs.php.net/bug.php?id=61141 - \usleep(250); + usleep(250); } - while (\curl_multi_exec($this->_mh, $this->active) === \CURLM_CALL_MULTI_PERFORM) { + while (curl_multi_exec($this->_mh, $this->active) === CURLM_CALL_MULTI_PERFORM) { } $this->processMessages(); } @@ -110,11 +127,11 @@ public function tick() */ public function execute() { - $queue = \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\queue(); + $queue = queue(); while ($this->handles || !$queue->isEmpty()) { // If there are no transfers, then sleep for the next delay if (!$this->active && $this->delays) { - \usleep($this->timeToNext()); + usleep($this->timeToNext()); } $this->tick(); } @@ -125,9 +142,9 @@ private function addRequest(array $entry) $id = (int) $easy->handle; $this->handles[$id] = $entry; if (empty($easy->options['delay'])) { - \curl_multi_add_handle($this->_mh, $easy->handle); + curl_multi_add_handle($this->_mh, $easy->handle); } else { - $this->delays[$id] = \_PhpScoper5ea00cc67502b\GuzzleHttp\Utils::currentTime() + $easy->options['delay'] / 1000; + $this->delays[$id] = Utils::currentTime() + $easy->options['delay'] / 1000; } } /** @@ -141,19 +158,19 @@ private function cancel($id) { // Cannot cancel if it has been processed. if (!isset($this->handles[$id])) { - return \false; + return false; } $handle = $this->handles[$id]['easy']->handle; unset($this->delays[$id], $this->handles[$id]); - \curl_multi_remove_handle($this->_mh, $handle); - \curl_close($handle); - return \true; + curl_multi_remove_handle($this->_mh, $handle); + curl_close($handle); + return true; } private function processMessages() { - while ($done = \curl_multi_info_read($this->_mh)) { + while ($done = curl_multi_info_read($this->_mh)) { $id = (int) $done['handle']; - \curl_multi_remove_handle($this->_mh, $done['handle']); + curl_multi_remove_handle($this->_mh, $done['handle']); if (!isset($this->handles[$id])) { // Probably was cancelled. continue; @@ -161,18 +178,18 @@ private function processMessages() $entry = $this->handles[$id]; unset($this->handles[$id], $this->delays[$id]); $entry['easy']->errno = $done['result']; - $entry['deferred']->resolve(\_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\CurlFactory::finish($this, $entry['easy'], $this->factory)); + $entry['deferred']->resolve(CurlFactory::finish($this, $entry['easy'], $this->factory)); } } private function timeToNext() { - $currentTime = \_PhpScoper5ea00cc67502b\GuzzleHttp\Utils::currentTime(); - $nextTime = \PHP_INT_MAX; + $currentTime = Utils::currentTime(); + $nextTime = PHP_INT_MAX; foreach ($this->delays as $time) { if ($time < $nextTime) { $nextTime = $time; } } - return \max(0, $nextTime - $currentTime) * 1000000; + return max(0, $nextTime - $currentTime) * 1000000; } } diff --git a/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php b/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php index 275b2c1d4..fee9b013e 100644 --- a/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php +++ b/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php @@ -6,6 +6,15 @@ use _PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface; +use BadMethodCallException; +use Exception; +use RuntimeException; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\headers_from_lines; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\normalize_header_keys; +use function array_shift; +use function explode; +use function substr; + /** * Represents a cURL easy handle and the data it populates. * @@ -27,22 +36,22 @@ final class EasyHandle public $options = []; /** @var int cURL error number (if any) */ public $errno = 0; - /** @var \Exception Exception during on_headers (if any) */ + /** @var Exception Exception during on_headers (if any) */ public $onHeadersException; /** * Attach a response to the easy handle based on the received headers. * - * @throws \RuntimeException if no headers have been received. + * @throws RuntimeException if no headers have been received. */ public function createResponse() { if (empty($this->headers)) { - throw new \RuntimeException('No headers have been received'); + throw new RuntimeException('No headers have been received'); } // HTTP-version SP status-code SP reason-phrase - $startLine = \explode(' ', \array_shift($this->headers), 3); - $headers = \_PhpScoper5ea00cc67502b\GuzzleHttp\headers_from_lines($this->headers); - $normalizedKeys = \_PhpScoper5ea00cc67502b\GuzzleHttp\normalize_header_keys($headers); + $startLine = explode(' ', array_shift($this->headers), 3); + $headers = headers_from_lines($this->headers); + $normalizedKeys = normalize_header_keys($headers); if (!empty($this->options['decode_content']) && isset($normalizedKeys['content-encoding'])) { $headers['x-encoded-content-encoding'] = $headers[$normalizedKeys['content-encoding']]; unset($headers[$normalizedKeys['content-encoding']]); @@ -57,11 +66,11 @@ public function createResponse() } } // Attach a response to the easy handle with the parsed headers. - $this->response = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Response($startLine[1], $headers, $this->sink, \substr($startLine[0], 5), isset($startLine[2]) ? (string) $startLine[2] : null); + $this->response = new Response($startLine[1], $headers, $this->sink, substr($startLine[0], 5), isset($startLine[2]) ? (string) $startLine[2] : null); } public function __get($name) { $msg = $name === 'handle' ? 'The EasyHandle has been released' : 'Invalid property: ' . $name; - throw new \BadMethodCallException($msg); + throw new BadMethodCallException($msg); } } diff --git a/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php b/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php index a3f53ee1d..7c78ce57e 100644 --- a/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php +++ b/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php @@ -9,10 +9,31 @@ use _PhpScoper5ea00cc67502b\GuzzleHttp\TransferStats; use _PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface; +use _PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface; +use Countable; +use Exception; +use InvalidArgumentException; +use OutOfBoundsException; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\describe_type; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\Promise\promise_for; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\Promise\rejection_for; +use function array_shift; +use function call_user_func; +use function call_user_func_array; +use function count; +use function file_put_contents; +use function func_get_args; +use function fwrite; +use function is_callable; +use function is_numeric; +use function is_resource; +use function is_string; +use function usleep; + /** * Handler that returns responses or throw exceptions from a queue. */ -class MockHandler implements \Countable +class MockHandler implements Countable { private $queue = []; private $lastRequest; @@ -31,7 +52,7 @@ class MockHandler implements \Countable */ public static function createWithMiddleware(array $queue = null, callable $onFulfilled = null, callable $onRejected = null) { - return \_PhpScoper5ea00cc67502b\GuzzleHttp\HandlerStack::create(new self($queue, $onFulfilled, $onRejected)); + return HandlerStack::create(new self($queue, $onFulfilled, $onRejected)); } /** * The passed in value must be an array of @@ -47,48 +68,48 @@ public function __construct(array $queue = null, callable $onFulfilled = null, c $this->onFulfilled = $onFulfilled; $this->onRejected = $onRejected; if ($queue) { - \call_user_func_array([$this, 'append'], $queue); + call_user_func_array([$this, 'append'], $queue); } } - public function __invoke(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options) + public function __invoke(RequestInterface $request, array $options) { if (!$this->queue) { - throw new \OutOfBoundsException('Mock queue is empty'); + throw new OutOfBoundsException('Mock queue is empty'); } - if (isset($options['delay']) && \is_numeric($options['delay'])) { - \usleep($options['delay'] * 1000); + if (isset($options['delay']) && is_numeric($options['delay'])) { + usleep($options['delay'] * 1000); } $this->lastRequest = $request; $this->lastOptions = $options; - $response = \array_shift($this->queue); + $response = array_shift($this->queue); if (isset($options['on_headers'])) { - if (!\is_callable($options['on_headers'])) { - throw new \InvalidArgumentException('on_headers must be callable'); + if (!is_callable($options['on_headers'])) { + throw new InvalidArgumentException('on_headers must be callable'); } try { $options['on_headers']($response); - } catch (\Exception $e) { + } catch (Exception $e) { $msg = 'An error was encountered during the on_headers event'; - $response = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\RequestException($msg, $request, $response, $e); + $response = new RequestException($msg, $request, $response, $e); } } - if (\is_callable($response)) { - $response = \call_user_func($response, $request, $options); + if (is_callable($response)) { + $response = call_user_func($response, $request, $options); } - $response = $response instanceof \Exception ? \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\rejection_for($response) : \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\promise_for($response); + $response = $response instanceof Exception ? rejection_for($response) : promise_for($response); return $response->then(function ($value) use($request, $options) { $this->invokeStats($request, $options, $value); if ($this->onFulfilled) { - \call_user_func($this->onFulfilled, $value); + call_user_func($this->onFulfilled, $value); } if (isset($options['sink'])) { $contents = (string) $value->getBody(); $sink = $options['sink']; - if (\is_resource($sink)) { - \fwrite($sink, $contents); - } elseif (\is_string($sink)) { - \file_put_contents($sink, $contents); - } elseif ($sink instanceof \_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface) { + if (is_resource($sink)) { + fwrite($sink, $contents); + } elseif (is_string($sink)) { + file_put_contents($sink, $contents); + } elseif ($sink instanceof StreamInterface) { $sink->write($contents); } } @@ -96,9 +117,9 @@ public function __invoke(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterf }, function ($reason) use($request, $options) { $this->invokeStats($request, $options, null, $reason); if ($this->onRejected) { - \call_user_func($this->onRejected, $reason); + call_user_func($this->onRejected, $reason); } - return \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\rejection_for($reason); + return rejection_for($reason); }); } /** @@ -107,11 +128,11 @@ public function __invoke(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterf */ public function append() { - foreach (\func_get_args() as $value) { - if ($value instanceof \_PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface || $value instanceof \Exception || $value instanceof \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface || \is_callable($value)) { + foreach (func_get_args() as $value) { + if ($value instanceof ResponseInterface || $value instanceof Exception || $value instanceof PromiseInterface || is_callable($value)) { $this->queue[] = $value; } else { - throw new \InvalidArgumentException('Expected a response or ' . 'exception. Found ' . \_PhpScoper5ea00cc67502b\GuzzleHttp\describe_type($value)); + throw new InvalidArgumentException('Expected a response or ' . 'exception. Found ' . describe_type($value)); } } } @@ -140,18 +161,18 @@ public function getLastOptions() */ public function count() { - return \count($this->queue); + return count($this->queue); } public function reset() { $this->queue = []; } - private function invokeStats(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options, \_PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface $response = null, $reason = null) + private function invokeStats(RequestInterface $request, array $options, ResponseInterface $response = null, $reason = null) { if (isset($options['on_stats'])) { $transferTime = isset($options['transfer_time']) ? $options['transfer_time'] : 0; - $stats = new \_PhpScoper5ea00cc67502b\GuzzleHttp\TransferStats($request, $response, $transferTime, $reason); - \call_user_func($options['on_stats'], $stats); + $stats = new TransferStats($request, $response, $transferTime, $reason); + call_user_func($options['on_stats'], $stats); } } } diff --git a/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php b/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php index 99e0871aa..e66d9bc20 100644 --- a/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php +++ b/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php @@ -20,8 +20,8 @@ class Proxy */ public static function wrapSync(callable $default, callable $sync) { - return function (\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options) use($default, $sync) { - return empty($options[\_PhpScoper5ea00cc67502b\GuzzleHttp\RequestOptions::SYNCHRONOUS]) ? $default($request, $options) : $sync($request, $options); + return function (RequestInterface $request, array $options) use($default, $sync) { + return empty($options[RequestOptions::SYNCHRONOUS]) ? $default($request, $options) : $sync($request, $options); }; } /** @@ -39,7 +39,7 @@ public static function wrapSync(callable $default, callable $sync) */ public static function wrapStreaming(callable $default, callable $streaming) { - return function (\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options) use($default, $streaming) { + return function (RequestInterface $request, array $options) use($default, $streaming) { return empty($options['stream']) ? $default($request, $options) : $streaming($request, $options); }; } diff --git a/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php b/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php index 18bd33393..f44007141 100644 --- a/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php +++ b/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php @@ -7,11 +7,70 @@ use _PhpScoper5ea00cc67502b\GuzzleHttp\Promise\FulfilledPromise; use _PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface; use _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7; +use _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\InflateStream; +use _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\LazyOpenStream; +use _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Response; use _PhpScoper5ea00cc67502b\GuzzleHttp\TransferStats; use _PhpScoper5ea00cc67502b\GuzzleHttp\Utils; use _PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface; +use Exception; +use InvalidArgumentException; +use RuntimeException; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\debug_resource; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\default_ca_bundle; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\headers_from_lines; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\is_host_in_noproxy; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\normalize_header_keys; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\Promise\rejection_for; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\copy_to_stream; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\stream_for; +use function array_filter; +use function array_flip; +use function array_replace_recursive; +use function array_shift; +use function call_user_func; +use function call_user_func_array; +use function dns_get_record; +use function explode; +use function file_exists; +use function filter_var; +use function fopen; +use function fprintf; +use function func_get_args; +use function fwrite; +use function get_class_methods; +use function is_array; +use function is_callable; +use function is_string; +use function restore_error_handler; +use function rtrim; +use function set_error_handler; +use function sprintf; +use function strcasecmp; +use function stream_context_create; +use function stream_set_timeout; +use function strlen; +use function strpos; +use function trim; +use function usleep; +use const DNS_A; +use const DNS_AAAA; +use const FILTER_VALIDATE_IP; +use const PHP_EOL; +use const PHP_VERSION_ID; +use const STREAM_NOTIFY_AUTH_REQUIRED; +use const STREAM_NOTIFY_AUTH_RESULT; +use const STREAM_NOTIFY_COMPLETED; +use const STREAM_NOTIFY_CONNECT; +use const STREAM_NOTIFY_FAILURE; +use const STREAM_NOTIFY_FILE_SIZE_IS; +use const STREAM_NOTIFY_MIME_TYPE_IS; +use const STREAM_NOTIFY_PROGRESS; +use const STREAM_NOTIFY_REDIRECTED; +use const STREAM_NOTIFY_RESOLVE; + /** * HTTP handler that uses PHP's HTTP stream wrapper. */ @@ -26,13 +85,13 @@ class StreamHandler * * @return PromiseInterface */ - public function __invoke(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options) + public function __invoke(RequestInterface $request, array $options) { // Sleep if there is a delay specified. if (isset($options['delay'])) { - \usleep($options['delay'] * 1000); + usleep($options['delay'] * 1000); } - $startTime = isset($options['on_stats']) ? \_PhpScoper5ea00cc67502b\GuzzleHttp\Utils::currentTime() : null; + $startTime = isset($options['on_stats']) ? Utils::currentTime() : null; try { // Does not support the expect header. $request = $request->withoutHeader('Expect'); @@ -42,50 +101,50 @@ public function __invoke(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterf $request = $request->withHeader('Content-Length', '0'); } return $this->createResponse($request, $options, $this->createStream($request, $options), $startTime); - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { throw $e; - } catch (\Exception $e) { + } catch (Exception $e) { // Determine if the error was a networking error. $message = $e->getMessage(); // This list can probably get more comprehensive. - if (\strpos($message, 'getaddrinfo') || \strpos($message, 'Connection refused') || \strpos($message, "couldn't connect to host") || \strpos($message, "connection attempt failed")) { - $e = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\ConnectException($e->getMessage(), $request, $e); + if (strpos($message, 'getaddrinfo') || strpos($message, 'Connection refused') || strpos($message, "couldn't connect to host") || strpos($message, "connection attempt failed")) { + $e = new ConnectException($e->getMessage(), $request, $e); } - $e = \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\RequestException::wrapException($request, $e); + $e = RequestException::wrapException($request, $e); $this->invokeStats($options, $request, $startTime, null, $e); - return \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\rejection_for($e); + return rejection_for($e); } } - private function invokeStats(array $options, \_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, $startTime, \_PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface $response = null, $error = null) + private function invokeStats(array $options, RequestInterface $request, $startTime, ResponseInterface $response = null, $error = null) { if (isset($options['on_stats'])) { - $stats = new \_PhpScoper5ea00cc67502b\GuzzleHttp\TransferStats($request, $response, \_PhpScoper5ea00cc67502b\GuzzleHttp\Utils::currentTime() - $startTime, $error, []); - \call_user_func($options['on_stats'], $stats); + $stats = new TransferStats($request, $response, Utils::currentTime() - $startTime, $error, []); + call_user_func($options['on_stats'], $stats); } } - private function createResponse(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options, $stream, $startTime) + private function createResponse(RequestInterface $request, array $options, $stream, $startTime) { $hdrs = $this->lastHeaders; $this->lastHeaders = []; - $parts = \explode(' ', \array_shift($hdrs), 3); - $ver = \explode('/', $parts[0])[1]; + $parts = explode(' ', array_shift($hdrs), 3); + $ver = explode('/', $parts[0])[1]; $status = $parts[1]; $reason = isset($parts[2]) ? $parts[2] : null; - $headers = \_PhpScoper5ea00cc67502b\GuzzleHttp\headers_from_lines($hdrs); - list($stream, $headers) = $this->checkDecode($options, $headers, $stream); - $stream = \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\stream_for($stream); + $headers = headers_from_lines($hdrs); + [$stream, $headers] = $this->checkDecode($options, $headers, $stream); + $stream = stream_for($stream); $sink = $stream; - if (\strcasecmp('HEAD', $request->getMethod())) { + if (strcasecmp('HEAD', $request->getMethod())) { $sink = $this->createSink($stream, $options); } - $response = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Response($status, $headers, $sink, $ver, $reason); + $response = new Response($status, $headers, $sink, $ver, $reason); if (isset($options['on_headers'])) { try { $options['on_headers']($response); - } catch (\Exception $e) { + } catch (Exception $e) { $msg = 'An error was encountered during the on_headers event'; - $ex = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\RequestException($msg, $request, $response, $e); - return \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\rejection_for($ex); + $ex = new RequestException($msg, $request, $response, $e); + return rejection_for($ex); } } // Do not drain when the request is a HEAD request because they have @@ -94,25 +153,25 @@ private function createResponse(\_PhpScoper5ea00cc67502b\Psr\Http\Message\Reques $this->drain($stream, $sink, $response->getHeaderLine('Content-Length')); } $this->invokeStats($options, $request, $startTime, $response, null); - return new \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\FulfilledPromise($response); + return new FulfilledPromise($response); } - private function createSink(\_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface $stream, array $options) + private function createSink(StreamInterface $stream, array $options) { if (!empty($options['stream'])) { return $stream; } - $sink = isset($options['sink']) ? $options['sink'] : \fopen('php://temp', 'r+'); - return \is_string($sink) ? new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\LazyOpenStream($sink, 'w+') : \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\stream_for($sink); + $sink = isset($options['sink']) ? $options['sink'] : fopen('php://temp', 'r+'); + return is_string($sink) ? new LazyOpenStream($sink, 'w+') : stream_for($sink); } private function checkDecode(array $options, array $headers, $stream) { // Automatically decode responses when instructed. if (!empty($options['decode_content'])) { - $normalizedKeys = \_PhpScoper5ea00cc67502b\GuzzleHttp\normalize_header_keys($headers); + $normalizedKeys = normalize_header_keys($headers); if (isset($normalizedKeys['content-encoding'])) { $encoding = $headers[$normalizedKeys['content-encoding']]; if ($encoding[0] === 'gzip' || $encoding[0] === 'deflate') { - $stream = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\InflateStream(\_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\stream_for($stream)); + $stream = new InflateStream(stream_for($stream)); $headers['x-encoded-content-encoding'] = $headers[$normalizedKeys['content-encoding']]; // Remove content-encoding header unset($headers[$normalizedKeys['content-encoding']]); @@ -140,15 +199,15 @@ private function checkDecode(array $options, array $headers, $stream) * data to read. * * @return StreamInterface - * @throws \RuntimeException when the sink option is invalid. + * @throws RuntimeException when the sink option is invalid. */ - private function drain(\_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface $source, \_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface $sink, $contentLength) + private function drain(StreamInterface $source, StreamInterface $sink, $contentLength) { // If a content-length header is provided, then stop reading once // that number of bytes has been read. This can prevent infinitely // reading from a stream when dealing with servers that do not honor // Connection: Close headers. - \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\copy_to_stream($source, $sink, \strlen($contentLength) > 0 && (int) $contentLength > 0 ? (int) $contentLength : -1); + copy_to_stream($source, $sink, strlen($contentLength) > 0 && (int) $contentLength > 0 ? (int) $contentLength : -1); $sink->seek(0); $source->close(); return $sink; @@ -159,33 +218,33 @@ private function drain(\_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface * @param callable $callback Callable that returns stream resource * * @return resource - * @throws \RuntimeException on error + * @throws RuntimeException on error */ private function createResource(callable $callback) { $errors = null; - \set_error_handler(function ($_, $msg, $file, $line) use(&$errors) { + set_error_handler(function ($_, $msg, $file, $line) use(&$errors) { $errors[] = ['message' => $msg, 'file' => $file, 'line' => $line]; - return \true; + return true; }); $resource = $callback(); - \restore_error_handler(); + restore_error_handler(); if (!$resource) { $message = 'Error creating resource: '; foreach ($errors as $err) { foreach ($err as $key => $value) { - $message .= "[{$key}] {$value}" . \PHP_EOL; + $message .= "[{$key}] {$value}" . PHP_EOL; } } - throw new \RuntimeException(\trim($message)); + throw new RuntimeException(trim($message)); } return $resource; } - private function createStream(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options) + private function createStream(RequestInterface $request, array $options) { static $methods; if (!$methods) { - $methods = \array_flip(\get_class_methods(__CLASS__)); + $methods = array_flip(get_class_methods(__CLASS__)); } // HTTP/1.1 streams using the PHP stream wrapper require a // Connection: close header @@ -194,12 +253,12 @@ private function createStream(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestI } // Ensure SSL is verified by default if (!isset($options['verify'])) { - $options['verify'] = \true; + $options['verify'] = true; } $params = []; $context = $this->getDefaultContext($request); - if (isset($options['on_headers']) && !\is_callable($options['on_headers'])) { - throw new \InvalidArgumentException('on_headers must be callable'); + if (isset($options['on_headers']) && !is_callable($options['on_headers'])) { + throw new InvalidArgumentException('on_headers must be callable'); } if (!empty($options)) { foreach ($options as $key => $value) { @@ -210,52 +269,52 @@ private function createStream(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestI } } if (isset($options['stream_context'])) { - if (!\is_array($options['stream_context'])) { - throw new \InvalidArgumentException('stream_context must be an array'); + if (!is_array($options['stream_context'])) { + throw new InvalidArgumentException('stream_context must be an array'); } - $context = \array_replace_recursive($context, $options['stream_context']); + $context = array_replace_recursive($context, $options['stream_context']); } // Microsoft NTLM authentication only supported with curl handler - if (isset($options['auth']) && \is_array($options['auth']) && isset($options['auth'][2]) && 'ntlm' == $options['auth'][2]) { - throw new \InvalidArgumentException('Microsoft NTLM authentication only supported with curl handler'); + if (isset($options['auth']) && is_array($options['auth']) && isset($options['auth'][2]) && 'ntlm' == $options['auth'][2]) { + throw new InvalidArgumentException('Microsoft NTLM authentication only supported with curl handler'); } $uri = $this->resolveHost($request, $options); $context = $this->createResource(function () use($context, $params) { - return \stream_context_create($context, $params); + return stream_context_create($context, $params); }); return $this->createResource(function () use($uri, &$http_response_header, $context, $options) { - $resource = \fopen((string) $uri, 'r', null, $context); + $resource = fopen((string) $uri, 'r', null, $context); $this->lastHeaders = $http_response_header; if (isset($options['read_timeout'])) { $readTimeout = $options['read_timeout']; $sec = (int) $readTimeout; $usec = ($readTimeout - $sec) * 100000; - \stream_set_timeout($resource, $sec, $usec); + stream_set_timeout($resource, $sec, $usec); } return $resource; }); } - private function resolveHost(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options) + private function resolveHost(RequestInterface $request, array $options) { $uri = $request->getUri(); - if (isset($options['force_ip_resolve']) && !\filter_var($uri->getHost(), \FILTER_VALIDATE_IP)) { + if (isset($options['force_ip_resolve']) && !filter_var($uri->getHost(), FILTER_VALIDATE_IP)) { if ('v4' === $options['force_ip_resolve']) { - $records = \dns_get_record($uri->getHost(), \DNS_A); + $records = dns_get_record($uri->getHost(), DNS_A); if (!isset($records[0]['ip'])) { - throw new \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\ConnectException(\sprintf("Could not resolve IPv4 address for host '%s'", $uri->getHost()), $request); + throw new ConnectException(sprintf("Could not resolve IPv4 address for host '%s'", $uri->getHost()), $request); } $uri = $uri->withHost($records[0]['ip']); } elseif ('v6' === $options['force_ip_resolve']) { - $records = \dns_get_record($uri->getHost(), \DNS_AAAA); + $records = dns_get_record($uri->getHost(), DNS_AAAA); if (!isset($records[0]['ipv6'])) { - throw new \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\ConnectException(\sprintf("Could not resolve IPv6 address for host '%s'", $uri->getHost()), $request); + throw new ConnectException(sprintf("Could not resolve IPv6 address for host '%s'", $uri->getHost()), $request); } $uri = $uri->withHost('[' . $records[0]['ipv6'] . ']'); } } return $uri; } - private function getDefaultContext(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request) + private function getDefaultContext(RequestInterface $request) { $headers = ''; foreach ($request->getHeaders() as $name => $value) { @@ -263,7 +322,7 @@ private function getDefaultContext(\_PhpScoper5ea00cc67502b\Psr\Http\Message\Req $headers .= "{$name}: {$val}\r\n"; } } - $context = ['http' => ['method' => $request->getMethod(), 'header' => $headers, 'protocol_version' => $request->getProtocolVersion(), 'ignore_errors' => \true, 'follow_location' => 0]]; + $context = ['http' => ['method' => $request->getMethod(), 'header' => $headers, 'protocol_version' => $request->getProtocolVersion(), 'ignore_errors' => true, 'follow_location' => 0]]; $body = (string) $request->getBody(); if (!empty($body)) { $context['http']['content'] = $body; @@ -272,88 +331,88 @@ private function getDefaultContext(\_PhpScoper5ea00cc67502b\Psr\Http\Message\Req $context['http']['header'] .= "Content-Type:\r\n"; } } - $context['http']['header'] = \rtrim($context['http']['header']); + $context['http']['header'] = rtrim($context['http']['header']); return $context; } - private function add_proxy(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, &$options, $value, &$params) + private function add_proxy(RequestInterface $request, &$options, $value, &$params) { - if (!\is_array($value)) { + if (!is_array($value)) { $options['http']['proxy'] = $value; } else { $scheme = $request->getUri()->getScheme(); if (isset($value[$scheme])) { - if (!isset($value['no']) || !\_PhpScoper5ea00cc67502b\GuzzleHttp\is_host_in_noproxy($request->getUri()->getHost(), $value['no'])) { + if (!isset($value['no']) || !is_host_in_noproxy($request->getUri()->getHost(), $value['no'])) { $options['http']['proxy'] = $value[$scheme]; } } } } - private function add_timeout(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, &$options, $value, &$params) + private function add_timeout(RequestInterface $request, &$options, $value, &$params) { if ($value > 0) { $options['http']['timeout'] = $value; } } - private function add_verify(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, &$options, $value, &$params) + private function add_verify(RequestInterface $request, &$options, $value, &$params) { - if ($value === \true) { + if ($value === true) { // PHP 5.6 or greater will find the system cert by default. When // < 5.6, use the Guzzle bundled cacert. - if (\PHP_VERSION_ID < 50600) { - $options['ssl']['cafile'] = \_PhpScoper5ea00cc67502b\GuzzleHttp\default_ca_bundle(); + if (PHP_VERSION_ID < 50600) { + $options['ssl']['cafile'] = default_ca_bundle(); } - } elseif (\is_string($value)) { + } elseif (is_string($value)) { $options['ssl']['cafile'] = $value; - if (!\file_exists($value)) { - throw new \RuntimeException("SSL CA bundle not found: {$value}"); + if (!file_exists($value)) { + throw new RuntimeException("SSL CA bundle not found: {$value}"); } - } elseif ($value === \false) { - $options['ssl']['verify_peer'] = \false; - $options['ssl']['verify_peer_name'] = \false; + } elseif ($value === false) { + $options['ssl']['verify_peer'] = false; + $options['ssl']['verify_peer_name'] = false; return; } else { - throw new \InvalidArgumentException('Invalid verify request option'); + throw new InvalidArgumentException('Invalid verify request option'); } - $options['ssl']['verify_peer'] = \true; - $options['ssl']['verify_peer_name'] = \true; - $options['ssl']['allow_self_signed'] = \false; + $options['ssl']['verify_peer'] = true; + $options['ssl']['verify_peer_name'] = true; + $options['ssl']['allow_self_signed'] = false; } - private function add_cert(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, &$options, $value, &$params) + private function add_cert(RequestInterface $request, &$options, $value, &$params) { - if (\is_array($value)) { + if (is_array($value)) { $options['ssl']['passphrase'] = $value[1]; $value = $value[0]; } - if (!\file_exists($value)) { - throw new \RuntimeException("SSL certificate not found: {$value}"); + if (!file_exists($value)) { + throw new RuntimeException("SSL certificate not found: {$value}"); } $options['ssl']['local_cert'] = $value; } - private function add_progress(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, &$options, $value, &$params) + private function add_progress(RequestInterface $request, &$options, $value, &$params) { $this->addNotification($params, function ($code, $a, $b, $c, $transferred, $total) use($value) { - if ($code == \STREAM_NOTIFY_PROGRESS) { + if ($code == STREAM_NOTIFY_PROGRESS) { $value($total, $transferred, null, null); } }); } - private function add_debug(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, &$options, $value, &$params) + private function add_debug(RequestInterface $request, &$options, $value, &$params) { - if ($value === \false) { + if ($value === false) { return; } - static $map = [\STREAM_NOTIFY_CONNECT => 'CONNECT', \STREAM_NOTIFY_AUTH_REQUIRED => 'AUTH_REQUIRED', \STREAM_NOTIFY_AUTH_RESULT => 'AUTH_RESULT', \STREAM_NOTIFY_MIME_TYPE_IS => 'MIME_TYPE_IS', \STREAM_NOTIFY_FILE_SIZE_IS => 'FILE_SIZE_IS', \STREAM_NOTIFY_REDIRECTED => 'REDIRECTED', \STREAM_NOTIFY_PROGRESS => 'PROGRESS', \STREAM_NOTIFY_FAILURE => 'FAILURE', \STREAM_NOTIFY_COMPLETED => 'COMPLETED', \STREAM_NOTIFY_RESOLVE => 'RESOLVE']; + static $map = [STREAM_NOTIFY_CONNECT => 'CONNECT', STREAM_NOTIFY_AUTH_REQUIRED => 'AUTH_REQUIRED', STREAM_NOTIFY_AUTH_RESULT => 'AUTH_RESULT', STREAM_NOTIFY_MIME_TYPE_IS => 'MIME_TYPE_IS', STREAM_NOTIFY_FILE_SIZE_IS => 'FILE_SIZE_IS', STREAM_NOTIFY_REDIRECTED => 'REDIRECTED', STREAM_NOTIFY_PROGRESS => 'PROGRESS', STREAM_NOTIFY_FAILURE => 'FAILURE', STREAM_NOTIFY_COMPLETED => 'COMPLETED', STREAM_NOTIFY_RESOLVE => 'RESOLVE']; static $args = ['severity', 'message', 'message_code', 'bytes_transferred', 'bytes_max']; - $value = \_PhpScoper5ea00cc67502b\GuzzleHttp\debug_resource($value); + $value = debug_resource($value); $ident = $request->getMethod() . ' ' . $request->getUri()->withFragment(''); $this->addNotification($params, function () use($ident, $value, $map, $args) { - $passed = \func_get_args(); - $code = \array_shift($passed); - \fprintf($value, '<%s> [%s] ', $ident, $map[$code]); - foreach (\array_filter($passed) as $i => $v) { - \fwrite($value, $args[$i] . ': "' . $v . '" '); + $passed = func_get_args(); + $code = array_shift($passed); + fprintf($value, '<%s> [%s] ', $ident, $map[$code]); + foreach (array_filter($passed) as $i => $v) { + fwrite($value, $args[$i] . ': "' . $v . '" '); } - \fwrite($value, "\n"); + fwrite($value, "\n"); }); } private function addNotification(array &$params, callable $notify) @@ -368,9 +427,9 @@ private function addNotification(array &$params, callable $notify) private function callArray(array $functions) { return function () use($functions) { - $args = \func_get_args(); + $args = func_get_args(); foreach ($functions as $fn) { - \call_user_func_array($fn, $args); + call_user_func_array($fn, $args); } }; } diff --git a/vendor/guzzlehttp/guzzle/src/Handler/index.php b/vendor/guzzlehttp/guzzle/src/Handler/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Handler/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/guzzlehttp/guzzle/src/HandlerStack.php b/vendor/guzzlehttp/guzzle/src/HandlerStack.php index 8dfb7d650..f91da6dc5 100644 --- a/vendor/guzzlehttp/guzzle/src/HandlerStack.php +++ b/vendor/guzzlehttp/guzzle/src/HandlerStack.php @@ -5,6 +5,21 @@ use _PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface; +use InvalidArgumentException; +use LogicException; +use function array_filter; +use function array_keys; +use function array_reverse; +use function array_splice; +use function array_unshift; +use function array_values; +use function count; +use function get_class; +use function is_array; +use function is_callable; +use function is_string; +use function spl_object_hash; + /** * Creates a composed Guzzle handler function by stacking middlewares on top of * an HTTP handler function. @@ -37,10 +52,10 @@ class HandlerStack public static function create(callable $handler = null) { $stack = new self($handler ?: choose_handler()); - $stack->push(\_PhpScoper5ea00cc67502b\GuzzleHttp\Middleware::httpErrors(), 'http_errors'); - $stack->push(\_PhpScoper5ea00cc67502b\GuzzleHttp\Middleware::redirect(), 'allow_redirects'); - $stack->push(\_PhpScoper5ea00cc67502b\GuzzleHttp\Middleware::cookies(), 'cookies'); - $stack->push(\_PhpScoper5ea00cc67502b\GuzzleHttp\Middleware::prepareBody(), 'prepare_body'); + $stack->push(Middleware::httpErrors(), 'http_errors'); + $stack->push(Middleware::redirect(), 'allow_redirects'); + $stack->push(Middleware::cookies(), 'cookies'); + $stack->push(Middleware::prepareBody(), 'prepare_body'); return $stack; } /** @@ -58,7 +73,7 @@ public function __construct(callable $handler = null) * * @return ResponseInterface|PromiseInterface */ - public function __invoke(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options) + public function __invoke(RequestInterface $request, array $options) { $handler = $this->resolve(); return $handler($request, $options); @@ -76,14 +91,14 @@ public function __toString() $stack[] = "0) Handler: " . $this->debugCallable($this->handler); } $result = ''; - foreach (\array_reverse($this->stack) as $tuple) { + foreach (array_reverse($this->stack) as $tuple) { $depth++; $str = "{$depth}) Name: '{$tuple[1]}', "; $str .= "Function: " . $this->debugCallable($tuple[0]); $result = "> {$str}\n{$result}"; $stack[] = $str; } - foreach (\array_keys($stack) as $k) { + foreach (array_keys($stack) as $k) { $result .= "< {$stack[$k]}\n"; } return $result; @@ -116,7 +131,7 @@ public function hasHandler() */ public function unshift(callable $middleware, $name = null) { - \array_unshift($this->stack, [$middleware, $name]); + array_unshift($this->stack, [$middleware, $name]); $this->cached = null; } /** @@ -139,7 +154,7 @@ public function push(callable $middleware, $name = '') */ public function before($findName, callable $middleware, $withName = '') { - $this->splice($findName, $withName, $middleware, \true); + $this->splice($findName, $withName, $middleware, true); } /** * Add a middleware after another middleware by name. @@ -150,7 +165,7 @@ public function before($findName, callable $middleware, $withName = '') */ public function after($findName, callable $middleware, $withName = '') { - $this->splice($findName, $withName, $middleware, \false); + $this->splice($findName, $withName, $middleware, false); } /** * Remove a middleware by instance or name from the stack. @@ -160,8 +175,8 @@ public function after($findName, callable $middleware, $withName = '') public function remove($remove) { $this->cached = null; - $idx = \is_callable($remove) ? 0 : 1; - $this->stack = \array_values(\array_filter($this->stack, function ($tuple) use($idx, $remove) { + $idx = is_callable($remove) ? 0 : 1; + $this->stack = array_values(array_filter($this->stack, function ($tuple) use($idx, $remove) { return $tuple[$idx] !== $remove; })); } @@ -174,9 +189,9 @@ public function resolve() { if (!$this->cached) { if (!($prev = $this->handler)) { - throw new \LogicException('No handler has been specified'); + throw new LogicException('No handler has been specified'); } - foreach (\array_reverse($this->stack) as $fn) { + foreach (array_reverse($this->stack) as $fn) { $prev = $fn[0]($prev); } $this->cached = $prev; @@ -194,7 +209,7 @@ private function findByName($name) return $k; } } - throw new \InvalidArgumentException("Middleware not found: {$name}"); + throw new InvalidArgumentException("Middleware not found: {$name}"); } /** * Splices a function into the middleware list at a specific position. @@ -211,16 +226,16 @@ private function splice($findName, $withName, callable $middleware, $before) $tuple = [$middleware, $withName]; if ($before) { if ($idx === 0) { - \array_unshift($this->stack, $tuple); + array_unshift($this->stack, $tuple); } else { $replacement = [$tuple, $this->stack[$idx]]; - \array_splice($this->stack, $idx, 1, $replacement); + array_splice($this->stack, $idx, 1, $replacement); } - } elseif ($idx === \count($this->stack) - 1) { + } elseif ($idx === count($this->stack) - 1) { $this->stack[] = $tuple; } else { $replacement = [$this->stack[$idx], $tuple]; - \array_splice($this->stack, $idx, 1, $replacement); + array_splice($this->stack, $idx, 1, $replacement); } } /** @@ -232,12 +247,12 @@ private function splice($findName, $withName, callable $middleware, $before) */ private function debugCallable($fn) { - if (\is_string($fn)) { + if (is_string($fn)) { return "callable({$fn})"; } - if (\is_array($fn)) { - return \is_string($fn[0]) ? "callable({$fn[0]}::{$fn[1]})" : "callable(['" . \get_class($fn[0]) . "', '{$fn[1]}'])"; + if (is_array($fn)) { + return is_string($fn[0]) ? "callable({$fn[0]}::{$fn[1]})" : "callable(['" . get_class($fn[0]) . "', '{$fn[1]}'])"; } - return 'callable(' . \spl_object_hash($fn) . ')'; + return 'callable(' . spl_object_hash($fn) . ')'; } } diff --git a/vendor/guzzlehttp/guzzle/src/MessageFormatter.php b/vendor/guzzlehttp/guzzle/src/MessageFormatter.php index f5ca563c6..cc3f76c31 100644 --- a/vendor/guzzlehttp/guzzle/src/MessageFormatter.php +++ b/vendor/guzzlehttp/guzzle/src/MessageFormatter.php @@ -5,6 +5,18 @@ use _PhpScoper5ea00cc67502b\Psr\Http\Message\MessageInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface; +use Exception; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\str; +use function date; +use function gethostname; +use function gmdate; +use function implode; +use function preg_replace_callback; +use function sprintf; +use function strpos; +use function substr; +use function trim; + /** * Formats log messages using variable substitutions for requests, responses, * and other transactional data. @@ -56,30 +68,30 @@ public function __construct($template = self::CLF) * * @param RequestInterface $request Request that was sent * @param ResponseInterface $response Response that was received - * @param \Exception $error Exception that was received + * @param Exception $error Exception that was received * * @return string */ - public function format(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, \_PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface $response = null, \Exception $error = null) + public function format(RequestInterface $request, ResponseInterface $response = null, Exception $error = null) { $cache = []; - return \preg_replace_callback('/{\\s*([A-Za-z_\\-\\.0-9]+)\\s*}/', function (array $matches) use($request, $response, $error, &$cache) { + return preg_replace_callback('/{\\s*([A-Za-z_\\-\\.0-9]+)\\s*}/', function (array $matches) use($request, $response, $error, &$cache) { if (isset($cache[$matches[1]])) { return $cache[$matches[1]]; } $result = ''; switch ($matches[1]) { case 'request': - $result = \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\str($request); + $result = str($request); break; case 'response': - $result = $response ? \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\str($response) : ''; + $result = $response ? str($response) : ''; break; case 'req_headers': - $result = \trim($request->getMethod() . ' ' . $request->getRequestTarget()) . ' HTTP/' . $request->getProtocolVersion() . "\r\n" . $this->headers($request); + $result = trim($request->getMethod() . ' ' . $request->getRequestTarget()) . ' HTTP/' . $request->getProtocolVersion() . "\r\n" . $this->headers($request); break; case 'res_headers': - $result = $response ? \sprintf('HTTP/%s %d %s', $response->getProtocolVersion(), $response->getStatusCode(), $response->getReasonPhrase()) . "\r\n" . $this->headers($response) : 'NULL'; + $result = $response ? sprintf('HTTP/%s %d %s', $response->getProtocolVersion(), $response->getStatusCode(), $response->getReasonPhrase()) . "\r\n" . $this->headers($response) : 'NULL'; break; case 'req_body': $result = $request->getBody(); @@ -89,10 +101,10 @@ public function format(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterfac break; case 'ts': case 'date_iso_8601': - $result = \gmdate('c'); + $result = gmdate('c'); break; case 'date_common_log': - $result = \date('d/M/Y:H:i:s O'); + $result = date('d/M/Y:H:i:s O'); break; case 'method': $result = $request->getMethod(); @@ -117,7 +129,7 @@ public function format(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterfac $result = $request->getHeaderLine('Host'); break; case 'hostname': - $result = \gethostname(); + $result = gethostname(); break; case 'code': $result = $response ? $response->getStatusCode() : 'NULL'; @@ -130,10 +142,10 @@ public function format(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterfac break; default: // handle prefixed dynamic headers - if (\strpos($matches[1], 'req_header_') === 0) { - $result = $request->getHeaderLine(\substr($matches[1], 11)); - } elseif (\strpos($matches[1], 'res_header_') === 0) { - $result = $response ? $response->getHeaderLine(\substr($matches[1], 11)) : 'NULL'; + if (strpos($matches[1], 'req_header_') === 0) { + $result = $request->getHeaderLine(substr($matches[1], 11)); + } elseif (strpos($matches[1], 'res_header_') === 0) { + $result = $response ? $response->getHeaderLine(substr($matches[1], 11)) : 'NULL'; } } $cache[$matches[1]] = $result; @@ -145,12 +157,12 @@ public function format(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterfac * * @return string */ - private function headers(\_PhpScoper5ea00cc67502b\Psr\Http\Message\MessageInterface $message) + private function headers(MessageInterface $message) { $result = ''; foreach ($message->getHeaders() as $name => $values) { - $result .= $name . ': ' . \implode(', ', $values) . "\r\n"; + $result .= $name . ': ' . implode(', ', $values) . "\r\n"; } - return \trim($result); + return trim($result); } } diff --git a/vendor/guzzlehttp/guzzle/src/Middleware.php b/vendor/guzzlehttp/guzzle/src/Middleware.php index 44f5ef25f..882b273e0 100644 --- a/vendor/guzzlehttp/guzzle/src/Middleware.php +++ b/vendor/guzzlehttp/guzzle/src/Middleware.php @@ -8,6 +8,11 @@ use _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7; use _PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface; use _PhpScoper5ea00cc67502b\Psr\Log\LoggerInterface; +use ArrayAccess; +use InvalidArgumentException; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\Promise\rejection_for; +use function is_array; + /** * Functions used to create and wrap handlers with handler middleware. */ @@ -27,8 +32,8 @@ public static function cookies() return function ($request, array $options) use($handler) { if (empty($options['cookies'])) { return $handler($request, $options); - } elseif (!$options['cookies'] instanceof \_PhpScoper5ea00cc67502b\GuzzleHttp\Cookie\CookieJarInterface) { - throw new \InvalidArgumentException('_PhpScoper5ea00cc67502b\\cookies must be an instance of GuzzleHttp\\Cookie\\CookieJarInterface'); + } elseif (!$options['cookies'] instanceof CookieJarInterface) { + throw new InvalidArgumentException('_PhpScoper5ea00cc67502b\\cookies must be an instance of GuzzleHttp\\Cookie\\CookieJarInterface'); } $cookieJar = $options['cookies']; $request = $cookieJar->withCookieHeader($request); @@ -52,12 +57,12 @@ public static function httpErrors() if (empty($options['http_errors'])) { return $handler($request, $options); } - return $handler($request, $options)->then(function (\_PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface $response) use($request) { + return $handler($request, $options)->then(function (ResponseInterface $response) use($request) { $code = $response->getStatusCode(); if ($code < 400) { return $response; } - throw \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\RequestException::create($request, $response); + throw RequestException::create($request, $response); }); }; }; @@ -65,15 +70,15 @@ public static function httpErrors() /** * Middleware that pushes history data to an ArrayAccess container. * - * @param array|\ArrayAccess $container Container to hold the history (by reference). + * @param array|ArrayAccess $container Container to hold the history (by reference). * * @return callable Returns a function that accepts the next handler. - * @throws \InvalidArgumentException if container is not an array or ArrayAccess. + * @throws InvalidArgumentException if container is not an array or ArrayAccess. */ public static function history(&$container) { - if (!\is_array($container) && !$container instanceof \ArrayAccess) { - throw new \InvalidArgumentException('history container must be an array or object implementing ArrayAccess'); + if (!is_array($container) && !$container instanceof ArrayAccess) { + throw new InvalidArgumentException('history container must be an array or object implementing ArrayAccess'); } return function (callable $handler) use(&$container) { return function ($request, array $options) use($handler, &$container) { @@ -82,7 +87,7 @@ public static function history(&$container) return $value; }, function ($reason) use($request, &$container, $options) { $container[] = ['request' => $request, 'response' => null, 'error' => $reason, 'options' => $options]; - return \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\rejection_for($reason); + return rejection_for($reason); }); }; }; @@ -123,7 +128,7 @@ public static function tap(callable $before = null, callable $after = null) public static function redirect() { return function (callable $handler) { - return new \_PhpScoper5ea00cc67502b\GuzzleHttp\RedirectMiddleware($handler); + return new RedirectMiddleware($handler); }; } /** @@ -144,7 +149,7 @@ public static function redirect() public static function retry(callable $decider, callable $delay = null) { return function (callable $handler) use($decider, $delay) { - return new \_PhpScoper5ea00cc67502b\GuzzleHttp\RetryMiddleware($decider, $handler, $delay); + return new RetryMiddleware($decider, $handler, $delay); }; } /** @@ -157,7 +162,7 @@ public static function retry(callable $decider, callable $delay = null) * * @return callable Returns a function that accepts the next handler. */ - public static function log(\_PhpScoper5ea00cc67502b\Psr\Log\LoggerInterface $logger, \_PhpScoper5ea00cc67502b\GuzzleHttp\MessageFormatter $formatter, $logLevel = 'info') + public static function log(LoggerInterface $logger, MessageFormatter $formatter, $logLevel = 'info') { return function (callable $handler) use($logger, $formatter, $logLevel) { return function ($request, array $options) use($handler, $logger, $formatter, $logLevel) { @@ -166,10 +171,10 @@ public static function log(\_PhpScoper5ea00cc67502b\Psr\Log\LoggerInterface $log $logger->log($logLevel, $message); return $response; }, function ($reason) use($logger, $request, $formatter) { - $response = $reason instanceof \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\RequestException ? $reason->getResponse() : null; + $response = $reason instanceof RequestException ? $reason->getResponse() : null; $message = $formatter->format($request, $response, $reason); $logger->notice($message); - return \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\rejection_for($reason); + return rejection_for($reason); }); }; }; @@ -183,7 +188,7 @@ public static function log(\_PhpScoper5ea00cc67502b\Psr\Log\LoggerInterface $log public static function prepareBody() { return function (callable $handler) { - return new \_PhpScoper5ea00cc67502b\GuzzleHttp\PrepareBodyMiddleware($handler); + return new PrepareBodyMiddleware($handler); }; } /** diff --git a/vendor/guzzlehttp/guzzle/src/Pool.php b/vendor/guzzlehttp/guzzle/src/Pool.php index c9c199bab..47c30c31e 100644 --- a/vendor/guzzlehttp/guzzle/src/Pool.php +++ b/vendor/guzzlehttp/guzzle/src/Pool.php @@ -6,6 +6,12 @@ use _PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface; use _PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromisorInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface; +use InvalidArgumentException; +use Iterator; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\Promise\iter_for; +use function is_callable; +use function ksort; + /** * Sends an iterator of requests concurrently using a capped pool size. * @@ -17,13 +23,13 @@ * "request_options" array that should be merged on top of any existing * options, and the function MUST then return a wait-able promise. */ -class Pool implements \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromisorInterface +class Pool implements PromisorInterface { /** @var EachPromise */ private $each; /** * @param ClientInterface $client Client used to send the requests. - * @param array|\Iterator $requests Requests or functions that return + * @param array|Iterator $requests Requests or functions that return * requests to send concurrently. * @param array $config Associative array of options * - concurrency: (int) Maximum number of requests to send concurrently @@ -31,7 +37,7 @@ class Pool implements \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromisorInterf * - fulfilled: (callable) Function to invoke when a request completes. * - rejected: (callable) Function to invoke when a request is rejected. */ - public function __construct(\_PhpScoper5ea00cc67502b\GuzzleHttp\ClientInterface $client, $requests, array $config = []) + public function __construct(ClientInterface $client, $requests, array $config = []) { // Backwards compatibility. if (isset($config['pool_size'])) { @@ -45,19 +51,19 @@ public function __construct(\_PhpScoper5ea00cc67502b\GuzzleHttp\ClientInterface } else { $opts = []; } - $iterable = \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\iter_for($requests); + $iterable = iter_for($requests); $requests = function () use($iterable, $client, $opts) { foreach ($iterable as $key => $rfn) { - if ($rfn instanceof \_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface) { + if ($rfn instanceof RequestInterface) { (yield $key => $client->sendAsync($rfn, $opts)); - } elseif (\is_callable($rfn)) { + } elseif (is_callable($rfn)) { (yield $key => $rfn($opts)); } else { - throw new \InvalidArgumentException('Each value yielded by ' . 'the iterator must be a Psr7\\Http\\Message\\RequestInterface ' . 'or a callable that returns a promise that fulfills ' . 'with a Psr7\\Message\\Http\\ResponseInterface object.'); + throw new InvalidArgumentException('Each value yielded by ' . 'the iterator must be a Psr7\\Http\\Message\\RequestInterface ' . 'or a callable that returns a promise that fulfills ' . 'with a Psr7\\Message\\Http\\ResponseInterface object.'); } } }; - $this->each = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\EachPromise($requests(), $config); + $this->each = new EachPromise($requests(), $config); } /** * Get promise @@ -77,22 +83,22 @@ public function promise() * indeterminate number of requests concurrently. * * @param ClientInterface $client Client used to send the requests - * @param array|\Iterator $requests Requests to send concurrently. + * @param array|Iterator $requests Requests to send concurrently. * @param array $options Passes through the options available in * {@see GuzzleHttp\Pool::__construct} * * @return array Returns an array containing the response or an exception * in the same order that the requests were sent. - * @throws \InvalidArgumentException if the event format is incorrect. + * @throws InvalidArgumentException if the event format is incorrect. */ - public static function batch(\_PhpScoper5ea00cc67502b\GuzzleHttp\ClientInterface $client, $requests, array $options = []) + public static function batch(ClientInterface $client, $requests, array $options = []) { $res = []; self::cmpCallback($options, 'fulfilled', $res); self::cmpCallback($options, 'rejected', $res); $pool = new static($client, $requests, $options); $pool->promise()->wait(); - \ksort($res); + ksort($res); return $res; } /** diff --git a/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php b/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php index 77b724f18..6e79efa5f 100644 --- a/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php +++ b/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php @@ -5,6 +5,9 @@ use _PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface; use _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7; use _PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\mimetype_from_filename; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\modify_request; + /** * Prepares requests that contain a body, adding the Content-Length, * Content-Type, and Expect headers. @@ -26,7 +29,7 @@ public function __construct(callable $nextHandler) * * @return PromiseInterface */ - public function __invoke(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options) + public function __invoke(RequestInterface $request, array $options) { $fn = $this->nextHandler; // Don't do anything if the request has no body. @@ -37,7 +40,7 @@ public function __invoke(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterf // Add a default content-type if possible. if (!$request->hasHeader('Content-Type')) { if ($uri = $request->getBody()->getMetadata('uri')) { - if ($type = \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\mimetype_from_filename($uri)) { + if ($type = mimetype_from_filename($uri)) { $modify['set_headers']['Content-Type'] = $type; } } @@ -53,14 +56,14 @@ public function __invoke(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterf } // Add the expect header if needed. $this->addExpectHeader($request, $options, $modify); - return $fn(\_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\modify_request($request, $modify), $options); + return $fn(modify_request($request, $modify), $options); } /** * Add expect header * * @return void */ - private function addExpectHeader(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options, array &$modify) + private function addExpectHeader(RequestInterface $request, array $options, array &$modify) { // Determine if the Expect header should be used if ($request->hasHeader('Expect')) { @@ -68,11 +71,11 @@ private function addExpectHeader(\_PhpScoper5ea00cc67502b\Psr\Http\Message\Reque } $expect = isset($options['expect']) ? $options['expect'] : null; // Return if disabled or if you're not using HTTP/1.1 or HTTP/2.0 - if ($expect === \false || $request->getProtocolVersion() < 1.1) { + if ($expect === false || $request->getProtocolVersion() < 1.1) { return; } // The expect header is unconditionally enabled - if ($expect === \true) { + if ($expect === true) { $modify['set_headers']['Expect'] = '100-Continue'; return; } diff --git a/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php b/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php index 3810f2194..52d911c35 100644 --- a/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php +++ b/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php @@ -6,9 +6,23 @@ use _PhpScoper5ea00cc67502b\GuzzleHttp\Exception\TooManyRedirectsException; use _PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface; use _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7; +use _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Uri; +use _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\UriResolver; use _PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface; +use InvalidArgumentException; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\modify_request; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\rewind_body; +use function array_unshift; +use function call_user_func; +use function implode; +use function in_array; +use function is_array; +use function sprintf; +use function substr; +use const IDNA_DEFAULT; + /** * Request redirect middleware. * @@ -19,7 +33,7 @@ class RedirectMiddleware { const HISTORY_HEADER = 'X-Guzzle-Redirect-History'; const STATUS_HISTORY_HEADER = 'X-Guzzle-Redirect-Status-History'; - public static $defaultSettings = ['max' => 5, 'protocols' => ['http', 'https'], 'strict' => \false, 'referer' => \false, 'track_redirects' => \false]; + public static $defaultSettings = ['max' => 5, 'protocols' => ['http', 'https'], 'strict' => false, 'referer' => false, 'track_redirects' => false]; /** @var callable */ private $nextHandler; /** @@ -35,16 +49,16 @@ public function __construct(callable $nextHandler) * * @return PromiseInterface */ - public function __invoke(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options) + public function __invoke(RequestInterface $request, array $options) { $fn = $this->nextHandler; if (empty($options['allow_redirects'])) { return $fn($request, $options); } - if ($options['allow_redirects'] === \true) { + if ($options['allow_redirects'] === true) { $options['allow_redirects'] = self::$defaultSettings; - } elseif (!\is_array($options['allow_redirects'])) { - throw new \InvalidArgumentException('allow_redirects must be true, false, or array'); + } elseif (!is_array($options['allow_redirects'])) { + throw new InvalidArgumentException('allow_redirects must be true, false, or array'); } else { // Merge the default settings with the provided settings $options['allow_redirects'] += self::$defaultSettings; @@ -52,7 +66,7 @@ public function __invoke(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterf if (empty($options['allow_redirects']['max'])) { return $fn($request, $options); } - return $fn($request, $options)->then(function (\_PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface $response) use($request, $options) { + return $fn($request, $options)->then(function (ResponseInterface $response) use($request, $options) { return $this->checkRedirect($request, $options, $response); }); } @@ -63,15 +77,15 @@ public function __invoke(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterf * * @return ResponseInterface|PromiseInterface */ - public function checkRedirect(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options, \_PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface $response) + public function checkRedirect(RequestInterface $request, array $options, ResponseInterface $response) { - if (\substr($response->getStatusCode(), 0, 1) != '3' || !$response->hasHeader('Location')) { + if (substr($response->getStatusCode(), 0, 1) != '3' || !$response->hasHeader('Location')) { return $response; } $this->guardMax($request, $options); $nextRequest = $this->modifyRequest($request, $options, $response); if (isset($options['allow_redirects']['on_redirect'])) { - \call_user_func($options['allow_redirects']['on_redirect'], $request, $response, $nextRequest->getUri()); + call_user_func($options['allow_redirects']['on_redirect'], $request, $response, $nextRequest->getUri()); } /** @var PromiseInterface|ResponseInterface $promise */ $promise = $this($nextRequest, $options); @@ -86,16 +100,16 @@ public function checkRedirect(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestI * * @return PromiseInterface */ - private function withTracking(\_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface $promise, $uri, $statusCode) + private function withTracking(PromiseInterface $promise, $uri, $statusCode) { - return $promise->then(function (\_PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface $response) use($uri, $statusCode) { + return $promise->then(function (ResponseInterface $response) use($uri, $statusCode) { // Note that we are pushing to the front of the list as this // would be an earlier response than what is currently present // in the history header. $historyHeader = $response->getHeader(self::HISTORY_HEADER); $statusHeader = $response->getHeader(self::STATUS_HISTORY_HEADER); - \array_unshift($historyHeader, $uri); - \array_unshift($statusHeader, $statusCode); + array_unshift($historyHeader, $uri); + array_unshift($statusHeader, $statusCode); return $response->withHeader(self::HISTORY_HEADER, $historyHeader)->withHeader(self::STATUS_HISTORY_HEADER, $statusHeader); }); } @@ -106,13 +120,13 @@ private function withTracking(\_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\Promis * * @throws TooManyRedirectsException Too many redirects. */ - private function guardMax(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array &$options) + private function guardMax(RequestInterface $request, array &$options) { $current = isset($options['__redirect_count']) ? $options['__redirect_count'] : 0; $options['__redirect_count'] = $current + 1; $max = $options['allow_redirects']['max']; if ($options['__redirect_count'] > $max) { - throw new \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\TooManyRedirectsException("Will not follow more than {$max} redirects", $request); + throw new TooManyRedirectsException("Will not follow more than {$max} redirects", $request); } } /** @@ -122,7 +136,7 @@ private function guardMax(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInter * * @return RequestInterface */ - public function modifyRequest(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options, \_PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface $response) + public function modifyRequest(RequestInterface $request, array $options, ResponseInterface $response) { // Request modifications to apply. $modify = []; @@ -136,12 +150,12 @@ public function modifyRequest(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestI $modify['body'] = ''; } $uri = $this->redirectUri($request, $response, $protocols); - if (isset($options['idn_conversion']) && $options['idn_conversion'] !== \false) { - $idnOptions = $options['idn_conversion'] === \true ? \IDNA_DEFAULT : $options['idn_conversion']; - $uri = \_PhpScoper5ea00cc67502b\GuzzleHttp\Utils::idnUriConvert($uri, $idnOptions); + if (isset($options['idn_conversion']) && $options['idn_conversion'] !== false) { + $idnOptions = $options['idn_conversion'] === true ? IDNA_DEFAULT : $options['idn_conversion']; + $uri = Utils::idnUriConvert($uri, $idnOptions); } $modify['uri'] = $uri; - \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\rewind_body($request); + rewind_body($request); // Add the Referer header if it is told to do so and only // add the header if we are not redirecting from https to http. if ($options['allow_redirects']['referer'] && $modify['uri']->getScheme() === $request->getUri()->getScheme()) { @@ -154,7 +168,7 @@ public function modifyRequest(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestI if ($request->getUri()->getHost() !== $modify['uri']->getHost()) { $modify['remove_headers'][] = 'Authorization'; } - return \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\modify_request($request, $modify); + return modify_request($request, $modify); } /** * Set the appropriate URL on the request based on the location header @@ -165,12 +179,12 @@ public function modifyRequest(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestI * * @return UriInterface */ - private function redirectUri(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, \_PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface $response, array $protocols) + private function redirectUri(RequestInterface $request, ResponseInterface $response, array $protocols) { - $location = \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\UriResolver::resolve($request->getUri(), new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Uri($response->getHeaderLine('Location'))); + $location = UriResolver::resolve($request->getUri(), new Uri($response->getHeaderLine('Location'))); // Ensure that the redirect URI is allowed based on the protocols. - if (!\in_array($location->getScheme(), $protocols)) { - throw new \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\BadResponseException(\sprintf('Redirect URI, %s, does not use one of the allowed redirect protocols: %s', $location, \implode(', ', $protocols)), $request, $response); + if (!in_array($location->getScheme(), $protocols)) { + throw new BadResponseException(sprintf('Redirect URI, %s, does not use one of the allowed redirect protocols: %s', $location, implode(', ', $protocols)), $request, $response); } return $location; } diff --git a/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php b/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php index 15d1af6f4..53baed98d 100644 --- a/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php +++ b/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php @@ -7,6 +7,10 @@ use _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7; use _PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface; +use function _PhpScoper5ea00cc67502b\GuzzleHttp\Promise\rejection_for; +use function call_user_func; +use function pow; + /** * Middleware that retries requests based on the boolean result of * invoking the provided "decider" function. @@ -44,7 +48,7 @@ public function __construct(callable $decider, callable $nextHandler, callable $ */ public static function exponentialDelay($retries) { - return (int) \pow(2, $retries - 1) * 1000; + return (int) pow(2, $retries - 1) * 1000; } /** * @param RequestInterface $request @@ -52,7 +56,7 @@ public static function exponentialDelay($retries) * * @return PromiseInterface */ - public function __invoke(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options) + public function __invoke(RequestInterface $request, array $options) { if (!isset($options['retries'])) { $options['retries'] = 0; @@ -65,10 +69,10 @@ public function __invoke(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterf * * @return mixed */ - private function onFulfilled(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $req, array $options) + private function onFulfilled(RequestInterface $req, array $options) { return function ($value) use($req, $options) { - if (!\call_user_func($this->decider, $options['retries'], $req, $value, null)) { + if (!call_user_func($this->decider, $options['retries'], $req, $value, null)) { return $value; } return $this->doRetry($req, $options, $value); @@ -79,11 +83,11 @@ private function onFulfilled(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestIn * * @return callable */ - private function onRejected(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $req, array $options) + private function onRejected(RequestInterface $req, array $options) { return function ($reason) use($req, $options) { - if (!\call_user_func($this->decider, $options['retries'], $req, null, $reason)) { - return \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\rejection_for($reason); + if (!call_user_func($this->decider, $options['retries'], $req, null, $reason)) { + return rejection_for($reason); } return $this->doRetry($req, $options); }; @@ -91,9 +95,9 @@ private function onRejected(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInt /** * @return self */ - private function doRetry(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $options, \_PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface $response = null) + private function doRetry(RequestInterface $request, array $options, ResponseInterface $response = null) { - $options['delay'] = \call_user_func($this->delay, ++$options['retries'], $response); + $options['delay'] = call_user_func($this->delay, ++$options['retries'], $response); return $this($request, $options); } } diff --git a/vendor/guzzlehttp/guzzle/src/TransferStats.php b/vendor/guzzlehttp/guzzle/src/TransferStats.php index 0ddfae30c..38dd05a21 100644 --- a/vendor/guzzlehttp/guzzle/src/TransferStats.php +++ b/vendor/guzzlehttp/guzzle/src/TransferStats.php @@ -23,7 +23,7 @@ final class TransferStats * @param mixed $handlerErrorData Handler error data. * @param array $handlerStats Handler specific stats. */ - public function __construct(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, \_PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface $response = null, $transferTime = null, $handlerErrorData = null, $handlerStats = []) + public function __construct(RequestInterface $request, ResponseInterface $response = null, $transferTime = null, $handlerErrorData = null, $handlerStats = []) { $this->request = $request; $this->response = $response; diff --git a/vendor/guzzlehttp/guzzle/src/UriTemplate.php b/vendor/guzzlehttp/guzzle/src/UriTemplate.php index 26db9396f..9761a35d4 100644 --- a/vendor/guzzlehttp/guzzle/src/UriTemplate.php +++ b/vendor/guzzlehttp/guzzle/src/UriTemplate.php @@ -2,6 +2,19 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp; +use function array_keys; +use function explode; +use function http_build_query; +use function implode; +use function is_array; +use function preg_replace_callback; +use function rawurlencode; +use function str_replace; +use function strpos; +use function strtr; +use function substr; +use function trim; + /** * Expands URI templates. Userland implementation of PECL uri_template. * @@ -14,19 +27,19 @@ class UriTemplate /** @var array Variables to use in the template expansion */ private $variables; /** @var array Hash for quick operator lookups */ - private static $operatorHash = ['' => ['prefix' => '', 'joiner' => ',', 'query' => \false], '+' => ['prefix' => '', 'joiner' => ',', 'query' => \false], '#' => ['prefix' => '#', 'joiner' => ',', 'query' => \false], '.' => ['prefix' => '.', 'joiner' => '.', 'query' => \false], '/' => ['prefix' => '/', 'joiner' => '/', 'query' => \false], ';' => ['prefix' => ';', 'joiner' => ';', 'query' => \true], '?' => ['prefix' => '?', 'joiner' => '&', 'query' => \true], '&' => ['prefix' => '&', 'joiner' => '&', 'query' => \true]]; + private static $operatorHash = ['' => ['prefix' => '', 'joiner' => ',', 'query' => false], '+' => ['prefix' => '', 'joiner' => ',', 'query' => false], '#' => ['prefix' => '#', 'joiner' => ',', 'query' => false], '.' => ['prefix' => '.', 'joiner' => '.', 'query' => false], '/' => ['prefix' => '/', 'joiner' => '/', 'query' => false], ';' => ['prefix' => ';', 'joiner' => ';', 'query' => true], '?' => ['prefix' => '?', 'joiner' => '&', 'query' => true], '&' => ['prefix' => '&', 'joiner' => '&', 'query' => true]]; /** @var array Delimiters */ private static $delims = [':', '/', '?', '#', '[', ']', '@', '!', '$', '&', '\'', '(', ')', '*', '+', ',', ';', '=']; /** @var array Percent encoded delimiters */ private static $delimsPct = ['%3A', '%2F', '%3F', '%23', '%5B', '%5D', '%40', '%21', '%24', '%26', '%27', '%28', '%29', '%2A', '%2B', '%2C', '%3B', '%3D']; public function expand($template, array $variables) { - if (\false === \strpos($template, '{')) { + if (false === strpos($template, '{')) { return $template; } $this->template = $template; $this->variables = $variables; - return \preg_replace_callback('/\\{([^\\}]+)\\}/', [$this, 'expandMatch'], $this->template); + return preg_replace_callback('/\\{([^\\}]+)\\}/', [$this, 'expandMatch'], $this->template); } /** * Parse an expression into parts @@ -40,20 +53,20 @@ private function parseExpression($expression) $result = []; if (isset(self::$operatorHash[$expression[0]])) { $result['operator'] = $expression[0]; - $expression = \substr($expression, 1); + $expression = substr($expression, 1); } else { $result['operator'] = ''; } - foreach (\explode(',', $expression) as $value) { - $value = \trim($value); + foreach (explode(',', $expression) as $value) { + $value = trim($value); $varspec = []; - if ($colonPos = \strpos($value, ':')) { - $varspec['value'] = \substr($value, 0, $colonPos); + if ($colonPos = strpos($value, ':')) { + $varspec['value'] = substr($value, 0, $colonPos); $varspec['modifier'] = ':'; - $varspec['position'] = (int) \substr($value, $colonPos + 1); - } elseif (\substr($value, -1) === '*') { + $varspec['position'] = (int) substr($value, $colonPos + 1); + } elseif (substr($value, -1) === '*') { $varspec['modifier'] = '*'; - $varspec['value'] = \substr($value, 0, -1); + $varspec['value'] = substr($value, 0, -1); } else { $varspec['value'] = (string) $value; $varspec['modifier'] = ''; @@ -84,18 +97,18 @@ private function expandMatch(array $matches) $variable = $this->variables[$value['value']]; $actuallyUseQuery = $useQuery; $expanded = ''; - if (\is_array($variable)) { + if (is_array($variable)) { $isAssoc = $this->isAssoc($variable); $kvp = []; foreach ($variable as $key => $var) { if ($isAssoc) { - $key = \rawurlencode($key); - $isNestedArray = \is_array($var); + $key = rawurlencode($key); + $isNestedArray = is_array($var); } else { - $isNestedArray = \false; + $isNestedArray = false; } if (!$isNestedArray) { - $var = \rawurlencode($var); + $var = rawurlencode($var); if ($parsed['operator'] === '+' || $parsed['operator'] === '#') { $var = $this->decodeReserved($var); } @@ -105,7 +118,7 @@ private function expandMatch(array $matches) if ($isNestedArray) { // Nested arrays must allow for deeply nested // structures. - $var = \strtr(\http_build_query([$key => $var]), $rfc1738to3986); + $var = strtr(http_build_query([$key => $var]), $rfc1738to3986); } else { $var = $key . '=' . $var; } @@ -116,13 +129,13 @@ private function expandMatch(array $matches) $kvp[$key] = $var; } if (empty($variable)) { - $actuallyUseQuery = \false; + $actuallyUseQuery = false; } elseif ($value['modifier'] === '*') { - $expanded = \implode($joiner, $kvp); + $expanded = implode($joiner, $kvp); if ($isAssoc) { // Don't prepend the value name when using the explode // modifier with an associative array. - $actuallyUseQuery = \false; + $actuallyUseQuery = false; } } else { if ($isAssoc) { @@ -134,13 +147,13 @@ private function expandMatch(array $matches) $v = $k . ',' . $v; } } - $expanded = \implode(',', $kvp); + $expanded = implode(',', $kvp); } } else { if ($value['modifier'] === ':') { - $variable = \substr($variable, 0, $value['position']); + $variable = substr($variable, 0, $value['position']); } - $expanded = \rawurlencode($variable); + $expanded = rawurlencode($variable); if ($parsed['operator'] === '+' || $parsed['operator'] === '#') { $expanded = $this->decodeReserved($expanded); } @@ -154,7 +167,7 @@ private function expandMatch(array $matches) } $replacements[] = $expanded; } - $ret = \implode($joiner, $replacements); + $ret = implode($joiner, $replacements); if ($ret && $prefix) { return $prefix . $ret; } @@ -174,7 +187,7 @@ private function expandMatch(array $matches) */ private function isAssoc(array $array) { - return $array && \array_keys($array)[0] !== 0; + return $array && array_keys($array)[0] !== 0; } /** * Removes percent encoding on reserved characters (used with + and # @@ -186,6 +199,6 @@ private function isAssoc(array $array) */ private function decodeReserved($string) { - return \str_replace(self::$delimsPct, self::$delims, $string); + return str_replace(self::$delimsPct, self::$delims, $string); } } diff --git a/vendor/guzzlehttp/guzzle/src/Utils.php b/vendor/guzzlehttp/guzzle/src/Utils.php index fb8625fb6..3cb40ad4f 100644 --- a/vendor/guzzlehttp/guzzle/src/Utils.php +++ b/vendor/guzzlehttp/guzzle/src/Utils.php @@ -4,6 +4,18 @@ use _PhpScoper5ea00cc67502b\GuzzleHttp\Exception\InvalidArgumentException; use _PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface; +use function array_filter; +use function array_keys; +use function constant; +use function defined; +use function function_exists; +use function get_defined_constants; +use function idn_to_ascii; +use function implode; +use function microtime; +use function substr; +use const INTL_IDNA_VARIANT_UTS46; + final class Utils { /** @@ -16,7 +28,7 @@ final class Utils */ public static function currentTime() { - return \function_exists('_PhpScoper5ea00cc67502b\\hrtime') ? hrtime(\true) / 1000000000.0 : \microtime(\true); + return function_exists('_PhpScoper5ea00cc67502b\\hrtime') ? hrtime(true) / 1000000000.0 : microtime(true); } /** * @param int $options @@ -26,27 +38,27 @@ public static function currentTime() * * @internal */ - public static function idnUriConvert(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $uri, $options = 0) + public static function idnUriConvert(UriInterface $uri, $options = 0) { if ($uri->getHost()) { - $idnaVariant = \defined('INTL_IDNA_VARIANT_UTS46') ? \INTL_IDNA_VARIANT_UTS46 : 0; - $asciiHost = $idnaVariant === 0 ? \idn_to_ascii($uri->getHost(), $options) : \idn_to_ascii($uri->getHost(), $options, $idnaVariant, $info); - if ($asciiHost === \false) { + $idnaVariant = defined('INTL_IDNA_VARIANT_UTS46') ? INTL_IDNA_VARIANT_UTS46 : 0; + $asciiHost = $idnaVariant === 0 ? idn_to_ascii($uri->getHost(), $options) : idn_to_ascii($uri->getHost(), $options, $idnaVariant, $info); + if ($asciiHost === false) { $errorBitSet = isset($info['errors']) ? $info['errors'] : 0; - $errorConstants = \array_filter(\array_keys(\get_defined_constants()), function ($name) { - return \substr($name, 0, 11) === 'IDNA_ERROR_'; + $errorConstants = array_filter(array_keys(get_defined_constants()), function ($name) { + return substr($name, 0, 11) === 'IDNA_ERROR_'; }); $errors = []; foreach ($errorConstants as $errorConstant) { - if ($errorBitSet & \constant($errorConstant)) { + if ($errorBitSet & constant($errorConstant)) { $errors[] = $errorConstant; } } $errorMessage = 'IDN conversion failed'; if ($errors) { - $errorMessage .= ' (errors: ' . \implode(', ', $errors) . ')'; + $errorMessage .= ' (errors: ' . implode(', ', $errors) . ')'; } - throw new \_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\InvalidArgumentException($errorMessage); + throw new InvalidArgumentException($errorMessage); } else { if ($uri->getHost() !== $asciiHost) { // Replace URI only if the ASCII version is different diff --git a/vendor/guzzlehttp/guzzle/src/functions.php b/vendor/guzzlehttp/guzzle/src/functions.php index 11b72247a..a61c6f2e7 100644 --- a/vendor/guzzlehttp/guzzle/src/functions.php +++ b/vendor/guzzlehttp/guzzle/src/functions.php @@ -2,10 +2,42 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp; +use _PhpScoper5ea00cc67502b\GuzzleHttp\Exception\InvalidArgumentException; use _PhpScoper5ea00cc67502b\GuzzleHttp\Handler\CurlHandler; use _PhpScoper5ea00cc67502b\GuzzleHttp\Handler\CurlMultiHandler; use _PhpScoper5ea00cc67502b\GuzzleHttp\Handler\Proxy; use _PhpScoper5ea00cc67502b\GuzzleHttp\Handler\StreamHandler; +use RuntimeException; +use function array_keys; +use function count; +use function curl_version; +use function defined; +use function explode; +use function extension_loaded; +use function file_exists; +use function fopen; +use function function_exists; +use function get_class; +use function gettype; +use function ini_get; +use function is_resource; +use function json_last_error; +use function json_last_error_msg; +use function ltrim; +use function ob_get_clean; +use function ob_start; +use function rtrim; +use function str_replace; +use function strlen; +use function strpos; +use function strtolower; +use function substr; +use function trim; +use function var_dump; +use const JSON_ERROR_NONE; +use const PHP_VERSION; +use const STDOUT; + /** * Expands a URI template * @@ -16,14 +48,14 @@ */ function uri_template($template, array $variables) { - if (\extension_loaded('uri_template')) { + if (extension_loaded('uri_template')) { // @codeCoverageIgnoreStart return \_PhpScoper5ea00cc67502b\uri_template($template, $variables); // @codeCoverageIgnoreEnd } static $uriTemplate; if (!$uriTemplate) { - $uriTemplate = new \_PhpScoper5ea00cc67502b\GuzzleHttp\UriTemplate(); + $uriTemplate = new UriTemplate(); } return $uriTemplate->expand($template, $variables); } @@ -37,16 +69,16 @@ function uri_template($template, array $variables) */ function describe_type($input) { - switch (\gettype($input)) { + switch (gettype($input)) { case 'object': - return 'object(' . \get_class($input) . ')'; + return 'object(' . get_class($input) . ')'; case 'array': - return 'array(' . \count($input) . ')'; + return 'array(' . count($input) . ')'; default: - \ob_start(); - \var_dump($input); + ob_start(); + var_dump($input); // normalize float vs double - return \str_replace('double(', 'float(', \rtrim(\ob_get_clean())); + return str_replace('double(', 'float(', rtrim(ob_get_clean())); } } /** @@ -60,8 +92,8 @@ function headers_from_lines($lines) { $headers = []; foreach ($lines as $line) { - $parts = \explode(':', $line, 2); - $headers[\trim($parts[0])][] = isset($parts[1]) ? \trim($parts[1]) : null; + $parts = explode(':', $line, 2); + $headers[trim($parts[0])][] = isset($parts[1]) ? trim($parts[1]) : null; } return $headers; } @@ -74,12 +106,12 @@ function headers_from_lines($lines) */ function debug_resource($value = null) { - if (\is_resource($value)) { + if (is_resource($value)) { return $value; - } elseif (\defined('STDOUT')) { - return \STDOUT; + } elseif (defined('STDOUT')) { + return STDOUT; } - return \fopen('php://output', 'w'); + return fopen('php://output', 'w'); } /** * Chooses and creates a default handler to use based on the environment. @@ -87,22 +119,22 @@ function debug_resource($value = null) * The returned handler is not wrapped by any default middlewares. * * @return callable Returns the best handler for the given system. - * @throws \RuntimeException if no viable Handler is available. + * @throws RuntimeException if no viable Handler is available. */ function choose_handler() { $handler = null; - if (\function_exists('curl_multi_exec') && \function_exists('curl_exec')) { - $handler = \_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\Proxy::wrapSync(new \_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\CurlMultiHandler(), new \_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\CurlHandler()); - } elseif (\function_exists('curl_exec')) { - $handler = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\CurlHandler(); - } elseif (\function_exists('curl_multi_exec')) { - $handler = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\CurlMultiHandler(); + if (function_exists('curl_multi_exec') && function_exists('curl_exec')) { + $handler = Proxy::wrapSync(new CurlMultiHandler(), new CurlHandler()); + } elseif (function_exists('curl_exec')) { + $handler = new CurlHandler(); + } elseif (function_exists('curl_multi_exec')) { + $handler = new CurlMultiHandler(); } - if (\ini_get('allow_url_fopen')) { - $handler = $handler ? \_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\Proxy::wrapStreaming($handler, new \_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\StreamHandler()) : new \_PhpScoper5ea00cc67502b\GuzzleHttp\Handler\StreamHandler(); + if (ini_get('allow_url_fopen')) { + $handler = $handler ? Proxy::wrapStreaming($handler, new StreamHandler()) : new StreamHandler(); } elseif (!$handler) { - throw new \RuntimeException('GuzzleHttp requires cURL, the ' . 'allow_url_fopen ini setting, or a custom HTTP handler.'); + throw new RuntimeException('GuzzleHttp requires cURL, the ' . 'allow_url_fopen ini setting, or a custom HTTP handler.'); } return $handler; } @@ -115,11 +147,11 @@ function default_user_agent() { static $defaultAgent = ''; if (!$defaultAgent) { - $defaultAgent = 'GuzzleHttp/' . \_PhpScoper5ea00cc67502b\GuzzleHttp\Client::VERSION; - if (\extension_loaded('curl') && \function_exists('curl_version')) { - $defaultAgent .= ' curl/' . \curl_version()['version']; + $defaultAgent = 'GuzzleHttp/' . Client::VERSION; + if (extension_loaded('curl') && function_exists('curl_version')) { + $defaultAgent .= ' curl/' . curl_version()['version']; } - $defaultAgent .= ' PHP/' . \PHP_VERSION; + $defaultAgent .= ' PHP/' . PHP_VERSION; } return $defaultAgent; } @@ -135,7 +167,7 @@ function default_user_agent() * Note: the result of this function is cached for subsequent calls. * * @return string - * @throws \RuntimeException if no bundle can be found. + * @throws RuntimeException if no bundle can be found. */ function default_ca_bundle() { @@ -160,18 +192,18 @@ function default_ca_bundle() if ($cached) { return $cached; } - if ($ca = \ini_get('openssl.cafile')) { + if ($ca = ini_get('openssl.cafile')) { return $cached = $ca; } - if ($ca = \ini_get('curl.cainfo')) { + if ($ca = ini_get('curl.cainfo')) { return $cached = $ca; } foreach ($cafiles as $filename) { - if (\file_exists($filename)) { + if (file_exists($filename)) { return $cached = $filename; } } - throw new \RuntimeException(<< +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/guzzlehttp/index.php b/vendor/guzzlehttp/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/guzzlehttp/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/guzzlehttp/promises/README.md b/vendor/guzzlehttp/promises/README.md index 7b607e28b..da8d6f400 100644 --- a/vendor/guzzlehttp/promises/README.md +++ b/vendor/guzzlehttp/promises/README.md @@ -150,7 +150,7 @@ use GuzzleHttp\Promise\Promise; $promise = new Promise(); $promise->then(null, function ($reason) { - throw new \Exception($reason); + throw new Exception($reason); })->then(null, function ($reason) { assert($reason->getMessage() === 'Error!'); }); @@ -220,7 +220,7 @@ the promise is rejected with the exception and the exception is thrown. ```php $promise = new Promise(function () use (&$promise) { - throw new \Exception('foo'); + throw new Exception('foo'); }); $promise->wait(); // throws the exception. @@ -397,7 +397,7 @@ $deferred = new React\Promise\Deferred(); $reactPromise = $deferred->promise(); // Create a Guzzle promise that is fulfilled with a React promise. -$guzzlePromise = new \GuzzleHttp\Promise\Promise(); +$guzzlePromise = new Promise(); $guzzlePromise->then(function ($value) use ($reactPromise) { // Do something something with the value... // Return the React promise @@ -424,7 +424,7 @@ instance. ```php // Get the global task queue -$queue = \GuzzleHttp\Promise\queue(); +use function GuzzleHttp\Promise\queue;$queue = queue(); $queue->run(); ``` diff --git a/vendor/guzzlehttp/promises/index.php b/vendor/guzzlehttp/promises/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/guzzlehttp/promises/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/guzzlehttp/promises/src/AggregateException.php b/vendor/guzzlehttp/promises/src/AggregateException.php index b1c95676b..9dc9b5ad0 100644 --- a/vendor/guzzlehttp/promises/src/AggregateException.php +++ b/vendor/guzzlehttp/promises/src/AggregateException.php @@ -2,13 +2,16 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Promise; +use function count; +use function sprintf; + /** * Exception thrown when too many errors occur in the some() or any() methods. */ -class AggregateException extends \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\RejectionException +class AggregateException extends RejectionException { public function __construct($msg, array $reasons) { - parent::__construct($reasons, \sprintf('%s; %d rejected promises', $msg, \count($reasons))); + parent::__construct($reasons, sprintf('%s; %d rejected promises', $msg, count($reasons))); } } diff --git a/vendor/guzzlehttp/promises/src/CancellationException.php b/vendor/guzzlehttp/promises/src/CancellationException.php index 47f8835dd..d8ac3bbc8 100644 --- a/vendor/guzzlehttp/promises/src/CancellationException.php +++ b/vendor/guzzlehttp/promises/src/CancellationException.php @@ -5,6 +5,6 @@ /** * Exception that is set as the reason for a promise that has been cancelled. */ -class CancellationException extends \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\RejectionException +class CancellationException extends RejectionException { } diff --git a/vendor/guzzlehttp/promises/src/Coroutine.php b/vendor/guzzlehttp/promises/src/Coroutine.php index ac2b68970..0234d6b02 100644 --- a/vendor/guzzlehttp/promises/src/Coroutine.php +++ b/vendor/guzzlehttp/promises/src/Coroutine.php @@ -40,7 +40,7 @@ * @return Promise * @link https://github.com/petkaantonov/bluebird/blob/master/API.md#generators inspiration */ -final class Coroutine implements \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface +final class Coroutine implements PromiseInterface { /** * @var PromiseInterface|null @@ -57,7 +57,7 @@ final class Coroutine implements \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\Pro public function __construct(callable $generatorFn) { $this->generator = $generatorFn(); - $this->result = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\Promise(function () { + $this->result = new Promise(function () { while (isset($this->currentPromise)) { $this->currentPromise->wait(); } @@ -72,7 +72,7 @@ public function otherwise(callable $onRejected) { return $this->result->otherwise($onRejected); } - public function wait($unwrap = \true) + public function wait($unwrap = true) { return $this->result->wait($unwrap); } @@ -110,9 +110,9 @@ public function _handleSuccess($value) } else { $this->result->resolve($value); } - } catch (\Exception $exception) { + } catch (Exception $exception) { $this->result->reject($exception); - } catch (\Throwable $throwable) { + } catch (Throwable $throwable) { $this->result->reject($throwable); } } @@ -126,9 +126,9 @@ public function _handleFailure($reason) $nextYield = $this->generator->throw(exception_for($reason)); // The throw was caught, so keep iterating on the coroutine $this->nextCoroutine($nextYield); - } catch (\Exception $exception) { + } catch (Exception $exception) { $this->result->reject($exception); - } catch (\Throwable $throwable) { + } catch (Throwable $throwable) { $this->result->reject($throwable); } } diff --git a/vendor/guzzlehttp/promises/src/EachPromise.php b/vendor/guzzlehttp/promises/src/EachPromise.php index 578d8bf1d..6d5d4576e 100644 --- a/vendor/guzzlehttp/promises/src/EachPromise.php +++ b/vendor/guzzlehttp/promises/src/EachPromise.php @@ -2,14 +2,25 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Promise; +use Exception; +use Iterator; +use Throwable; +use function call_user_func; +use function count; +use function current; +use function is_callable; +use function max; +use function next; +use function reset; + /** * Represents a promise that iterates over many promises and invokes * side-effect functions in the process. */ -class EachPromise implements \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromisorInterface +class EachPromise implements PromisorInterface { private $pending = []; - /** @var \Iterator */ + /** @var Iterator */ private $iterable; /** @var callable|int */ private $concurrency; @@ -64,28 +75,28 @@ public function promise() $this->createPromise(); $this->iterable->rewind(); $this->refillPending(); - } catch (\Throwable $e) { + } catch (Throwable $e) { $this->aggregate->reject($e); - } catch (\Exception $e) { + } catch (Exception $e) { $this->aggregate->reject($e); } return $this->aggregate; } private function createPromise() { - $this->mutex = \false; - $this->aggregate = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\Promise(function () { - \reset($this->pending); + $this->mutex = false; + $this->aggregate = new Promise(function () { + reset($this->pending); if (empty($this->pending) && !$this->iterable->valid()) { $this->aggregate->resolve(null); return; } // Consume a potentially fluctuating list of promises while // ensuring that indexes are maintained (precluding array_shift). - while ($promise = \current($this->pending)) { - \next($this->pending); + while ($promise = current($this->pending)) { + next($this->pending); $promise->wait(); - if ($this->aggregate->getState() !== \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface::PENDING) { + if ($this->aggregate->getState() !== PromiseInterface::PENDING) { return; } } @@ -106,8 +117,8 @@ private function refillPending() return; } // Add only up to N pending promises. - $concurrency = \is_callable($this->concurrency) ? \call_user_func($this->concurrency, \count($this->pending)) : $this->concurrency; - $concurrency = \max($concurrency - \count($this->pending), 0); + $concurrency = is_callable($this->concurrency) ? call_user_func($this->concurrency, count($this->pending)) : $this->concurrency; + $concurrency = max($concurrency - count($this->pending), 0); // Concurrency may be set to 0 to disallow new promises. if (!$concurrency) { return; @@ -124,49 +135,49 @@ private function refillPending() private function addPending() { if (!$this->iterable || !$this->iterable->valid()) { - return \false; + return false; } $promise = promise_for($this->iterable->current()); $idx = $this->iterable->key(); $this->pending[$idx] = $promise->then(function ($value) use($idx) { if ($this->onFulfilled) { - \call_user_func($this->onFulfilled, $value, $idx, $this->aggregate); + call_user_func($this->onFulfilled, $value, $idx, $this->aggregate); } $this->step($idx); }, function ($reason) use($idx) { if ($this->onRejected) { - \call_user_func($this->onRejected, $reason, $idx, $this->aggregate); + call_user_func($this->onRejected, $reason, $idx, $this->aggregate); } $this->step($idx); }); - return \true; + return true; } private function advanceIterator() { // Place a lock on the iterator so that we ensure to not recurse, // preventing fatal generator errors. if ($this->mutex) { - return \false; + return false; } - $this->mutex = \true; + $this->mutex = true; try { $this->iterable->next(); - $this->mutex = \false; - return \true; - } catch (\Throwable $e) { + $this->mutex = false; + return true; + } catch (Throwable $e) { $this->aggregate->reject($e); - $this->mutex = \false; - return \false; - } catch (\Exception $e) { + $this->mutex = false; + return false; + } catch (Exception $e) { $this->aggregate->reject($e); - $this->mutex = \false; - return \false; + $this->mutex = false; + return false; } } private function step($idx) { // If the promise was already resolved, then ignore this step. - if ($this->aggregate->getState() !== \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface::PENDING) { + if ($this->aggregate->getState() !== PromiseInterface::PENDING) { return; } unset($this->pending[$idx]); @@ -183,8 +194,8 @@ private function checkIfFinished() if (!$this->pending && !$this->iterable->valid()) { // Resolve the promise if there's nothing left to do. $this->aggregate->resolve(null); - return \true; + return true; } - return \false; + return false; } } diff --git a/vendor/guzzlehttp/promises/src/FulfilledPromise.php b/vendor/guzzlehttp/promises/src/FulfilledPromise.php index 4f4f145d3..744ca6157 100644 --- a/vendor/guzzlehttp/promises/src/FulfilledPromise.php +++ b/vendor/guzzlehttp/promises/src/FulfilledPromise.php @@ -2,19 +2,25 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Promise; +use Exception; +use InvalidArgumentException; +use LogicException; +use Throwable; +use function method_exists; + /** * A promise that has been fulfilled. * * Thenning off of this promise will invoke the onFulfilled callback * immediately and ignore other callbacks. */ -class FulfilledPromise implements \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface +class FulfilledPromise implements PromiseInterface { private $value; public function __construct($value) { - if (\method_exists($value, 'then')) { - throw new \InvalidArgumentException('You cannot create a FulfilledPromise with a promise.'); + if (method_exists($value, 'then')) { + throw new InvalidArgumentException('You cannot create a FulfilledPromise with a promise.'); } $this->value = $value; } @@ -25,15 +31,15 @@ public function then(callable $onFulfilled = null, callable $onRejected = null) return $this; } $queue = queue(); - $p = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\Promise([$queue, 'run']); + $p = new Promise([$queue, 'run']); $value = $this->value; $queue->add(static function () use($p, $value, $onFulfilled) { if ($p->getState() === self::PENDING) { try { $p->resolve($onFulfilled($value)); - } catch (\Throwable $e) { + } catch (Throwable $e) { $p->reject($e); - } catch (\Exception $e) { + } catch (Exception $e) { $p->reject($e); } } @@ -44,7 +50,7 @@ public function otherwise(callable $onRejected) { return $this->then(null, $onRejected); } - public function wait($unwrap = \true, $defaultDelivery = null) + public function wait($unwrap = true, $defaultDelivery = null) { return $unwrap ? $this->value : null; } @@ -55,12 +61,12 @@ public function getState() public function resolve($value) { if ($value !== $this->value) { - throw new \LogicException("Cannot resolve a fulfilled promise"); + throw new LogicException("Cannot resolve a fulfilled promise"); } } public function reject($reason) { - throw new \LogicException("Cannot reject a fulfilled promise"); + throw new LogicException("Cannot reject a fulfilled promise"); } public function cancel() { diff --git a/vendor/guzzlehttp/promises/src/Promise.php b/vendor/guzzlehttp/promises/src/Promise.php index 1528a0b14..a180ee227 100644 --- a/vendor/guzzlehttp/promises/src/Promise.php +++ b/vendor/guzzlehttp/promises/src/Promise.php @@ -2,12 +2,18 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Promise; +use Exception; +use LogicException; +use Throwable; +use function array_merge; +use function method_exists; + /** * Promises/A+ implementation that avoids recursion when possible. * * @link https://promisesaplus.com/ */ -class Promise implements \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface +class Promise implements PromiseInterface { private $state = self::PENDING; private $result; @@ -27,7 +33,7 @@ public function __construct(callable $waitFn = null, callable $cancelFn = null) public function then(callable $onFulfilled = null, callable $onRejected = null) { if ($this->state === self::PENDING) { - $p = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\Promise(null, [$this, 'cancel']); + $p = new Promise(null, [$this, 'cancel']); $this->handlers[] = [$p, $onFulfilled, $onRejected]; $p->waitList = $this->waitList; $p->waitList[] = $this; @@ -46,12 +52,12 @@ public function otherwise(callable $onRejected) { return $this->then(null, $onRejected); } - public function wait($unwrap = \true) + public function wait($unwrap = true) { $this->waitIfPending(); - $inner = $this->result instanceof \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface ? $this->result->wait($unwrap) : $this->result; + $inner = $this->result instanceof PromiseInterface ? $this->result->wait($unwrap) : $this->result; if ($unwrap) { - if ($this->result instanceof \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface || $this->state === self::FULFILLED) { + if ($this->result instanceof PromiseInterface || $this->state === self::FULFILLED) { return $inner; } else { // It's rejected so "unwrap" and throw an exception. @@ -74,15 +80,15 @@ public function cancel() $this->cancelFn = null; try { $fn(); - } catch (\Throwable $e) { + } catch (Throwable $e) { $this->reject($e); - } catch (\Exception $e) { + } catch (Exception $e) { $this->reject($e); } } // Reject the promise only if it wasn't rejected in a then callback. if ($this->state === self::PENDING) { - $this->reject(new \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\CancellationException('Promise has been cancelled')); + $this->reject(new CancellationException('Promise has been cancelled')); } } public function resolve($value) @@ -100,10 +106,10 @@ private function settle($state, $value) if ($state === $this->state && $value === $this->result) { return; } - throw $this->state === $state ? new \LogicException("The promise is already {$state}.") : new \LogicException("Cannot change a {$this->state} promise to {$state}"); + throw $this->state === $state ? new LogicException("The promise is already {$state}.") : new LogicException("Cannot change a {$this->state} promise to {$state}"); } if ($value === $this) { - throw new \LogicException('Cannot fulfill or reject a promise with itself'); + throw new LogicException('Cannot fulfill or reject a promise with itself'); } // Clear out the state of the promise but stash the handlers. $this->state = $state; @@ -117,7 +123,7 @@ private function settle($state, $value) } // If the value was not a settled promise or a thenable, then resolve // it in the task queue using the correct ID. - if (!\method_exists($value, 'then')) { + if (!method_exists($value, 'then')) { $id = $state === self::FULFILLED ? 1 : 2; // It's a success, so resolve the handlers in the queue. queue()->add(static function () use($id, $value, $handlers) { @@ -125,9 +131,9 @@ private function settle($state, $value) self::callHandler($id, $value, $handler); } }); - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\Promise && $value->getState() === self::PENDING) { + } elseif ($value instanceof Promise && $value->getState() === self::PENDING) { // We can just merge our handlers onto the next promise. - $value->handlers = \array_merge($value->handlers, $handlers); + $value->handlers = array_merge($value->handlers, $handlers); } else { // Resolve the handlers when the forwarded promise is resolved. $value->then(static function ($value) use($handlers) { @@ -169,9 +175,9 @@ private static function callHandler($index, $value, array $handler) // Forward rejections down the chain. $promise->reject($value); } - } catch (\Throwable $reason) { + } catch (Throwable $reason) { $promise->reject($reason); - } catch (\Exception $reason) { + } catch (Exception $reason) { $promise->reject($reason); } } @@ -197,8 +203,8 @@ private function invokeWaitFn() try { $wfn = $this->waitFn; $this->waitFn = null; - $wfn(\true); - } catch (\Exception $reason) { + $wfn(true); + } catch (Exception $reason) { if ($this->state === self::PENDING) { // The promise has not been resolved yet, so reject the promise // with the exception. @@ -215,13 +221,13 @@ private function invokeWaitList() $waitList = $this->waitList; $this->waitList = null; foreach ($waitList as $result) { - while (\true) { + while (true) { $result->waitIfPending(); - if ($result->result instanceof \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\Promise) { + if ($result->result instanceof Promise) { $result = $result->result; } else { - if ($result->result instanceof \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface) { - $result->result->wait(\false); + if ($result->result instanceof PromiseInterface) { + $result->result->wait(false); } break; } diff --git a/vendor/guzzlehttp/promises/src/PromiseInterface.php b/vendor/guzzlehttp/promises/src/PromiseInterface.php index 4ae3e0841..e4dba17dc 100644 --- a/vendor/guzzlehttp/promises/src/PromiseInterface.php +++ b/vendor/guzzlehttp/promises/src/PromiseInterface.php @@ -2,6 +2,9 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Promise; +use LogicException; +use RuntimeException; + /** * A promise represents the eventual result of an asynchronous operation. * @@ -50,14 +53,14 @@ public function getState(); * Resolve the promise with the given value. * * @param mixed $value - * @throws \RuntimeException if the promise is already resolved. + * @throws RuntimeException if the promise is already resolved. */ public function resolve($value); /** * Reject the promise with the given reason. * * @param mixed $reason - * @throws \RuntimeException if the promise is already resolved. + * @throws RuntimeException if the promise is already resolved. */ public function reject($reason); /** @@ -77,8 +80,8 @@ public function cancel(); * @param bool $unwrap * * @return mixed - * @throws \LogicException if the promise has no wait function or if the + * @throws LogicException if the promise has no wait function or if the * promise does not settle after waiting. */ - public function wait($unwrap = \true); + public function wait($unwrap = true); } diff --git a/vendor/guzzlehttp/promises/src/RejectedPromise.php b/vendor/guzzlehttp/promises/src/RejectedPromise.php index 8e4cef3c2..05d43b1c1 100644 --- a/vendor/guzzlehttp/promises/src/RejectedPromise.php +++ b/vendor/guzzlehttp/promises/src/RejectedPromise.php @@ -2,19 +2,25 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Promise; +use Exception; +use InvalidArgumentException; +use LogicException; +use Throwable; +use function method_exists; + /** * A promise that has been rejected. * * Thenning off of this promise will invoke the onRejected callback * immediately and ignore other callbacks. */ -class RejectedPromise implements \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface +class RejectedPromise implements PromiseInterface { private $reason; public function __construct($reason) { - if (\method_exists($reason, 'then')) { - throw new \InvalidArgumentException('You cannot create a RejectedPromise with a promise.'); + if (method_exists($reason, 'then')) { + throw new InvalidArgumentException('You cannot create a RejectedPromise with a promise.'); } $this->reason = $reason; } @@ -26,16 +32,16 @@ public function then(callable $onFulfilled = null, callable $onRejected = null) } $queue = queue(); $reason = $this->reason; - $p = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\Promise([$queue, 'run']); + $p = new Promise([$queue, 'run']); $queue->add(static function () use($p, $reason, $onRejected) { if ($p->getState() === self::PENDING) { try { // Return a resolved promise if onRejected does not throw. $p->resolve($onRejected($reason)); - } catch (\Throwable $e) { + } catch (Throwable $e) { // onRejected threw, so return a rejected promise. $p->reject($e); - } catch (\Exception $e) { + } catch (Exception $e) { // onRejected threw, so return a rejected promise. $p->reject($e); } @@ -47,7 +53,7 @@ public function otherwise(callable $onRejected) { return $this->then(null, $onRejected); } - public function wait($unwrap = \true, $defaultDelivery = null) + public function wait($unwrap = true, $defaultDelivery = null) { if ($unwrap) { throw exception_for($this->reason); @@ -59,12 +65,12 @@ public function getState() } public function resolve($value) { - throw new \LogicException("Cannot resolve a rejected promise"); + throw new LogicException("Cannot resolve a rejected promise"); } public function reject($reason) { if ($reason !== $this->reason) { - throw new \LogicException("Cannot reject a rejected promise"); + throw new LogicException("Cannot reject a rejected promise"); } } public function cancel() diff --git a/vendor/guzzlehttp/promises/src/RejectionException.php b/vendor/guzzlehttp/promises/src/RejectionException.php index a13202996..8b9da218f 100644 --- a/vendor/guzzlehttp/promises/src/RejectionException.php +++ b/vendor/guzzlehttp/promises/src/RejectionException.php @@ -2,12 +2,20 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Promise; +use JsonSerializable; +use RuntimeException; +use function is_object; +use function is_string; +use function json_encode; +use function method_exists; +use const JSON_PRETTY_PRINT; + /** * A special exception that is thrown when waiting on a rejected promise. * * The reason value is available via the getReason() method. */ -class RejectionException extends \RuntimeException +class RejectionException extends RuntimeException { /** @var mixed Rejection reason. */ private $reason; @@ -21,10 +29,10 @@ public function __construct($reason, $description = null) $message = 'The promise was rejected'; if ($description) { $message .= ' with reason: ' . $description; - } elseif (\is_string($reason) || \is_object($reason) && \method_exists($reason, '__toString')) { + } elseif (is_string($reason) || is_object($reason) && method_exists($reason, '__toString')) { $message .= ' with reason: ' . $this->reason; - } elseif ($reason instanceof \JsonSerializable) { - $message .= ' with reason: ' . \json_encode($this->reason, \JSON_PRETTY_PRINT); + } elseif ($reason instanceof JsonSerializable) { + $message .= ' with reason: ' . json_encode($this->reason, JSON_PRETTY_PRINT); } parent::__construct($message); } diff --git a/vendor/guzzlehttp/promises/src/TaskQueue.php b/vendor/guzzlehttp/promises/src/TaskQueue.php index 8ff17c98c..c3c07ca80 100644 --- a/vendor/guzzlehttp/promises/src/TaskQueue.php +++ b/vendor/guzzlehttp/promises/src/TaskQueue.php @@ -2,6 +2,11 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Promise; +use function array_shift; +use function error_get_last; +use function register_shutdown_function; +use const E_ERROR; + /** * A task queue that executes tasks in a FIFO order. * @@ -11,18 +16,18 @@ * * GuzzleHttp\Promise\queue()->run(); */ -class TaskQueue implements \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\TaskQueueInterface +class TaskQueue implements TaskQueueInterface { - private $enableShutdown = \true; + private $enableShutdown = true; private $queue = []; - public function __construct($withShutdown = \true) + public function __construct($withShutdown = true) { if ($withShutdown) { - \register_shutdown_function(function () { + register_shutdown_function(function () { if ($this->enableShutdown) { // Only run the tasks if an E_ERROR didn't occur. - $err = \error_get_last(); - if (!$err || $err['type'] ^ \E_ERROR) { + $err = error_get_last(); + if (!$err || $err['type'] ^ E_ERROR) { $this->run(); } } @@ -40,7 +45,7 @@ public function add(callable $task) public function run() { /** @var callable $task */ - while ($task = \array_shift($this->queue)) { + while ($task = array_shift($this->queue)) { $task(); } } @@ -57,6 +62,6 @@ public function run() */ public function disableShutdown() { - $this->enableShutdown = \false; + $this->enableShutdown = false; } } diff --git a/vendor/guzzlehttp/promises/src/functions.php b/vendor/guzzlehttp/promises/src/functions.php index b48cbc014..9edeb2dfb 100644 --- a/vendor/guzzlehttp/promises/src/functions.php +++ b/vendor/guzzlehttp/promises/src/functions.php @@ -2,6 +2,16 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Promise; +use ArrayIterator; +use Exception; +use Iterator; +use Throwable; +use function array_values; +use function count; +use function is_array; +use function ksort; +use function method_exists; + /** * Get the global task queue used for promise resolution. * @@ -19,13 +29,13 @@ * * @return TaskQueueInterface */ -function queue(\_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\TaskQueueInterface $assign = null) +function queue(TaskQueueInterface $assign = null) { static $queue; if ($assign) { $queue = $assign; } elseif (!$queue) { - $queue = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\TaskQueue(); + $queue = new TaskQueue(); } return $queue; } @@ -40,13 +50,13 @@ function queue(\_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\TaskQueueInterface $a function task(callable $task) { $queue = queue(); - $promise = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\Promise([$queue, 'run']); + $promise = new Promise([$queue, 'run']); $queue->add(function () use($task, $promise) { try { $promise->resolve($task()); - } catch (\Throwable $e) { + } catch (Throwable $e) { $promise->reject($e); - } catch (\Exception $e) { + } catch (Exception $e) { $promise->reject($e); } }); @@ -61,18 +71,18 @@ function task(callable $task) */ function promise_for($value) { - if ($value instanceof \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface) { + if ($value instanceof PromiseInterface) { return $value; } // Return a Guzzle promise that shadows the given promise. - if (\method_exists($value, 'then')) { - $wfn = \method_exists($value, 'wait') ? [$value, 'wait'] : null; - $cfn = \method_exists($value, 'cancel') ? [$value, 'cancel'] : null; - $promise = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\Promise($wfn, $cfn); + if (method_exists($value, 'then')) { + $wfn = method_exists($value, 'wait') ? [$value, 'wait'] : null; + $cfn = method_exists($value, 'cancel') ? [$value, 'cancel'] : null; + $promise = new Promise($wfn, $cfn); $value->then([$promise, 'resolve'], [$promise, 'reject']); return $promise; } - return new \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\FulfilledPromise($value); + return new FulfilledPromise($value); } /** * Creates a rejected promise for a reason if the reason is not a promise. If @@ -84,37 +94,37 @@ function promise_for($value) */ function rejection_for($reason) { - if ($reason instanceof \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface) { + if ($reason instanceof PromiseInterface) { return $reason; } - return new \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\RejectedPromise($reason); + return new RejectedPromise($reason); } /** * Create an exception for a rejected promise value. * * @param mixed $reason * - * @return \Exception|\Throwable + * @return Exception|Throwable */ function exception_for($reason) { - return $reason instanceof \Exception || $reason instanceof \Throwable ? $reason : new \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\RejectionException($reason); + return $reason instanceof Exception || $reason instanceof Throwable ? $reason : new RejectionException($reason); } /** * Returns an iterator for the given value. * * @param mixed $value * - * @return \Iterator + * @return Iterator */ function iter_for($value) { - if ($value instanceof \Iterator) { + if ($value instanceof Iterator) { return $value; - } elseif (\is_array($value)) { - return new \ArrayIterator($value); + } elseif (is_array($value)) { + return new ArrayIterator($value); } else { - return new \ArrayIterator([$value]); + return new ArrayIterator([$value]); } } /** @@ -131,16 +141,16 @@ function iter_for($value) * * @return array */ -function inspect(\_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface $promise) +function inspect(PromiseInterface $promise) { try { - return ['state' => \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface::FULFILLED, 'value' => $promise->wait()]; - } catch (\_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\RejectionException $e) { - return ['state' => \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface::REJECTED, 'reason' => $e->getReason()]; - } catch (\Throwable $e) { - return ['state' => \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface::REJECTED, 'reason' => $e]; - } catch (\Exception $e) { - return ['state' => \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface::REJECTED, 'reason' => $e]; + return ['state' => PromiseInterface::FULFILLED, 'value' => $promise->wait()]; + } catch (RejectionException $e) { + return ['state' => PromiseInterface::REJECTED, 'reason' => $e->getReason()]; + } catch (Throwable $e) { + return ['state' => PromiseInterface::REJECTED, 'reason' => $e]; + } catch (Exception $e) { + return ['state' => PromiseInterface::REJECTED, 'reason' => $e]; } } /** @@ -172,8 +182,8 @@ function inspect_all($promises) * @param mixed $promises Iterable of PromiseInterface objects to wait on. * * @return array - * @throws \Exception on error - * @throws \Throwable on error in PHP >=7 + * @throws Exception on error + * @throws Throwable on error in PHP >=7 */ function unwrap($promises) { @@ -200,10 +210,10 @@ function all($promises) $results = []; return \each($promises, function ($value, $idx) use(&$results) { $results[$idx] = $value; - }, function ($reason, $idx, \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\Promise $aggregate) { + }, function ($reason, $idx, Promise $aggregate) { $aggregate->reject($reason); })->then(function () use(&$results) { - \ksort($results); + ksort($results); return $results; }); } @@ -227,22 +237,22 @@ function some($count, $promises) { $results = []; $rejections = []; - return \each($promises, function ($value, $idx, \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface $p) use(&$results, $count) { - if ($p->getState() !== \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface::PENDING) { + return \each($promises, function ($value, $idx, PromiseInterface $p) use(&$results, $count) { + if ($p->getState() !== PromiseInterface::PENDING) { return; } $results[$idx] = $value; - if (\count($results) >= $count) { + if (count($results) >= $count) { $p->resolve(null); } }, function ($reason) use(&$rejections) { $rejections[] = $reason; })->then(function () use(&$results, &$rejections, $count) { - if (\count($results) !== $count) { - throw new \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\AggregateException('Not enough promises to fulfill count', $rejections); + if (count($results) !== $count) { + throw new AggregateException('Not enough promises to fulfill count', $rejections); } - \ksort($results); - return \array_values($results); + ksort($results); + return array_values($results); }); } /** @@ -274,11 +284,11 @@ function settle($promises) { $results = []; return \each($promises, function ($value, $idx) use(&$results) { - $results[$idx] = ['state' => \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface::FULFILLED, 'value' => $value]; + $results[$idx] = ['state' => PromiseInterface::FULFILLED, 'value' => $value]; }, function ($reason, $idx) use(&$results) { - $results[$idx] = ['state' => \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface::REJECTED, 'reason' => $reason]; + $results[$idx] = ['state' => PromiseInterface::REJECTED, 'reason' => $reason]; })->then(function () use(&$results) { - \ksort($results); + ksort($results); return $results; }); } @@ -303,7 +313,7 @@ function settle($promises) */ function each($iterable, callable $onFulfilled = null, callable $onRejected = null) { - return (new \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\EachPromise($iterable, ['fulfilled' => $onFulfilled, 'rejected' => $onRejected]))->promise(); + return (new EachPromise($iterable, ['fulfilled' => $onFulfilled, 'rejected' => $onRejected]))->promise(); } /** * Like each, but only allows a certain number of outstanding promises at any @@ -322,7 +332,7 @@ function each($iterable, callable $onFulfilled = null, callable $onRejected = nu */ function each_limit($iterable, $concurrency, callable $onFulfilled = null, callable $onRejected = null) { - return (new \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\EachPromise($iterable, ['fulfilled' => $onFulfilled, 'rejected' => $onRejected, 'concurrency' => $concurrency]))->promise(); + return (new EachPromise($iterable, ['fulfilled' => $onFulfilled, 'rejected' => $onRejected, 'concurrency' => $concurrency]))->promise(); } /** * Like each_limit, but ensures that no promise in the given $iterable argument @@ -337,7 +347,7 @@ function each_limit($iterable, $concurrency, callable $onFulfilled = null, calla */ function each_limit_all($iterable, $concurrency, callable $onFulfilled = null) { - return each_limit($iterable, $concurrency, $onFulfilled, function ($reason, $idx, \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface $aggregate) { + return each_limit($iterable, $concurrency, $onFulfilled, function ($reason, $idx, PromiseInterface $aggregate) { $aggregate->reject($reason); }); } @@ -348,9 +358,9 @@ function each_limit_all($iterable, $concurrency, callable $onFulfilled = null) * * @return bool */ -function is_fulfilled(\_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface $promise) +function is_fulfilled(PromiseInterface $promise) { - return $promise->getState() === \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface::FULFILLED; + return $promise->getState() === PromiseInterface::FULFILLED; } /** * Returns true if a promise is rejected. @@ -359,9 +369,9 @@ function is_fulfilled(\_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterfa * * @return bool */ -function is_rejected(\_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface $promise) +function is_rejected(PromiseInterface $promise) { - return $promise->getState() === \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface::REJECTED; + return $promise->getState() === PromiseInterface::REJECTED; } /** * Returns true if a promise is fulfilled or rejected. @@ -370,9 +380,9 @@ function is_rejected(\_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterfac * * @return bool */ -function is_settled(\_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface $promise) +function is_settled(PromiseInterface $promise) { - return $promise->getState() !== \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface::PENDING; + return $promise->getState() !== PromiseInterface::PENDING; } /** * @see Coroutine @@ -383,5 +393,5 @@ function is_settled(\_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\PromiseInterface */ function coroutine(callable $generatorFn) { - return new \_PhpScoper5ea00cc67502b\GuzzleHttp\Promise\Coroutine($generatorFn); + return new Coroutine($generatorFn); } diff --git a/vendor/guzzlehttp/promises/src/functions_include.php b/vendor/guzzlehttp/promises/src/functions_include.php index 7ec8d465b..dbde044f3 100644 --- a/vendor/guzzlehttp/promises/src/functions_include.php +++ b/vendor/guzzlehttp/promises/src/functions_include.php @@ -3,6 +3,8 @@ namespace _PhpScoper5ea00cc67502b; // Don't redefine the functions if included multiple times. -if (!\function_exists('_PhpScoper5ea00cc67502b\\GuzzleHttp\\Promise\\promise_for')) { +use function function_exists; + +if (!function_exists('_PhpScoper5ea00cc67502b\\GuzzleHttp\\Promise\\promise_for')) { require __DIR__ . '/functions.php'; } diff --git a/vendor/guzzlehttp/promises/src/index.php b/vendor/guzzlehttp/promises/src/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/guzzlehttp/promises/src/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/guzzlehttp/psr7/index.php b/vendor/guzzlehttp/psr7/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/guzzlehttp/psr7/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/guzzlehttp/psr7/src/AppendStream.php b/vendor/guzzlehttp/psr7/src/AppendStream.php index 24261003d..1c5248e86 100644 --- a/vendor/guzzlehttp/psr7/src/AppendStream.php +++ b/vendor/guzzlehttp/psr7/src/AppendStream.php @@ -3,16 +3,24 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7; use _PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface; +use Exception; +use InvalidArgumentException; +use RuntimeException; +use function count; +use function min; +use function strlen; +use const SEEK_SET; + /** * Reads from multiple streams, one after the other. * * This is a read-only stream decorator. */ -class AppendStream implements \_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface +class AppendStream implements StreamInterface { /** @var StreamInterface[] Streams being decorated */ private $streams = []; - private $seekable = \true; + private $seekable = true; private $current = 0; private $pos = 0; /** @@ -30,7 +38,7 @@ public function __toString() try { $this->rewind(); return $this->getContents(); - } catch (\Exception $e) { + } catch (Exception $e) { return ''; } } @@ -39,16 +47,16 @@ public function __toString() * * @param StreamInterface $stream Stream to append. Must be readable. * - * @throws \InvalidArgumentException if the stream is not readable + * @throws InvalidArgumentException if the stream is not readable */ - public function addStream(\_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface $stream) + public function addStream(StreamInterface $stream) { if (!$stream->isReadable()) { - throw new \InvalidArgumentException('Each stream must be readable'); + throw new InvalidArgumentException('Each stream must be readable'); } // The stream is only seekable if all streams are seekable if (!$stream->isSeekable()) { - $this->seekable = \false; + $this->seekable = false; } $this->streams[] = $stream; } @@ -64,7 +72,7 @@ public function getContents() public function close() { $this->pos = $this->current = 0; - $this->seekable = \true; + $this->seekable = true; foreach ($this->streams as $stream) { $stream->close(); } @@ -80,7 +88,7 @@ public function close() public function detach() { $this->pos = $this->current = 0; - $this->seekable = \true; + $this->seekable = true; foreach ($this->streams as $stream) { $stream->detach(); } @@ -112,7 +120,7 @@ public function getSize() } public function eof() { - return !$this->streams || $this->current >= \count($this->streams) - 1 && $this->streams[$this->current]->eof(); + return !$this->streams || $this->current >= count($this->streams) - 1 && $this->streams[$this->current]->eof(); } public function rewind() { @@ -123,25 +131,25 @@ public function rewind() * * {@inheritdoc} */ - public function seek($offset, $whence = \SEEK_SET) + public function seek($offset, $whence = SEEK_SET) { if (!$this->seekable) { - throw new \RuntimeException('This AppendStream is not seekable'); - } elseif ($whence !== \SEEK_SET) { - throw new \RuntimeException('The AppendStream can only seek with SEEK_SET'); + throw new RuntimeException('This AppendStream is not seekable'); + } elseif ($whence !== SEEK_SET) { + throw new RuntimeException('The AppendStream can only seek with SEEK_SET'); } $this->pos = $this->current = 0; // Rewind each stream foreach ($this->streams as $i => $stream) { try { $stream->rewind(); - } catch (\Exception $e) { - throw new \RuntimeException('Unable to seek stream ' . $i . ' of the AppendStream', 0, $e); + } catch (Exception $e) { + throw new RuntimeException('Unable to seek stream ' . $i . ' of the AppendStream', 0, $e); } } // Seek to the actual position by reading from each stream while ($this->pos < $offset && !$this->eof()) { - $result = $this->read(\min(8096, $offset - $this->pos)); + $result = $this->read(min(8096, $offset - $this->pos)); if ($result === '') { break; } @@ -155,13 +163,13 @@ public function seek($offset, $whence = \SEEK_SET) public function read($length) { $buffer = ''; - $total = \count($this->streams) - 1; + $total = count($this->streams) - 1; $remaining = $length; - $progressToNext = \false; + $progressToNext = false; while ($remaining > 0) { // Progress to the next stream if needed. if ($progressToNext || $this->streams[$this->current]->eof()) { - $progressToNext = \false; + $progressToNext = false; if ($this->current === $total) { break; } @@ -170,22 +178,22 @@ public function read($length) $result = $this->streams[$this->current]->read($remaining); // Using a loose comparison here to match on '', false, and null if ($result == null) { - $progressToNext = \true; + $progressToNext = true; continue; } $buffer .= $result; - $remaining = $length - \strlen($buffer); + $remaining = $length - strlen($buffer); } - $this->pos += \strlen($buffer); + $this->pos += strlen($buffer); return $buffer; } public function isReadable() { - return \true; + return true; } public function isWritable() { - return \false; + return false; } public function isSeekable() { @@ -193,7 +201,7 @@ public function isSeekable() } public function write($string) { - throw new \RuntimeException('Cannot write to an AppendStream'); + throw new RuntimeException('Cannot write to an AppendStream'); } public function getMetadata($key = null) { diff --git a/vendor/guzzlehttp/psr7/src/BufferStream.php b/vendor/guzzlehttp/psr7/src/BufferStream.php index ebe56e35c..ec1361dc0 100644 --- a/vendor/guzzlehttp/psr7/src/BufferStream.php +++ b/vendor/guzzlehttp/psr7/src/BufferStream.php @@ -3,6 +3,11 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7; use _PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface; +use RuntimeException; +use function strlen; +use function substr; +use const SEEK_SET; + /** * Provides a buffer stream that can be written to to fill a buffer, and read * from to remove bytes from the buffer. @@ -11,7 +16,7 @@ * what the configured high water mark of the stream is, or the maximum * preferred size of the buffer. */ -class BufferStream implements \_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface +class BufferStream implements StreamInterface { private $hwm; private $buffer = ''; @@ -46,50 +51,50 @@ public function detach() } public function getSize() { - return \strlen($this->buffer); + return strlen($this->buffer); } public function isReadable() { - return \true; + return true; } public function isWritable() { - return \true; + return true; } public function isSeekable() { - return \false; + return false; } public function rewind() { $this->seek(0); } - public function seek($offset, $whence = \SEEK_SET) + public function seek($offset, $whence = SEEK_SET) { - throw new \RuntimeException('Cannot seek a BufferStream'); + throw new RuntimeException('Cannot seek a BufferStream'); } public function eof() { - return \strlen($this->buffer) === 0; + return strlen($this->buffer) === 0; } public function tell() { - throw new \RuntimeException('Cannot determine the position of a BufferStream'); + throw new RuntimeException('Cannot determine the position of a BufferStream'); } /** * Reads data from the buffer. */ public function read($length) { - $currentLength = \strlen($this->buffer); + $currentLength = strlen($this->buffer); if ($length >= $currentLength) { // No need to slice the buffer because we don't have enough data. $result = $this->buffer; $this->buffer = ''; } else { // Slice up the result to provide a subset of the buffer. - $result = \substr($this->buffer, 0, $length); - $this->buffer = \substr($this->buffer, $length); + $result = substr($this->buffer, 0, $length); + $this->buffer = substr($this->buffer, $length); } return $result; } @@ -100,10 +105,10 @@ public function write($string) { $this->buffer .= $string; // TODO: What should happen here? - if (\strlen($this->buffer) >= $this->hwm) { - return \false; + if (strlen($this->buffer) >= $this->hwm) { + return false; } - return \strlen($string); + return strlen($string); } public function getMetadata($key = null) { diff --git a/vendor/guzzlehttp/psr7/src/CachingStream.php b/vendor/guzzlehttp/psr7/src/CachingStream.php index ed35ce50e..624e18d93 100644 --- a/vendor/guzzlehttp/psr7/src/CachingStream.php +++ b/vendor/guzzlehttp/psr7/src/CachingStream.php @@ -3,11 +3,20 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7; use _PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface; +use InvalidArgumentException; +use function fopen; +use function max; +use function strlen; +use function substr; +use const SEEK_CUR; +use const SEEK_END; +use const SEEK_SET; + /** * Stream decorator that can cache previously read bytes from a sequentially * read stream. */ -class CachingStream implements \_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface +class CachingStream implements StreamInterface { use StreamDecoratorTrait; /** @var StreamInterface Stream being wrapped */ @@ -20,33 +29,33 @@ class CachingStream implements \_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamI * @param StreamInterface $stream Stream to cache * @param StreamInterface $target Optionally specify where data is cached */ - public function __construct(\_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface $stream, \_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface $target = null) + public function __construct(StreamInterface $stream, StreamInterface $target = null) { $this->remoteStream = $stream; - $this->stream = $target ?: new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Stream(\fopen('php://temp', 'r+')); + $this->stream = $target ?: new Stream(fopen('php://temp', 'r+')); } public function getSize() { - return \max($this->stream->getSize(), $this->remoteStream->getSize()); + return max($this->stream->getSize(), $this->remoteStream->getSize()); } public function rewind() { $this->seek(0); } - public function seek($offset, $whence = \SEEK_SET) + public function seek($offset, $whence = SEEK_SET) { - if ($whence == \SEEK_SET) { + if ($whence == SEEK_SET) { $byte = $offset; - } elseif ($whence == \SEEK_CUR) { + } elseif ($whence == SEEK_CUR) { $byte = $offset + $this->tell(); - } elseif ($whence == \SEEK_END) { + } elseif ($whence == SEEK_END) { $size = $this->remoteStream->getSize(); if ($size === null) { $size = $this->cacheEntireStream(); } $byte = $size + $offset; } else { - throw new \InvalidArgumentException('Invalid whence'); + throw new InvalidArgumentException('Invalid whence'); } $diff = $byte - $this->stream->getSize(); if ($diff > 0) { @@ -65,7 +74,7 @@ public function read($length) { // Perform a regular read on any previously read data from the buffer $data = $this->stream->read($length); - $remaining = $length - \strlen($data); + $remaining = $length - strlen($data); // More data was requested so read from the remote stream if ($remaining) { // If data was written to the buffer in a position that would have @@ -74,9 +83,9 @@ public function read($length) // position. This mimics the behavior of other PHP stream wrappers. $remoteData = $this->remoteStream->read($remaining + $this->skipReadBytes); if ($this->skipReadBytes) { - $len = \strlen($remoteData); - $remoteData = \substr($remoteData, $this->skipReadBytes); - $this->skipReadBytes = \max(0, $this->skipReadBytes - $len); + $len = strlen($remoteData); + $remoteData = substr($remoteData, $this->skipReadBytes); + $this->skipReadBytes = max(0, $this->skipReadBytes - $len); } $data .= $remoteData; $this->stream->write($remoteData); @@ -89,7 +98,7 @@ public function write($string) // to skip bytes from being read from the remote stream to emulate // other stream wrappers. Basically replacing bytes of data of a fixed // length. - $overflow = \strlen($string) + $this->tell() - $this->remoteStream->tell(); + $overflow = strlen($string) + $this->tell() - $this->remoteStream->tell(); if ($overflow > 0) { $this->skipReadBytes += $overflow; } @@ -108,7 +117,7 @@ public function close() } private function cacheEntireStream() { - $target = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\FnStream(['write' => 'strlen']); + $target = new FnStream(['write' => 'strlen']); copy_to_stream($this, $target); return $this->tell(); } diff --git a/vendor/guzzlehttp/psr7/src/DroppingStream.php b/vendor/guzzlehttp/psr7/src/DroppingStream.php index 00bbace60..764fe6823 100644 --- a/vendor/guzzlehttp/psr7/src/DroppingStream.php +++ b/vendor/guzzlehttp/psr7/src/DroppingStream.php @@ -3,11 +3,14 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7; use _PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface; +use function strlen; +use function substr; + /** * Stream decorator that begins dropping data once the size of the underlying * stream becomes too full. */ -class DroppingStream implements \_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface +class DroppingStream implements StreamInterface { use StreamDecoratorTrait; private $maxLength; @@ -15,7 +18,7 @@ class DroppingStream implements \_PhpScoper5ea00cc67502b\Psr\Http\Message\Stream * @param StreamInterface $stream Underlying stream to decorate. * @param int $maxLength Maximum size before dropping data. */ - public function __construct(\_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface $stream, $maxLength) + public function __construct(StreamInterface $stream, $maxLength) { $this->stream = $stream; $this->maxLength = $maxLength; @@ -28,9 +31,9 @@ public function write($string) return 0; } // Write the stream or a subset of the stream if needed. - if (\strlen($string) < $diff) { + if (strlen($string) < $diff) { return $this->stream->write($string); } - return $this->stream->write(\substr($string, 0, $diff)); + return $this->stream->write(substr($string, 0, $diff)); } } diff --git a/vendor/guzzlehttp/psr7/src/FnStream.php b/vendor/guzzlehttp/psr7/src/FnStream.php index 7d34d1e92..329a3a492 100644 --- a/vendor/guzzlehttp/psr7/src/FnStream.php +++ b/vendor/guzzlehttp/psr7/src/FnStream.php @@ -3,13 +3,21 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7; use _PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface; +use BadMethodCallException; +use LogicException; +use function array_diff; +use function array_keys; +use function call_user_func; +use function str_replace; +use const SEEK_SET; + /** * Compose stream implementations based on a hash of functions. * * Allows for easy testing and extension of a provided stream without needing * to create a concrete class for a simple extension point. */ -class FnStream implements \_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface +class FnStream implements StreamInterface { /** @var array */ private $methods; @@ -28,11 +36,11 @@ public function __construct(array $methods) } /** * Lazily determine which methods are not implemented. - * @throws \BadMethodCallException + * @throws BadMethodCallException */ public function __get($name) { - throw new \BadMethodCallException(\str_replace('_fn_', '', $name) . '() is not implemented in the FnStream'); + throw new BadMethodCallException(str_replace('_fn_', '', $name) . '() is not implemented in the FnStream'); } /** * The close method is called on the underlying stream only if possible. @@ -40,16 +48,16 @@ public function __get($name) public function __destruct() { if (isset($this->_fn_close)) { - \call_user_func($this->_fn_close); + call_user_func($this->_fn_close); } } /** * An unserialize would allow the __destruct to run when the unserialized value goes out of scope. - * @throws \LogicException + * @throws LogicException */ public function __wakeup() { - throw new \LogicException('FnStream should never be unserialized'); + throw new LogicException('FnStream should never be unserialized'); } /** * Adds custom functionality to an underlying stream by intercepting @@ -60,73 +68,73 @@ public function __wakeup() * * @return FnStream */ - public static function decorate(\_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface $stream, array $methods) + public static function decorate(StreamInterface $stream, array $methods) { // If any of the required methods were not provided, then simply // proxy to the decorated stream. - foreach (\array_diff(self::$slots, \array_keys($methods)) as $diff) { + foreach (array_diff(self::$slots, array_keys($methods)) as $diff) { $methods[$diff] = [$stream, $diff]; } return new self($methods); } public function __toString() { - return \call_user_func($this->_fn___toString); + return call_user_func($this->_fn___toString); } public function close() { - return \call_user_func($this->_fn_close); + return call_user_func($this->_fn_close); } public function detach() { - return \call_user_func($this->_fn_detach); + return call_user_func($this->_fn_detach); } public function getSize() { - return \call_user_func($this->_fn_getSize); + return call_user_func($this->_fn_getSize); } public function tell() { - return \call_user_func($this->_fn_tell); + return call_user_func($this->_fn_tell); } public function eof() { - return \call_user_func($this->_fn_eof); + return call_user_func($this->_fn_eof); } public function isSeekable() { - return \call_user_func($this->_fn_isSeekable); + return call_user_func($this->_fn_isSeekable); } public function rewind() { - \call_user_func($this->_fn_rewind); + call_user_func($this->_fn_rewind); } - public function seek($offset, $whence = \SEEK_SET) + public function seek($offset, $whence = SEEK_SET) { - \call_user_func($this->_fn_seek, $offset, $whence); + call_user_func($this->_fn_seek, $offset, $whence); } public function isWritable() { - return \call_user_func($this->_fn_isWritable); + return call_user_func($this->_fn_isWritable); } public function write($string) { - return \call_user_func($this->_fn_write, $string); + return call_user_func($this->_fn_write, $string); } public function isReadable() { - return \call_user_func($this->_fn_isReadable); + return call_user_func($this->_fn_isReadable); } public function read($length) { - return \call_user_func($this->_fn_read, $length); + return call_user_func($this->_fn_read, $length); } public function getContents() { - return \call_user_func($this->_fn_getContents); + return call_user_func($this->_fn_getContents); } public function getMetadata($key = null) { - return \call_user_func($this->_fn_getMetadata, $key); + return call_user_func($this->_fn_getMetadata, $key); } } diff --git a/vendor/guzzlehttp/psr7/src/InflateStream.php b/vendor/guzzlehttp/psr7/src/InflateStream.php index 990e65958..ffb464084 100644 --- a/vendor/guzzlehttp/psr7/src/InflateStream.php +++ b/vendor/guzzlehttp/psr7/src/InflateStream.php @@ -3,6 +3,12 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7; use _PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface; +use function bin2hex; +use function chr; +use function stream_filter_append; +use function substr; +use const STREAM_FILTER_READ; + /** * Uses PHP's zlib.inflate filter to inflate deflate or gzipped content. * @@ -14,32 +20,32 @@ * @link http://tools.ietf.org/html/rfc1952 * @link http://php.net/manual/en/filters.compression.php */ -class InflateStream implements \_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface +class InflateStream implements StreamInterface { use StreamDecoratorTrait; - public function __construct(\_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface $stream) + public function __construct(StreamInterface $stream) { // read the first 10 bytes, ie. gzip header $header = $stream->read(10); $filenameHeaderLength = $this->getLengthOfPossibleFilenameHeader($stream, $header); // Skip the header, that is 10 + length of filename + 1 (nil) bytes - $stream = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\LimitStream($stream, -1, 10 + $filenameHeaderLength); - $resource = \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\StreamWrapper::getResource($stream); - \stream_filter_append($resource, 'zlib.inflate', \STREAM_FILTER_READ); - $this->stream = $stream->isSeekable() ? new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Stream($resource) : new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\NoSeekStream(new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Stream($resource)); + $stream = new LimitStream($stream, -1, 10 + $filenameHeaderLength); + $resource = StreamWrapper::getResource($stream); + stream_filter_append($resource, 'zlib.inflate', STREAM_FILTER_READ); + $this->stream = $stream->isSeekable() ? new Stream($resource) : new NoSeekStream(new Stream($resource)); } /** * @param StreamInterface $stream * @param $header * @return int */ - private function getLengthOfPossibleFilenameHeader(\_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface $stream, $header) + private function getLengthOfPossibleFilenameHeader(StreamInterface $stream, $header) { $filename_header_length = 0; - if (\substr(\bin2hex($header), 6, 2) === '08') { + if (substr(bin2hex($header), 6, 2) === '08') { // we have a filename, read until nil $filename_header_length = 1; - while ($stream->read(1) !== \chr(0)) { + while ($stream->read(1) !== chr(0)) { $filename_header_length++; } } diff --git a/vendor/guzzlehttp/psr7/src/LazyOpenStream.php b/vendor/guzzlehttp/psr7/src/LazyOpenStream.php index cd2c1426f..d80a9a043 100644 --- a/vendor/guzzlehttp/psr7/src/LazyOpenStream.php +++ b/vendor/guzzlehttp/psr7/src/LazyOpenStream.php @@ -7,7 +7,7 @@ * Lazily reads or writes to a file that is opened only after an IO operation * take place on the stream. */ -class LazyOpenStream implements \_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface +class LazyOpenStream implements StreamInterface { use StreamDecoratorTrait; /** @var string File to open */ diff --git a/vendor/guzzlehttp/psr7/src/LimitStream.php b/vendor/guzzlehttp/psr7/src/LimitStream.php index 2447fa804..3d0b6b388 100644 --- a/vendor/guzzlehttp/psr7/src/LimitStream.php +++ b/vendor/guzzlehttp/psr7/src/LimitStream.php @@ -3,10 +3,15 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7; use _PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface; +use RuntimeException; +use function min; +use function sprintf; +use const SEEK_SET; + /** * Decorator used to return only a subset of a stream */ -class LimitStream implements \_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface +class LimitStream implements StreamInterface { use StreamDecoratorTrait; /** @var int Offset to start reading from */ @@ -20,7 +25,7 @@ class LimitStream implements \_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInt * @param int $offset Position to seek to before reading (only * works on seekable streams). */ - public function __construct(\_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface $stream, $limit = -1, $offset = 0) + public function __construct(StreamInterface $stream, $limit = -1, $offset = 0) { $this->stream = $stream; $this->setLimit($limit); @@ -30,11 +35,11 @@ public function eof() { // Always return true if the underlying stream is EOF if ($this->stream->eof()) { - return \true; + return true; } // No limit and the underlying stream is not at EOF if ($this->limit == -1) { - return \false; + return false; } return $this->stream->tell() >= $this->offset + $this->limit; } @@ -49,17 +54,17 @@ public function getSize() } elseif ($this->limit == -1) { return $length - $this->offset; } else { - return \min($this->limit, $length - $this->offset); + return min($this->limit, $length - $this->offset); } } /** * Allow for a bounded seek on the read limited stream * {@inheritdoc} */ - public function seek($offset, $whence = \SEEK_SET) + public function seek($offset, $whence = SEEK_SET) { - if ($whence !== \SEEK_SET || $offset < 0) { - throw new \RuntimeException(\sprintf('Cannot seek to offset %s with whence %s', $offset, $whence)); + if ($whence !== SEEK_SET || $offset < 0) { + throw new RuntimeException(sprintf('Cannot seek to offset %s with whence %s', $offset, $whence)); } $offset += $this->offset; if ($this->limit !== -1) { @@ -82,7 +87,7 @@ public function tell() * * @param int $offset Offset to seek to and begin byte limiting from * - * @throws \RuntimeException if the stream cannot be seeked. + * @throws RuntimeException if the stream cannot be seeked. */ public function setOffset($offset) { @@ -92,7 +97,7 @@ public function setOffset($offset) if ($this->stream->isSeekable()) { $this->stream->seek($offset); } elseif ($current > $offset) { - throw new \RuntimeException("Could not seek to stream offset {$offset}"); + throw new RuntimeException("Could not seek to stream offset {$offset}"); } else { $this->stream->read($offset - $current); } @@ -121,7 +126,7 @@ public function read($length) if ($remaining > 0) { // Only return the amount of requested data, ensuring that the byte // limit is not exceeded - return $this->stream->read(\min($remaining, $length)); + return $this->stream->read(min($remaining, $length)); } return ''; } diff --git a/vendor/guzzlehttp/psr7/src/MessageTrait.php b/vendor/guzzlehttp/psr7/src/MessageTrait.php index cdf63fbce..d9acfe836 100644 --- a/vendor/guzzlehttp/psr7/src/MessageTrait.php +++ b/vendor/guzzlehttp/psr7/src/MessageTrait.php @@ -3,6 +3,22 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7; use _PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface; +use InvalidArgumentException; +use function array_map; +use function array_merge; +use function count; +use function get_class; +use function gettype; +use function implode; +use function is_array; +use function is_int; +use function is_object; +use function is_scalar; +use function is_string; +use function sprintf; +use function strtolower; +use function trim; + /** * Trait implementing functionality common to requests and responses. */ @@ -35,11 +51,11 @@ public function getHeaders() } public function hasHeader($header) { - return isset($this->headerNames[\strtolower($header)]); + return isset($this->headerNames[strtolower($header)]); } public function getHeader($header) { - $header = \strtolower($header); + $header = strtolower($header); if (!isset($this->headerNames[$header])) { return []; } @@ -48,13 +64,13 @@ public function getHeader($header) } public function getHeaderLine($header) { - return \implode(', ', $this->getHeader($header)); + return implode(', ', $this->getHeader($header)); } public function withHeader($header, $value) { $this->assertHeader($header); $value = $this->normalizeHeaderValue($value); - $normalized = \strtolower($header); + $normalized = strtolower($header); $new = clone $this; if (isset($new->headerNames[$normalized])) { unset($new->headers[$new->headerNames[$normalized]]); @@ -67,11 +83,11 @@ public function withAddedHeader($header, $value) { $this->assertHeader($header); $value = $this->normalizeHeaderValue($value); - $normalized = \strtolower($header); + $normalized = strtolower($header); $new = clone $this; if (isset($new->headerNames[$normalized])) { $header = $this->headerNames[$normalized]; - $new->headers[$header] = \array_merge($this->headers[$header], $value); + $new->headers[$header] = array_merge($this->headers[$header], $value); } else { $new->headerNames[$normalized] = $header; $new->headers[$header] = $value; @@ -80,7 +96,7 @@ public function withAddedHeader($header, $value) } public function withoutHeader($header) { - $normalized = \strtolower($header); + $normalized = strtolower($header); if (!isset($this->headerNames[$normalized])) { return $this; } @@ -96,7 +112,7 @@ public function getBody() } return $this->stream; } - public function withBody(\_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface $body) + public function withBody(StreamInterface $body) { if ($body === $this->stream) { return $this; @@ -109,17 +125,17 @@ private function setHeaders(array $headers) { $this->headerNames = $this->headers = []; foreach ($headers as $header => $value) { - if (\is_int($header)) { + if (is_int($header)) { // Numeric array keys are converted to int by PHP but having a header name '123' is not forbidden by the spec // and also allowed in withHeader(). So we need to cast it to string again for the following assertion to pass. $header = (string) $header; } $this->assertHeader($header); $value = $this->normalizeHeaderValue($value); - $normalized = \strtolower($header); + $normalized = strtolower($header); if (isset($this->headerNames[$normalized])) { $header = $this->headerNames[$normalized]; - $this->headers[$header] = \array_merge($this->headers[$header], $value); + $this->headers[$header] = array_merge($this->headers[$header], $value); } else { $this->headerNames[$normalized] = $header; $this->headers[$header] = $value; @@ -128,11 +144,11 @@ private function setHeaders(array $headers) } private function normalizeHeaderValue($value) { - if (!\is_array($value)) { + if (!is_array($value)) { return $this->trimHeaderValues([$value]); } - if (\count($value) === 0) { - throw new \InvalidArgumentException('Header value can not be an empty array.'); + if (count($value) === 0) { + throw new InvalidArgumentException('Header value can not be an empty array.'); } return $this->trimHeaderValues($value); } @@ -152,20 +168,20 @@ private function normalizeHeaderValue($value) */ private function trimHeaderValues(array $values) { - return \array_map(function ($value) { - if (!\is_scalar($value) && null !== $value) { - throw new \InvalidArgumentException(\sprintf('Header value must be scalar or null but %s provided.', \is_object($value) ? \get_class($value) : \gettype($value))); + return array_map(function ($value) { + if (!is_scalar($value) && null !== $value) { + throw new InvalidArgumentException(sprintf('Header value must be scalar or null but %s provided.', is_object($value) ? get_class($value) : gettype($value))); } - return \trim((string) $value, " \t"); + return trim((string) $value, " \t"); }, $values); } private function assertHeader($header) { - if (!\is_string($header)) { - throw new \InvalidArgumentException(\sprintf('Header name must be a string but %s provided.', \is_object($header) ? \get_class($header) : \gettype($header))); + if (!is_string($header)) { + throw new InvalidArgumentException(sprintf('Header name must be a string but %s provided.', is_object($header) ? get_class($header) : gettype($header))); } if ($header === '') { - throw new \InvalidArgumentException('Header name can not be empty.'); + throw new InvalidArgumentException('Header name can not be empty.'); } } } diff --git a/vendor/guzzlehttp/psr7/src/MultipartStream.php b/vendor/guzzlehttp/psr7/src/MultipartStream.php index 2813d1345..914419f69 100644 --- a/vendor/guzzlehttp/psr7/src/MultipartStream.php +++ b/vendor/guzzlehttp/psr7/src/MultipartStream.php @@ -3,11 +3,21 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7; use _PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface; +use InvalidArgumentException; +use function array_key_exists; +use function basename; +use function sha1; +use function sprintf; +use function strtolower; +use function substr; +use function trim; +use function uniqid; + /** * Stream that when read returns bytes for a streaming multipart or * multipart/form-data stream. */ -class MultipartStream implements \_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface +class MultipartStream implements StreamInterface { use StreamDecoratorTrait; private $boundary; @@ -21,11 +31,11 @@ class MultipartStream implements \_PhpScoper5ea00cc67502b\Psr\Http\Message\Strea * string to send as the filename in the part. * @param string $boundary You can optionally provide a specific boundary * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException */ public function __construct(array $elements = [], $boundary = null) { - $this->boundary = $boundary ?: \sha1(\uniqid('', \true)); + $this->boundary = $boundary ?: sha1(uniqid('', true)); $this->stream = $this->createStream($elements); } /** @@ -39,7 +49,7 @@ public function getBoundary() } public function isWritable() { - return \false; + return false; } /** * Get the headers needed before transferring the content of a POST file @@ -50,14 +60,14 @@ private function getHeaders(array $headers) foreach ($headers as $key => $value) { $str .= "{$key}: {$value}\r\n"; } - return "--{$this->boundary}\r\n" . \trim($str) . "\r\n\r\n"; + return "--{$this->boundary}\r\n" . trim($str) . "\r\n\r\n"; } /** * Create the aggregate stream that will be used to upload the POST data */ protected function createStream(array $elements) { - $stream = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\AppendStream(); + $stream = new AppendStream(); foreach ($elements as $element) { $this->addElement($stream, $element); } @@ -65,21 +75,21 @@ protected function createStream(array $elements) $stream->addStream(stream_for("--{$this->boundary}--\r\n")); return $stream; } - private function addElement(\_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\AppendStream $stream, array $element) + private function addElement(AppendStream $stream, array $element) { foreach (['contents', 'name'] as $key) { - if (!\array_key_exists($key, $element)) { - throw new \InvalidArgumentException("A '{$key}' key is required"); + if (!array_key_exists($key, $element)) { + throw new InvalidArgumentException("A '{$key}' key is required"); } } $element['contents'] = stream_for($element['contents']); if (empty($element['filename'])) { $uri = $element['contents']->getMetadata('uri'); - if (\substr($uri, 0, 6) !== 'php://') { + if (substr($uri, 0, 6) !== 'php://') { $element['filename'] = $uri; } } - list($body, $headers) = $this->createElement($element['name'], $element['contents'], isset($element['filename']) ? $element['filename'] : null, isset($element['headers']) ? $element['headers'] : []); + [$body, $headers] = $this->createElement($element['name'], $element['contents'], isset($element['filename']) ? $element['filename'] : null, isset($element['headers']) ? $element['headers'] : []); $stream->addStream(stream_for($this->getHeaders($headers))); $stream->addStream($body); $stream->addStream(stream_for("\r\n")); @@ -87,12 +97,12 @@ private function addElement(\_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\AppendStrea /** * @return array */ - private function createElement($name, \_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface $stream, $filename, array $headers) + private function createElement($name, StreamInterface $stream, $filename, array $headers) { // Set a default content-disposition header if one was no provided $disposition = $this->getHeader($headers, 'content-disposition'); if (!$disposition) { - $headers['Content-Disposition'] = $filename === '0' || $filename ? \sprintf('form-data; name="%s"; filename="%s"', $name, \basename($filename)) : "form-data; name=\"{$name}\""; + $headers['Content-Disposition'] = $filename === '0' || $filename ? sprintf('form-data; name="%s"; filename="%s"', $name, basename($filename)) : "form-data; name=\"{$name}\""; } // Set a default content-length header if one was no provided $length = $this->getHeader($headers, 'content-length'); @@ -112,9 +122,9 @@ private function createElement($name, \_PhpScoper5ea00cc67502b\Psr\Http\Message\ } private function getHeader(array $headers, $key) { - $lowercaseHeader = \strtolower($key); + $lowercaseHeader = strtolower($key); foreach ($headers as $k => $v) { - if (\strtolower($k) === $lowercaseHeader) { + if (strtolower($k) === $lowercaseHeader) { return $v; } } diff --git a/vendor/guzzlehttp/psr7/src/NoSeekStream.php b/vendor/guzzlehttp/psr7/src/NoSeekStream.php index 070e7b6cd..66a35cca4 100644 --- a/vendor/guzzlehttp/psr7/src/NoSeekStream.php +++ b/vendor/guzzlehttp/psr7/src/NoSeekStream.php @@ -3,18 +3,21 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7; use _PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface; +use RuntimeException; +use const SEEK_SET; + /** * Stream decorator that prevents a stream from being seeked */ -class NoSeekStream implements \_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface +class NoSeekStream implements StreamInterface { use StreamDecoratorTrait; - public function seek($offset, $whence = \SEEK_SET) + public function seek($offset, $whence = SEEK_SET) { - throw new \RuntimeException('Cannot seek a NoSeekStream'); + throw new RuntimeException('Cannot seek a NoSeekStream'); } public function isSeekable() { - return \false; + return false; } } diff --git a/vendor/guzzlehttp/psr7/src/PumpStream.php b/vendor/guzzlehttp/psr7/src/PumpStream.php index a6f41e64b..24191b550 100644 --- a/vendor/guzzlehttp/psr7/src/PumpStream.php +++ b/vendor/guzzlehttp/psr7/src/PumpStream.php @@ -3,6 +3,12 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7; use _PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface; +use Exception; +use RuntimeException; +use function call_user_func; +use function strlen; +use const SEEK_SET; + /** * Provides a read only stream that pumps data from a PHP callable. * @@ -13,7 +19,7 @@ * the read() function of the PumpStream. The provided callable MUST return * false when there is no more data to read. */ -class PumpStream implements \_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface +class PumpStream implements StreamInterface { /** @var callable */ private $source; @@ -40,13 +46,13 @@ public function __construct(callable $source, array $options = []) $this->source = $source; $this->size = isset($options['size']) ? $options['size'] : null; $this->metadata = isset($options['metadata']) ? $options['metadata'] : []; - $this->buffer = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\BufferStream(); + $this->buffer = new BufferStream(); } public function __toString() { try { return copy_to_string($this); - } catch (\Exception $e) { + } catch (Exception $e) { return ''; } } @@ -56,7 +62,7 @@ public function close() } public function detach() { - $this->tellPos = \false; + $this->tellPos = false; $this->source = null; } public function getSize() @@ -73,38 +79,38 @@ public function eof() } public function isSeekable() { - return \false; + return false; } public function rewind() { $this->seek(0); } - public function seek($offset, $whence = \SEEK_SET) + public function seek($offset, $whence = SEEK_SET) { - throw new \RuntimeException('Cannot seek a PumpStream'); + throw new RuntimeException('Cannot seek a PumpStream'); } public function isWritable() { - return \false; + return false; } public function write($string) { - throw new \RuntimeException('Cannot write to a PumpStream'); + throw new RuntimeException('Cannot write to a PumpStream'); } public function isReadable() { - return \true; + return true; } public function read($length) { $data = $this->buffer->read($length); - $readLen = \strlen($data); + $readLen = strlen($data); $this->tellPos += $readLen; $remaining = $length - $readLen; if ($remaining) { $this->pump($remaining); $data .= $this->buffer->read($remaining); - $this->tellPos += \strlen($data) - $readLen; + $this->tellPos += strlen($data) - $readLen; } return $data; } @@ -127,13 +133,13 @@ private function pump($length) { if ($this->source) { do { - $data = \call_user_func($this->source, $length); - if ($data === \false || $data === null) { + $data = call_user_func($this->source, $length); + if ($data === false || $data === null) { $this->source = null; return; } $this->buffer->write($data); - $length -= \strlen($data); + $length -= strlen($data); } while ($length > 0); } } diff --git a/vendor/guzzlehttp/psr7/src/Request.php b/vendor/guzzlehttp/psr7/src/Request.php index 0889cb6a9..69e529cc5 100644 --- a/vendor/guzzlehttp/psr7/src/Request.php +++ b/vendor/guzzlehttp/psr7/src/Request.php @@ -6,10 +6,14 @@ use _PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface; +use function is_string; +use function preg_match; +use function strtoupper; + /** * PSR-7 request implementation. */ -class Request implements \_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface +class Request implements RequestInterface { use MessageTrait; /** @var string */ @@ -28,10 +32,10 @@ class Request implements \_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterf public function __construct($method, $uri, array $headers = [], $body = null, $version = '1.1') { $this->assertMethod($method); - if (!$uri instanceof \_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface) { - $uri = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Uri($uri); + if (!$uri instanceof UriInterface) { + $uri = new Uri($uri); } - $this->method = \strtoupper($method); + $this->method = strtoupper($method); $this->uri = $uri; $this->setHeaders($headers); $this->protocol = $version; @@ -58,8 +62,8 @@ public function getRequestTarget() } public function withRequestTarget($requestTarget) { - if (\preg_match('#\\s#', $requestTarget)) { - throw new \InvalidArgumentException('Invalid request target provided; cannot contain whitespace'); + if (preg_match('#\\s#', $requestTarget)) { + throw new InvalidArgumentException('Invalid request target provided; cannot contain whitespace'); } $new = clone $this; $new->requestTarget = $requestTarget; @@ -73,14 +77,14 @@ public function withMethod($method) { $this->assertMethod($method); $new = clone $this; - $new->method = \strtoupper($method); + $new->method = strtoupper($method); return $new; } public function getUri() { return $this->uri; } - public function withUri(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $uri, $preserveHost = \false) + public function withUri(UriInterface $uri, $preserveHost = false) { if ($uri === $this->uri) { return $this; @@ -113,8 +117,8 @@ private function updateHostFromUri() } private function assertMethod($method) { - if (!\is_string($method) || $method === '') { - throw new \InvalidArgumentException('Method must be a non-empty string.'); + if (!is_string($method) || $method === '') { + throw new InvalidArgumentException('Method must be a non-empty string.'); } } } diff --git a/vendor/guzzlehttp/psr7/src/Response.php b/vendor/guzzlehttp/psr7/src/Response.php index c00d42ac6..c76a4a584 100644 --- a/vendor/guzzlehttp/psr7/src/Response.php +++ b/vendor/guzzlehttp/psr7/src/Response.php @@ -4,10 +4,14 @@ use _PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface; +use InvalidArgumentException; +use function filter_var; +use const FILTER_VALIDATE_INT; + /** * PSR-7 response implementation. */ -class Response implements \_PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface +class Response implements ResponseInterface { use MessageTrait; /** @var array Map of standard HTTP status code/reason phrases */ @@ -63,14 +67,14 @@ public function withStatus($code, $reasonPhrase = '') } private function assertStatusCodeIsInteger($statusCode) { - if (\filter_var($statusCode, \FILTER_VALIDATE_INT) === \false) { - throw new \InvalidArgumentException('Status code must be an integer value.'); + if (filter_var($statusCode, FILTER_VALIDATE_INT) === false) { + throw new InvalidArgumentException('Status code must be an integer value.'); } } private function assertStatusCodeRange($statusCode) { if ($statusCode < 100 || $statusCode >= 600) { - throw new \InvalidArgumentException('Status code must be an integer value between 1xx and 5xx.'); + throw new InvalidArgumentException('Status code must be an integer value between 1xx and 5xx.'); } } } diff --git a/vendor/guzzlehttp/psr7/src/Rfc7230.php b/vendor/guzzlehttp/psr7/src/Rfc7230.php index af28bb696..88288ebfc 100644 --- a/vendor/guzzlehttp/psr7/src/Rfc7230.php +++ b/vendor/guzzlehttp/psr7/src/Rfc7230.php @@ -13,6 +13,6 @@ final class Rfc7230 * @link https://github.com/amphp/http/blob/v1.0.1/src/Rfc7230.php#L12-L15 * @license https://github.com/amphp/http/blob/v1.0.1/LICENSE */ - const HEADER_REGEX = "(^([^()<>@,;:\\\"/[\\]?={}\1- ]++):[ \t]*+((?:[ \t]*+[!-~-]++)*+)[ \t]*+\r?\n)m"; + const HEADER_REGEX = "(^([^()<>@,;:\\\"/[\\]?={}\1- ]++):[ \t]*+((?:[ \t]*+[!-~�-�]++)*+)[ \t]*+\r?\n)m"; const HEADER_FOLD_REGEX = "(\r?\n[ \t]++)"; } diff --git a/vendor/guzzlehttp/psr7/src/ServerRequest.php b/vendor/guzzlehttp/psr7/src/ServerRequest.php index cf41f7cba..783588426 100644 --- a/vendor/guzzlehttp/psr7/src/ServerRequest.php +++ b/vendor/guzzlehttp/psr7/src/ServerRequest.php @@ -7,6 +7,13 @@ use _PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\UploadedFileInterface; +use function array_key_exists; +use function array_keys; +use function explode; +use function is_array; +use function parse_url; +use function str_replace; + /** * Server-side HTTP request * @@ -21,7 +28,7 @@ * implemented such that they retain the internal state of the current * message and return a new instance that contains the changed state. */ -class ServerRequest extends \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Request implements \_PhpScoper5ea00cc67502b\Psr\Http\Message\ServerRequestInterface +class ServerRequest extends Request implements ServerRequestInterface { /** * @var array @@ -71,15 +78,15 @@ public static function normalizeFiles(array $files) { $normalized = []; foreach ($files as $key => $value) { - if ($value instanceof \_PhpScoper5ea00cc67502b\Psr\Http\Message\UploadedFileInterface) { + if ($value instanceof UploadedFileInterface) { $normalized[$key] = $value; - } elseif (\is_array($value) && isset($value['tmp_name'])) { + } elseif (is_array($value) && isset($value['tmp_name'])) { $normalized[$key] = self::createUploadedFileFromSpec($value); - } elseif (\is_array($value)) { + } elseif (is_array($value)) { $normalized[$key] = self::normalizeFiles($value); continue; } else { - throw new \InvalidArgumentException('Invalid value in files specification'); + throw new InvalidArgumentException('Invalid value in files specification'); } } return $normalized; @@ -95,10 +102,10 @@ public static function normalizeFiles(array $files) */ private static function createUploadedFileFromSpec(array $value) { - if (\is_array($value['tmp_name'])) { + if (is_array($value['tmp_name'])) { return self::normalizeNestedFileSpec($value); } - return new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\UploadedFile($value['tmp_name'], (int) $value['size'], (int) $value['error'], $value['name'], $value['type']); + return new UploadedFile($value['tmp_name'], (int) $value['size'], (int) $value['error'], $value['name'], $value['type']); } /** * Normalize an array of file specifications. @@ -112,7 +119,7 @@ private static function createUploadedFileFromSpec(array $value) private static function normalizeNestedFileSpec(array $files = []) { $normalizedFiles = []; - foreach (\array_keys($files['tmp_name']) as $key) { + foreach (array_keys($files['tmp_name']) as $key) { $spec = ['tmp_name' => $files['tmp_name'][$key], 'size' => $files['size'][$key], 'error' => $files['error'][$key], 'name' => $files['name'][$key], 'type' => $files['type'][$key]]; $normalizedFiles[$key] = self::createUploadedFileFromSpec($spec); } @@ -133,16 +140,16 @@ public static function fromGlobals() $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET'; $headers = getallheaders(); $uri = self::getUriFromGlobals(); - $body = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\CachingStream(new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\LazyOpenStream('php://input', 'r+')); - $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? \str_replace('HTTP/', '', $_SERVER['SERVER_PROTOCOL']) : '1.1'; - $serverRequest = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\ServerRequest($method, $uri, $headers, $body, $protocol, $_SERVER); + $body = new CachingStream(new LazyOpenStream('php://input', 'r+')); + $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? str_replace('HTTP/', '', $_SERVER['SERVER_PROTOCOL']) : '1.1'; + $serverRequest = new ServerRequest($method, $uri, $headers, $body, $protocol, $_SERVER); return $serverRequest->withCookieParams($_COOKIE)->withQueryParams($_GET)->withParsedBody($_POST)->withUploadedFiles(self::normalizeFiles($_FILES)); } private static function extractHostAndPortFromAuthority($authority) { $uri = 'http://' . $authority; - $parts = \parse_url($uri); - if (\false === $parts) { + $parts = parse_url($uri); + if (false === $parts) { return [null, null]; } $host = isset($parts['host']) ? $parts['host'] : null; @@ -156,16 +163,16 @@ private static function extractHostAndPortFromAuthority($authority) */ public static function getUriFromGlobals() { - $uri = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Uri(''); + $uri = new Uri(''); $uri = $uri->withScheme(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http'); - $hasPort = \false; + $hasPort = false; if (isset($_SERVER['HTTP_HOST'])) { - list($host, $port) = self::extractHostAndPortFromAuthority($_SERVER['HTTP_HOST']); + [$host, $port] = self::extractHostAndPortFromAuthority($_SERVER['HTTP_HOST']); if ($host !== null) { $uri = $uri->withHost($host); } if ($port !== null) { - $hasPort = \true; + $hasPort = true; $uri = $uri->withPort($port); } } elseif (isset($_SERVER['SERVER_NAME'])) { @@ -176,12 +183,12 @@ public static function getUriFromGlobals() if (!$hasPort && isset($_SERVER['SERVER_PORT'])) { $uri = $uri->withPort($_SERVER['SERVER_PORT']); } - $hasQuery = \false; + $hasQuery = false; if (isset($_SERVER['REQUEST_URI'])) { - $requestUriParts = \explode('?', $_SERVER['REQUEST_URI'], 2); + $requestUriParts = explode('?', $_SERVER['REQUEST_URI'], 2); $uri = $uri->withPath($requestUriParts[0]); if (isset($requestUriParts[1])) { - $hasQuery = \true; + $hasQuery = true; $uri = $uri->withQuery($requestUriParts[1]); } } @@ -273,7 +280,7 @@ public function getAttributes() */ public function getAttribute($attribute, $default = null) { - if (\false === \array_key_exists($attribute, $this->attributes)) { + if (false === array_key_exists($attribute, $this->attributes)) { return $default; } return $this->attributes[$attribute]; @@ -292,7 +299,7 @@ public function withAttribute($attribute, $value) */ public function withoutAttribute($attribute) { - if (\false === \array_key_exists($attribute, $this->attributes)) { + if (false === array_key_exists($attribute, $this->attributes)) { return $this; } $new = clone $this; diff --git a/vendor/guzzlehttp/psr7/src/Stream.php b/vendor/guzzlehttp/psr7/src/Stream.php index e86b31b17..db2189553 100644 --- a/vendor/guzzlehttp/psr7/src/Stream.php +++ b/vendor/guzzlehttp/psr7/src/Stream.php @@ -3,12 +3,30 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7; use _PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface; +use Exception; +use InvalidArgumentException; +use RuntimeException; +use function clearstatcache; +use function fclose; +use function feof; +use function fread; +use function fseek; +use function fstat; +use function ftell; +use function fwrite; +use function is_resource; +use function preg_match; +use function stream_get_contents; +use function stream_get_meta_data; +use function var_export; +use const SEEK_SET; + /** * PHP stream implementation. * * @var $stream */ -class Stream implements \_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface +class Stream implements StreamInterface { /** * Resource modes. @@ -39,22 +57,22 @@ class Stream implements \_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterfac * @param resource $stream Stream resource to wrap. * @param array $options Associative array of options. * - * @throws \InvalidArgumentException if the stream is not a stream resource + * @throws InvalidArgumentException if the stream is not a stream resource */ public function __construct($stream, $options = []) { - if (!\is_resource($stream)) { - throw new \InvalidArgumentException('Stream must be a resource'); + if (!is_resource($stream)) { + throw new InvalidArgumentException('Stream must be a resource'); } if (isset($options['size'])) { $this->size = $options['size']; } $this->customMetadata = isset($options['metadata']) ? $options['metadata'] : []; $this->stream = $stream; - $meta = \stream_get_meta_data($this->stream); + $meta = stream_get_meta_data($this->stream); $this->seekable = $meta['seekable']; - $this->readable = (bool) \preg_match(self::READABLE_MODES, $meta['mode']); - $this->writable = (bool) \preg_match(self::WRITABLE_MODES, $meta['mode']); + $this->readable = (bool) preg_match(self::READABLE_MODES, $meta['mode']); + $this->writable = (bool) preg_match(self::WRITABLE_MODES, $meta['mode']); $this->uri = $this->getMetadata('uri'); } /** @@ -68,27 +86,27 @@ public function __toString() { try { $this->seek(0); - return (string) \stream_get_contents($this->stream); - } catch (\Exception $e) { + return (string) stream_get_contents($this->stream); + } catch (Exception $e) { return ''; } } public function getContents() { if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); + throw new RuntimeException('Stream is detached'); } - $contents = \stream_get_contents($this->stream); - if ($contents === \false) { - throw new \RuntimeException('Unable to read stream contents'); + $contents = stream_get_contents($this->stream); + if ($contents === false) { + throw new RuntimeException('Unable to read stream contents'); } return $contents; } public function close() { if (isset($this->stream)) { - if (\is_resource($this->stream)) { - \fclose($this->stream); + if (is_resource($this->stream)) { + fclose($this->stream); } $this->detach(); } @@ -101,7 +119,7 @@ public function detach() $result = $this->stream; unset($this->stream); $this->size = $this->uri = null; - $this->readable = $this->writable = $this->seekable = \false; + $this->readable = $this->writable = $this->seekable = false; return $result; } public function getSize() @@ -114,9 +132,9 @@ public function getSize() } // Clear the stat cache if the stream has a URI if ($this->uri) { - \clearstatcache(\true, $this->uri); + clearstatcache(true, $this->uri); } - $stats = \fstat($this->stream); + $stats = fstat($this->stream); if (isset($stats['size'])) { $this->size = $stats['size']; return $this->size; @@ -138,18 +156,18 @@ public function isSeekable() public function eof() { if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); + throw new RuntimeException('Stream is detached'); } - return \feof($this->stream); + return feof($this->stream); } public function tell() { if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); + throw new RuntimeException('Stream is detached'); } - $result = \ftell($this->stream); - if ($result === \false) { - throw new \RuntimeException('Unable to determine stream position'); + $result = ftell($this->stream); + if ($result === false) { + throw new RuntimeException('Unable to determine stream position'); } return $result; } @@ -157,52 +175,52 @@ public function rewind() { $this->seek(0); } - public function seek($offset, $whence = \SEEK_SET) + public function seek($offset, $whence = SEEK_SET) { $whence = (int) $whence; if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); + throw new RuntimeException('Stream is detached'); } if (!$this->seekable) { - throw new \RuntimeException('Stream is not seekable'); + throw new RuntimeException('Stream is not seekable'); } - if (\fseek($this->stream, $offset, $whence) === -1) { - throw new \RuntimeException('Unable to seek to stream position ' . $offset . ' with whence ' . \var_export($whence, \true)); + if (fseek($this->stream, $offset, $whence) === -1) { + throw new RuntimeException('Unable to seek to stream position ' . $offset . ' with whence ' . var_export($whence, true)); } } public function read($length) { if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); + throw new RuntimeException('Stream is detached'); } if (!$this->readable) { - throw new \RuntimeException('Cannot read from non-readable stream'); + throw new RuntimeException('Cannot read from non-readable stream'); } if ($length < 0) { - throw new \RuntimeException('Length parameter cannot be negative'); + throw new RuntimeException('Length parameter cannot be negative'); } if (0 === $length) { return ''; } - $string = \fread($this->stream, $length); - if (\false === $string) { - throw new \RuntimeException('Unable to read from stream'); + $string = fread($this->stream, $length); + if (false === $string) { + throw new RuntimeException('Unable to read from stream'); } return $string; } public function write($string) { if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); + throw new RuntimeException('Stream is detached'); } if (!$this->writable) { - throw new \RuntimeException('Cannot write to a non-writable stream'); + throw new RuntimeException('Cannot write to a non-writable stream'); } // We can't know the size after writing anything $this->size = null; - $result = \fwrite($this->stream, $string); - if ($result === \false) { - throw new \RuntimeException('Unable to write to stream'); + $result = fwrite($this->stream, $string); + if ($result === false) { + throw new RuntimeException('Unable to write to stream'); } return $result; } @@ -211,11 +229,11 @@ public function getMetadata($key = null) if (!isset($this->stream)) { return $key ? null : []; } elseif (!$key) { - return $this->customMetadata + \stream_get_meta_data($this->stream); + return $this->customMetadata + stream_get_meta_data($this->stream); } elseif (isset($this->customMetadata[$key])) { return $this->customMetadata[$key]; } - $meta = \stream_get_meta_data($this->stream); + $meta = stream_get_meta_data($this->stream); return isset($meta[$key]) ? $meta[$key] : null; } } diff --git a/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php b/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php index 461ed5c77..c9a9a9a58 100644 --- a/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php +++ b/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php @@ -3,6 +3,14 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7; use _PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface; +use BadMethodCallException; +use Exception; +use UnexpectedValueException; +use function call_user_func_array; +use function trigger_error; +use const E_USER_ERROR; +use const SEEK_SET; + /** * Stream decorator trait * @property StreamInterface stream @@ -12,7 +20,7 @@ trait StreamDecoratorTrait /** * @param StreamInterface $stream Stream to decorate */ - public function __construct(\_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface $stream) + public function __construct(StreamInterface $stream) { $this->stream = $stream; } @@ -30,7 +38,7 @@ public function __get($name) $this->stream = $this->createStream(); return $this->stream; } - throw new \UnexpectedValueException("{$name} not found on class"); + throw new UnexpectedValueException("{$name} not found on class"); } public function __toString() { @@ -39,9 +47,9 @@ public function __toString() $this->seek(0); } return $this->getContents(); - } catch (\Exception $e) { + } catch (Exception $e) { // Really, PHP? https://bugs.php.net/bug.php?id=53648 - \trigger_error('StreamDecorator::__toString exception: ' . (string) $e, \E_USER_ERROR); + trigger_error('StreamDecorator::__toString exception: ' . (string) $e, E_USER_ERROR); return ''; } } @@ -59,7 +67,7 @@ public function getContents() */ public function __call($method, array $args) { - $result = \call_user_func_array([$this->stream, $method], $args); + $result = call_user_func_array([$this->stream, $method], $args); // Always return the wrapped object if the result is a return $this return $result === $this->stream ? $this : $result; } @@ -103,7 +111,7 @@ public function rewind() { $this->seek(0); } - public function seek($offset, $whence = \SEEK_SET) + public function seek($offset, $whence = SEEK_SET) { $this->stream->seek($offset, $whence); } @@ -119,10 +127,10 @@ public function write($string) * Implement in subclasses to dynamically create streams when requested. * * @return StreamInterface - * @throws \BadMethodCallException + * @throws BadMethodCallException */ protected function createStream() { - throw new \BadMethodCallException('Not implemented'); + throw new BadMethodCallException('Not implemented'); } } diff --git a/vendor/guzzlehttp/psr7/src/StreamWrapper.php b/vendor/guzzlehttp/psr7/src/StreamWrapper.php index 1b3994db2..c4826fcd5 100644 --- a/vendor/guzzlehttp/psr7/src/StreamWrapper.php +++ b/vendor/guzzlehttp/psr7/src/StreamWrapper.php @@ -3,6 +3,14 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7; use _PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface; +use InvalidArgumentException; +use function fopen; +use function in_array; +use function stream_context_create; +use function stream_context_get_options; +use function stream_get_wrappers; +use function stream_wrapper_register; + /** * Converts Guzzle streams into PHP stream resources. */ @@ -20,9 +28,9 @@ class StreamWrapper * @param StreamInterface $stream The stream to get a resource for * * @return resource - * @throws \InvalidArgumentException if stream is not readable or writable + * @throws InvalidArgumentException if stream is not readable or writable */ - public static function getResource(\_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface $stream) + public static function getResource(StreamInterface $stream) { self::register(); if ($stream->isReadable()) { @@ -30,9 +38,9 @@ public static function getResource(\_PhpScoper5ea00cc67502b\Psr\Http\Message\Str } elseif ($stream->isWritable()) { $mode = 'w'; } else { - throw new \InvalidArgumentException('The stream must be readable, ' . 'writable, or both.'); + throw new InvalidArgumentException('The stream must be readable, ' . 'writable, or both.'); } - return \fopen('guzzle://stream', $mode, null, self::createStreamContext($stream)); + return fopen('guzzle://stream', $mode, null, self::createStreamContext($stream)); } /** * Creates a stream context that can be used to open a stream as a php stream resource. @@ -41,28 +49,28 @@ public static function getResource(\_PhpScoper5ea00cc67502b\Psr\Http\Message\Str * * @return resource */ - public static function createStreamContext(\_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface $stream) + public static function createStreamContext(StreamInterface $stream) { - return \stream_context_create(['guzzle' => ['stream' => $stream]]); + return stream_context_create(['guzzle' => ['stream' => $stream]]); } /** * Registers the stream wrapper if needed */ public static function register() { - if (!\in_array('guzzle', \stream_get_wrappers())) { - \stream_wrapper_register('guzzle', __CLASS__); + if (!in_array('guzzle', stream_get_wrappers())) { + stream_wrapper_register('guzzle', __CLASS__); } } public function stream_open($path, $mode, $options, &$opened_path) { - $options = \stream_context_get_options($this->context); + $options = stream_context_get_options($this->context); if (!isset($options['guzzle']['stream'])) { - return \false; + return false; } $this->mode = $mode; $this->stream = $options['guzzle']['stream']; - return \true; + return true; } public function stream_read($count) { @@ -83,7 +91,7 @@ public function stream_eof() public function stream_seek($offset, $whence) { $this->stream->seek($offset, $whence); - return \true; + return true; } public function stream_cast($cast_as) { diff --git a/vendor/guzzlehttp/psr7/src/UploadedFile.php b/vendor/guzzlehttp/psr7/src/UploadedFile.php index e143edd1c..252840b87 100644 --- a/vendor/guzzlehttp/psr7/src/UploadedFile.php +++ b/vendor/guzzlehttp/psr7/src/UploadedFile.php @@ -6,12 +6,30 @@ use _PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\UploadedFileInterface; use RuntimeException; -class UploadedFile implements \_PhpScoper5ea00cc67502b\Psr\Http\Message\UploadedFileInterface +use function gettype; +use function in_array; +use function is_int; +use function is_resource; +use function is_string; +use function move_uploaded_file; +use function php_sapi_name; +use function rename; +use function sprintf; +use const UPLOAD_ERR_CANT_WRITE; +use const UPLOAD_ERR_EXTENSION; +use const UPLOAD_ERR_FORM_SIZE; +use const UPLOAD_ERR_INI_SIZE; +use const UPLOAD_ERR_NO_FILE; +use const UPLOAD_ERR_NO_TMP_DIR; +use const UPLOAD_ERR_OK; +use const UPLOAD_ERR_PARTIAL; + +class UploadedFile implements UploadedFileInterface { /** * @var int[] */ - private static $errors = [\UPLOAD_ERR_OK, \UPLOAD_ERR_INI_SIZE, \UPLOAD_ERR_FORM_SIZE, \UPLOAD_ERR_PARTIAL, \UPLOAD_ERR_NO_FILE, \UPLOAD_ERR_NO_TMP_DIR, \UPLOAD_ERR_CANT_WRITE, \UPLOAD_ERR_EXTENSION]; + private static $errors = [UPLOAD_ERR_OK, UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_FORM_SIZE, UPLOAD_ERR_PARTIAL, UPLOAD_ERR_NO_FILE, UPLOAD_ERR_NO_TMP_DIR, UPLOAD_ERR_CANT_WRITE, UPLOAD_ERR_EXTENSION]; /** * @var string */ @@ -31,7 +49,7 @@ class UploadedFile implements \_PhpScoper5ea00cc67502b\Psr\Http\Message\Uploaded /** * @var bool */ - private $moved = \false; + private $moved = false; /** * @var int */ @@ -65,14 +83,14 @@ public function __construct($streamOrFile, $size, $errorStatus, $clientFilename */ private function setStreamOrFile($streamOrFile) { - if (\is_string($streamOrFile)) { + if (is_string($streamOrFile)) { $this->file = $streamOrFile; - } elseif (\is_resource($streamOrFile)) { - $this->stream = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Stream($streamOrFile); - } elseif ($streamOrFile instanceof \_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface) { + } elseif (is_resource($streamOrFile)) { + $this->stream = new Stream($streamOrFile); + } elseif ($streamOrFile instanceof StreamInterface) { $this->stream = $streamOrFile; } else { - throw new \InvalidArgumentException('Invalid stream or file provided for UploadedFile'); + throw new InvalidArgumentException('Invalid stream or file provided for UploadedFile'); } } /** @@ -81,11 +99,11 @@ private function setStreamOrFile($streamOrFile) */ private function setError($error) { - if (\false === \is_int($error)) { - throw new \InvalidArgumentException('Upload file error status must be an integer'); + if (false === is_int($error)) { + throw new InvalidArgumentException('Upload file error status must be an integer'); } - if (\false === \in_array($error, \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\UploadedFile::$errors)) { - throw new \InvalidArgumentException('Invalid error status for UploadedFile'); + if (false === in_array($error, UploadedFile::$errors)) { + throw new InvalidArgumentException('Invalid error status for UploadedFile'); } $this->error = $error; } @@ -95,8 +113,8 @@ private function setError($error) */ private function setSize($size) { - if (\false === \is_int($size)) { - throw new \InvalidArgumentException('Upload file size must be an integer'); + if (false === is_int($size)) { + throw new InvalidArgumentException('Upload file size must be an integer'); } $this->size = $size; } @@ -106,7 +124,7 @@ private function setSize($size) */ private function isStringOrNull($param) { - return \in_array(\gettype($param), ['string', 'NULL']); + return in_array(gettype($param), ['string', 'NULL']); } /** * @param mixed $param @@ -114,7 +132,7 @@ private function isStringOrNull($param) */ private function isStringNotEmpty($param) { - return \is_string($param) && \false === empty($param); + return is_string($param) && false === empty($param); } /** * @param string|null $clientFilename @@ -122,8 +140,8 @@ private function isStringNotEmpty($param) */ private function setClientFilename($clientFilename) { - if (\false === $this->isStringOrNull($clientFilename)) { - throw new \InvalidArgumentException('Upload file client filename must be a string or null'); + if (false === $this->isStringOrNull($clientFilename)) { + throw new InvalidArgumentException('Upload file client filename must be a string or null'); } $this->clientFilename = $clientFilename; } @@ -133,8 +151,8 @@ private function setClientFilename($clientFilename) */ private function setClientMediaType($clientMediaType) { - if (\false === $this->isStringOrNull($clientMediaType)) { - throw new \InvalidArgumentException('Upload file client media type must be a string or null'); + if (false === $this->isStringOrNull($clientMediaType)) { + throw new InvalidArgumentException('Upload file client media type must be a string or null'); } $this->clientMediaType = $clientMediaType; } @@ -145,7 +163,7 @@ private function setClientMediaType($clientMediaType) */ private function isOk() { - return $this->error === \UPLOAD_ERR_OK; + return $this->error === UPLOAD_ERR_OK; } /** * @return boolean @@ -159,11 +177,11 @@ public function isMoved() */ private function validateActive() { - if (\false === $this->isOk()) { - throw new \RuntimeException('Cannot retrieve stream due to upload error'); + if (false === $this->isOk()) { + throw new RuntimeException('Cannot retrieve stream due to upload error'); } if ($this->isMoved()) { - throw new \RuntimeException('Cannot retrieve stream after it has already been moved'); + throw new RuntimeException('Cannot retrieve stream after it has already been moved'); } } /** @@ -173,10 +191,10 @@ private function validateActive() public function getStream() { $this->validateActive(); - if ($this->stream instanceof \_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface) { + if ($this->stream instanceof StreamInterface) { return $this->stream; } - return new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\LazyOpenStream($this->file, 'r+'); + return new LazyOpenStream($this->file, 'r+'); } /** * {@inheritdoc} @@ -192,17 +210,17 @@ public function getStream() public function moveTo($targetPath) { $this->validateActive(); - if (\false === $this->isStringNotEmpty($targetPath)) { - throw new \InvalidArgumentException('Invalid path provided for move operation; must be a non-empty string'); + if (false === $this->isStringNotEmpty($targetPath)) { + throw new InvalidArgumentException('Invalid path provided for move operation; must be a non-empty string'); } if ($this->file) { - $this->moved = \php_sapi_name() == 'cli' ? \rename($this->file, $targetPath) : \move_uploaded_file($this->file, $targetPath); + $this->moved = php_sapi_name() == 'cli' ? rename($this->file, $targetPath) : move_uploaded_file($this->file, $targetPath); } else { - copy_to_stream($this->getStream(), new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\LazyOpenStream($targetPath, 'w')); - $this->moved = \true; + copy_to_stream($this->getStream(), new LazyOpenStream($targetPath, 'w')); + $this->moved = true; } - if (\false === $this->moved) { - throw new \RuntimeException(\sprintf('Uploaded file could not be moved to %s', $targetPath)); + if (false === $this->moved) { + throw new RuntimeException(sprintf('Uploaded file could not be moved to %s', $targetPath)); } } /** diff --git a/vendor/guzzlehttp/psr7/src/Uri.php b/vendor/guzzlehttp/psr7/src/Uri.php index 3b3d6bab1..40645e1e1 100644 --- a/vendor/guzzlehttp/psr7/src/Uri.php +++ b/vendor/guzzlehttp/psr7/src/Uri.php @@ -3,6 +3,25 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7; use _PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface; +use InvalidArgumentException; +use function array_filter; +use function array_keys; +use function array_map; +use function explode; +use function implode; +use function in_array; +use function is_string; +use function parse_url; +use function preg_replace_callback; +use function rawurldecode; +use function rawurlencode; +use function sprintf; +use function strpos; +use function strtolower; +use function strtr; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * PSR-7 URI implementation. * @@ -10,7 +29,7 @@ * @author Tobias Schultze * @author Matthew Weier O'Phinney */ -class Uri implements \_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface +class Uri implements UriInterface { /** * Absolute http and https URIs require a host per RFC 7230 Section 2.7 @@ -44,9 +63,9 @@ public function __construct($uri = '') { // weak type check to also accept null until we can add scalar type hints if ($uri != '') { - $parts = \parse_url($uri); - if ($parts === \false) { - throw new \InvalidArgumentException("Unable to parse URI: {$uri}"); + $parts = parse_url($uri); + if ($parts === false) { + throw new InvalidArgumentException("Unable to parse URI: {$uri}"); } $this->applyParts($parts); } @@ -110,7 +129,7 @@ public static function composeComponents($scheme, $authority, $path, $query, $fr * * @return bool */ - public static function isDefaultPort(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $uri) + public static function isDefaultPort(UriInterface $uri) { return $uri->getPort() === null || isset(self::$defaultPorts[$uri->getScheme()]) && $uri->getPort() === self::$defaultPorts[$uri->getScheme()]; } @@ -132,7 +151,7 @@ public static function isDefaultPort(\_PhpScoper5ea00cc67502b\Psr\Http\Message\U * @see Uri::isRelativePathReference * @link https://tools.ietf.org/html/rfc3986#section-4 */ - public static function isAbsolute(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $uri) + public static function isAbsolute(UriInterface $uri) { return $uri->getScheme() !== ''; } @@ -146,7 +165,7 @@ public static function isAbsolute(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriI * @return bool * @link https://tools.ietf.org/html/rfc3986#section-4.2 */ - public static function isNetworkPathReference(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $uri) + public static function isNetworkPathReference(UriInterface $uri) { return $uri->getScheme() === '' && $uri->getAuthority() !== ''; } @@ -160,7 +179,7 @@ public static function isNetworkPathReference(\_PhpScoper5ea00cc67502b\Psr\Http\ * @return bool * @link https://tools.ietf.org/html/rfc3986#section-4.2 */ - public static function isAbsolutePathReference(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $uri) + public static function isAbsolutePathReference(UriInterface $uri) { return $uri->getScheme() === '' && $uri->getAuthority() === '' && isset($uri->getPath()[0]) && $uri->getPath()[0] === '/'; } @@ -174,7 +193,7 @@ public static function isAbsolutePathReference(\_PhpScoper5ea00cc67502b\Psr\Http * @return bool * @link https://tools.ietf.org/html/rfc3986#section-4.2 */ - public static function isRelativePathReference(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $uri) + public static function isRelativePathReference(UriInterface $uri) { return $uri->getScheme() === '' && $uri->getAuthority() === '' && (!isset($uri->getPath()[0]) || $uri->getPath()[0] !== '/'); } @@ -191,10 +210,10 @@ public static function isRelativePathReference(\_PhpScoper5ea00cc67502b\Psr\Http * @return bool * @link https://tools.ietf.org/html/rfc3986#section-4.4 */ - public static function isSameDocumentReference(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $uri, \_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $base = null) + public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null) { if ($base !== null) { - $uri = \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\UriResolver::resolve($base, $uri); + $uri = UriResolver::resolve($base, $uri); return $uri->getScheme() === $base->getScheme() && $uri->getAuthority() === $base->getAuthority() && $uri->getPath() === $base->getPath() && $uri->getQuery() === $base->getQuery(); } return $uri->getScheme() === '' && $uri->getAuthority() === '' && $uri->getPath() === '' && $uri->getQuery() === ''; @@ -211,7 +230,7 @@ public static function isSameDocumentReference(\_PhpScoper5ea00cc67502b\Psr\Http */ public static function removeDotSegments($path) { - return \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\UriResolver::removeDotSegments($path); + return UriResolver::removeDotSegments($path); } /** * Converts the relative URI into a new URI that is resolved against the base URI. @@ -224,12 +243,12 @@ public static function removeDotSegments($path) * @deprecated since version 1.4. Use UriResolver::resolve instead. * @see UriResolver::resolve */ - public static function resolve(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $base, $rel) + public static function resolve(UriInterface $base, $rel) { - if (!$rel instanceof \_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface) { + if (!$rel instanceof UriInterface) { $rel = new self($rel); } - return \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\UriResolver::resolve($base, $rel); + return UriResolver::resolve($base, $rel); } /** * Creates a new URI with a specific query string value removed. @@ -242,10 +261,10 @@ public static function resolve(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInte * * @return UriInterface */ - public static function withoutQueryValue(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $uri, $key) + public static function withoutQueryValue(UriInterface $uri, $key) { $result = self::getFilteredQueryString($uri, [$key]); - return $uri->withQuery(\implode('&', $result)); + return $uri->withQuery(implode('&', $result)); } /** * Creates a new URI with a specific query string value. @@ -262,11 +281,11 @@ public static function withoutQueryValue(\_PhpScoper5ea00cc67502b\Psr\Http\Messa * * @return UriInterface */ - public static function withQueryValue(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $uri, $key, $value) + public static function withQueryValue(UriInterface $uri, $key, $value) { $result = self::getFilteredQueryString($uri, [$key]); $result[] = self::generateQueryString($key, $value); - return $uri->withQuery(\implode('&', $result)); + return $uri->withQuery(implode('&', $result)); } /** * Creates a new URI with multiple specific query string values. @@ -278,13 +297,13 @@ public static function withQueryValue(\_PhpScoper5ea00cc67502b\Psr\Http\Message\ * * @return UriInterface */ - public static function withQueryValues(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $uri, array $keyValueArray) + public static function withQueryValues(UriInterface $uri, array $keyValueArray) { - $result = self::getFilteredQueryString($uri, \array_keys($keyValueArray)); + $result = self::getFilteredQueryString($uri, array_keys($keyValueArray)); foreach ($keyValueArray as $key => $value) { $result[] = self::generateQueryString($key, $value); } - return $uri->withQuery(\implode('&', $result)); + return $uri->withQuery(implode('&', $result)); } /** * Creates a URI from a hash of `parse_url` components. @@ -294,7 +313,7 @@ public static function withQueryValues(\_PhpScoper5ea00cc67502b\Psr\Http\Message * @return UriInterface * @link http://php.net/manual/en/function.parse-url.php * - * @throws \InvalidArgumentException If the components do not form a valid URI. + * @throws InvalidArgumentException If the components do not form a valid URI. */ public static function fromParts(array $parts) { @@ -446,49 +465,49 @@ private function applyParts(array $parts) * * @return string * - * @throws \InvalidArgumentException If the scheme is invalid. + * @throws InvalidArgumentException If the scheme is invalid. */ private function filterScheme($scheme) { - if (!\is_string($scheme)) { - throw new \InvalidArgumentException('Scheme must be a string'); + if (!is_string($scheme)) { + throw new InvalidArgumentException('Scheme must be a string'); } - return \strtolower($scheme); + return strtolower($scheme); } /** * @param string $component * * @return string * - * @throws \InvalidArgumentException If the user info is invalid. + * @throws InvalidArgumentException If the user info is invalid. */ private function filterUserInfoComponent($component) { - if (!\is_string($component)) { - throw new \InvalidArgumentException('User info must be a string'); + if (!is_string($component)) { + throw new InvalidArgumentException('User info must be a string'); } - return \preg_replace_callback('/(?:[^%' . self::$charUnreserved . self::$charSubDelims . ']+|%(?![A-Fa-f0-9]{2}))/', [$this, 'rawurlencodeMatchZero'], $component); + return preg_replace_callback('/(?:[^%' . self::$charUnreserved . self::$charSubDelims . ']+|%(?![A-Fa-f0-9]{2}))/', [$this, 'rawurlencodeMatchZero'], $component); } /** * @param string $host * * @return string * - * @throws \InvalidArgumentException If the host is invalid. + * @throws InvalidArgumentException If the host is invalid. */ private function filterHost($host) { - if (!\is_string($host)) { - throw new \InvalidArgumentException('Host must be a string'); + if (!is_string($host)) { + throw new InvalidArgumentException('Host must be a string'); } - return \strtolower($host); + return strtolower($host); } /** * @param int|null $port * * @return int|null * - * @throws \InvalidArgumentException If the port is invalid. + * @throws InvalidArgumentException If the port is invalid. */ private function filterPort($port) { @@ -497,7 +516,7 @@ private function filterPort($port) } $port = (int) $port; if (0 > $port || 0xffff < $port) { - throw new \InvalidArgumentException(\sprintf('Invalid port: %d. Must be between 0 and 65535', $port)); + throw new InvalidArgumentException(sprintf('Invalid port: %d. Must be between 0 and 65535', $port)); } return $port; } @@ -507,15 +526,15 @@ private function filterPort($port) * * @return array */ - private static function getFilteredQueryString(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $uri, array $keys) + private static function getFilteredQueryString(UriInterface $uri, array $keys) { $current = $uri->getQuery(); if ($current === '') { return []; } - $decodedKeys = \array_map('rawurldecode', $keys); - return \array_filter(\explode('&', $current), function ($part) use($decodedKeys) { - return !\in_array(\rawurldecode(\explode('=', $part)[0]), $decodedKeys, \true); + $decodedKeys = array_map('rawurldecode', $keys); + return array_filter(explode('&', $current), function ($part) use($decodedKeys) { + return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true); }); } /** @@ -529,9 +548,9 @@ private static function generateQueryString($key, $value) // Query string separators ("=", "&") within the key or value need to be encoded // (while preventing double-encoding) before setting the query string. All other // chars that need percent-encoding will be encoded by withQuery(). - $queryString = \strtr($key, self::$replaceQuery); + $queryString = strtr($key, self::$replaceQuery); if ($value !== null) { - $queryString .= '=' . \strtr($value, self::$replaceQuery); + $queryString .= '=' . strtr($value, self::$replaceQuery); } return $queryString; } @@ -548,14 +567,14 @@ private function removeDefaultPort() * * @return string * - * @throws \InvalidArgumentException If the path is invalid. + * @throws InvalidArgumentException If the path is invalid. */ private function filterPath($path) { - if (!\is_string($path)) { - throw new \InvalidArgumentException('Path must be a string'); + if (!is_string($path)) { + throw new InvalidArgumentException('Path must be a string'); } - return \preg_replace_callback('/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\\/]++|%(?![A-Fa-f0-9]{2}))/', [$this, 'rawurlencodeMatchZero'], $path); + return preg_replace_callback('/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\\/]++|%(?![A-Fa-f0-9]{2}))/', [$this, 'rawurlencodeMatchZero'], $path); } /** * Filters the query string or fragment of a URI. @@ -564,18 +583,18 @@ private function filterPath($path) * * @return string * - * @throws \InvalidArgumentException If the query or fragment is invalid. + * @throws InvalidArgumentException If the query or fragment is invalid. */ private function filterQueryAndFragment($str) { - if (!\is_string($str)) { - throw new \InvalidArgumentException('Query and fragment must be a string'); + if (!is_string($str)) { + throw new InvalidArgumentException('Query and fragment must be a string'); } - return \preg_replace_callback('/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\\/\\?]++|%(?![A-Fa-f0-9]{2}))/', [$this, 'rawurlencodeMatchZero'], $str); + return preg_replace_callback('/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\\/\\?]++|%(?![A-Fa-f0-9]{2}))/', [$this, 'rawurlencodeMatchZero'], $str); } private function rawurlencodeMatchZero(array $match) { - return \rawurlencode($match[0]); + return rawurlencode($match[0]); } private function validateState() { @@ -583,14 +602,14 @@ private function validateState() $this->host = self::HTTP_DEFAULT_HOST; } if ($this->getAuthority() === '') { - if (0 === \strpos($this->path, '//')) { - throw new \InvalidArgumentException('The path of a URI without an authority must not start with two slashes "//"'); + if (0 === strpos($this->path, '//')) { + throw new InvalidArgumentException('The path of a URI without an authority must not start with two slashes "//"'); } - if ($this->scheme === '' && \false !== \strpos(\explode('/', $this->path, 2)[0], ':')) { - throw new \InvalidArgumentException('A relative URI must not have a path beginning with a segment containing a colon'); + if ($this->scheme === '' && false !== strpos(explode('/', $this->path, 2)[0], ':')) { + throw new InvalidArgumentException('A relative URI must not have a path beginning with a segment containing a colon'); } } elseif (isset($this->path[0]) && $this->path[0] !== '/') { - @\trigger_error('The path of a URI with an authority must start with a slash "/" or be empty. Automagically fixing the URI ' . 'by adding a leading slash to the path is deprecated since version 1.4 and will throw an exception instead.', \E_USER_DEPRECATED); + @trigger_error('The path of a URI with an authority must start with a slash "/" or be empty. Automagically fixing the URI ' . 'by adding a leading slash to the path is deprecated since version 1.4 and will throw an exception instead.', E_USER_DEPRECATED); $this->path = '/' . $this->path; //throw new \InvalidArgumentException('The path of a URI with an authority must start with a slash "/" or be empty'); } diff --git a/vendor/guzzlehttp/psr7/src/UriNormalizer.php b/vendor/guzzlehttp/psr7/src/UriNormalizer.php index 04946f619..094ab69db 100644 --- a/vendor/guzzlehttp/psr7/src/UriNormalizer.php +++ b/vendor/guzzlehttp/psr7/src/UriNormalizer.php @@ -3,6 +3,14 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7; use _PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface; +use function explode; +use function implode; +use function preg_replace; +use function preg_replace_callback; +use function rawurldecode; +use function sort; +use function strtoupper; + /** * Provides methods to normalize and compare URIs. * @@ -107,7 +115,7 @@ final class UriNormalizer * @return UriInterface The normalized URI * @link https://tools.ietf.org/html/rfc3986#section-6.2 */ - public static function normalize(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $uri, $flags = self::PRESERVING_NORMALIZATIONS) + public static function normalize(UriInterface $uri, $flags = self::PRESERVING_NORMALIZATIONS) { if ($flags & self::CAPITALIZE_PERCENT_ENCODING) { $uri = self::capitalizePercentEncoding($uri); @@ -121,19 +129,19 @@ public static function normalize(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriIn if ($flags & self::REMOVE_DEFAULT_HOST && $uri->getScheme() === 'file' && $uri->getHost() === 'localhost') { $uri = $uri->withHost(''); } - if ($flags & self::REMOVE_DEFAULT_PORT && $uri->getPort() !== null && \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Uri::isDefaultPort($uri)) { + if ($flags & self::REMOVE_DEFAULT_PORT && $uri->getPort() !== null && Uri::isDefaultPort($uri)) { $uri = $uri->withPort(null); } - if ($flags & self::REMOVE_DOT_SEGMENTS && !\_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Uri::isRelativePathReference($uri)) { - $uri = $uri->withPath(\_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\UriResolver::removeDotSegments($uri->getPath())); + if ($flags & self::REMOVE_DOT_SEGMENTS && !Uri::isRelativePathReference($uri)) { + $uri = $uri->withPath(UriResolver::removeDotSegments($uri->getPath())); } if ($flags & self::REMOVE_DUPLICATE_SLASHES) { - $uri = $uri->withPath(\preg_replace('#//++#', '/', $uri->getPath())); + $uri = $uri->withPath(preg_replace('#//++#', '/', $uri->getPath())); } if ($flags & self::SORT_QUERY_PARAMETERS && $uri->getQuery() !== '') { - $queryKeyValues = \explode('&', $uri->getQuery()); - \sort($queryKeyValues); - $uri = $uri->withQuery(\implode('&', $queryKeyValues)); + $queryKeyValues = explode('&', $uri->getQuery()); + sort($queryKeyValues); + $uri = $uri->withQuery(implode('&', $queryKeyValues)); } return $uri; } @@ -152,25 +160,25 @@ public static function normalize(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriIn * @return bool * @link https://tools.ietf.org/html/rfc3986#section-6.1 */ - public static function isEquivalent(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $uri1, \_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS) + public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS) { return (string) self::normalize($uri1, $normalizations) === (string) self::normalize($uri2, $normalizations); } - private static function capitalizePercentEncoding(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $uri) + private static function capitalizePercentEncoding(UriInterface $uri) { $regex = '/(?:%[A-Fa-f0-9]{2})++/'; $callback = function (array $match) { - return \strtoupper($match[0]); + return strtoupper($match[0]); }; - return $uri->withPath(\preg_replace_callback($regex, $callback, $uri->getPath()))->withQuery(\preg_replace_callback($regex, $callback, $uri->getQuery())); + return $uri->withPath(preg_replace_callback($regex, $callback, $uri->getPath()))->withQuery(preg_replace_callback($regex, $callback, $uri->getQuery())); } - private static function decodeUnreservedCharacters(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $uri) + private static function decodeUnreservedCharacters(UriInterface $uri) { $regex = '/%(?:2D|2E|5F|7E|3[0-9]|[46][1-9A-F]|[57][0-9A])/i'; $callback = function (array $match) { - return \rawurldecode($match[0]); + return rawurldecode($match[0]); }; - return $uri->withPath(\preg_replace_callback($regex, $callback, $uri->getPath()))->withQuery(\preg_replace_callback($regex, $callback, $uri->getQuery())); + return $uri->withPath(preg_replace_callback($regex, $callback, $uri->getPath()))->withQuery(preg_replace_callback($regex, $callback, $uri->getQuery())); } private function __construct() { diff --git a/vendor/guzzlehttp/psr7/src/UriResolver.php b/vendor/guzzlehttp/psr7/src/UriResolver.php index a5d50b508..feae7d0c6 100644 --- a/vendor/guzzlehttp/psr7/src/UriResolver.php +++ b/vendor/guzzlehttp/psr7/src/UriResolver.php @@ -3,6 +3,16 @@ namespace _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7; use _PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface; +use function array_pop; +use function count; +use function end; +use function explode; +use function implode; +use function str_repeat; +use function strpos; +use function strrpos; +use function substr; + /** * Resolves a URI reference in the context of a base URI and the opposite way. * @@ -26,15 +36,15 @@ public static function removeDotSegments($path) return $path; } $results = []; - $segments = \explode('/', $path); + $segments = explode('/', $path); foreach ($segments as $segment) { if ($segment === '..') { - \array_pop($results); + array_pop($results); } elseif ($segment !== '.') { $results[] = $segment; } } - $newPath = \implode('/', $results); + $newPath = implode('/', $results); if ($path[0] === '/' && (!isset($newPath[0]) || $newPath[0] !== '/')) { // Re-add the leading slash if necessary for cases like "/.." $newPath = '/' . $newPath; @@ -54,7 +64,7 @@ public static function removeDotSegments($path) * @return UriInterface * @link http://tools.ietf.org/html/rfc3986#section-5.2 */ - public static function resolve(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $base, \_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $rel) + public static function resolve(UriInterface $base, UriInterface $rel) { if ((string) $rel === '') { // we can simply return the same base URI instance for this same-document reference @@ -79,11 +89,11 @@ public static function resolve(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInte if ($targetAuthority != '' && $base->getPath() === '') { $targetPath = '/' . $rel->getPath(); } else { - $lastSlashPos = \strrpos($base->getPath(), '/'); - if ($lastSlashPos === \false) { + $lastSlashPos = strrpos($base->getPath(), '/'); + if ($lastSlashPos === false) { $targetPath = $rel->getPath(); } else { - $targetPath = \substr($base->getPath(), 0, $lastSlashPos + 1) . $rel->getPath(); + $targetPath = substr($base->getPath(), 0, $lastSlashPos + 1) . $rel->getPath(); } } } @@ -91,7 +101,7 @@ public static function resolve(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInte $targetQuery = $rel->getQuery(); } } - return new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Uri(\_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Uri::composeComponents($base->getScheme(), $targetAuthority, $targetPath, $targetQuery, $rel->getFragment())); + return new Uri(Uri::composeComponents($base->getScheme(), $targetAuthority, $targetPath, $targetQuery, $rel->getFragment())); } /** * Returns the target URI as a relative reference from the base URI. @@ -119,12 +129,12 @@ public static function resolve(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInte * * @return UriInterface The relative URI reference */ - public static function relativize(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $base, \_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $target) + public static function relativize(UriInterface $base, UriInterface $target) { if ($target->getScheme() !== '' && ($base->getScheme() !== $target->getScheme() || $target->getAuthority() === '' && $base->getAuthority() !== '')) { return $target; } - if (\_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Uri::isRelativePathReference($target)) { + if (Uri::isRelativePathReference($target)) { // As the target is already highly relative we return it as-is. It would be possible to resolve // the target with `$target = self::resolve($base, $target);` and then try make it more relative // by removing a duplicate query. But let's not do that automatically. @@ -147,18 +157,18 @@ public static function relativize(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriI // If the base URI has a query but the target has none, we cannot return an empty path reference as it would // inherit the base query component when resolving. if ($target->getQuery() === '') { - $segments = \explode('/', $target->getPath()); - $lastSegment = \end($segments); + $segments = explode('/', $target->getPath()); + $lastSegment = end($segments); return $emptyPathUri->withPath($lastSegment === '' ? './' : $lastSegment); } return $emptyPathUri; } - private static function getRelativePath(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $base, \_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $target) + private static function getRelativePath(UriInterface $base, UriInterface $target) { - $sourceSegments = \explode('/', $base->getPath()); - $targetSegments = \explode('/', $target->getPath()); - \array_pop($sourceSegments); - $targetLastSegment = \array_pop($targetSegments); + $sourceSegments = explode('/', $base->getPath()); + $targetSegments = explode('/', $target->getPath()); + array_pop($sourceSegments); + $targetLastSegment = array_pop($targetSegments); foreach ($sourceSegments as $i => $segment) { if (isset($targetSegments[$i]) && $segment === $targetSegments[$i]) { unset($sourceSegments[$i], $targetSegments[$i]); @@ -167,11 +177,11 @@ private static function getRelativePath(\_PhpScoper5ea00cc67502b\Psr\Http\Messag } } $targetSegments[] = $targetLastSegment; - $relativePath = \str_repeat('../', \count($sourceSegments)) . \implode('/', $targetSegments); + $relativePath = str_repeat('../', count($sourceSegments)) . implode('/', $targetSegments); // A reference to am empty last segment or an empty first sub-segment must be prefixed with "./". // This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used // as the first segment of a relative-path reference, as it would be mistaken for a scheme name. - if ('' === $relativePath || \false !== \strpos(\explode('/', $relativePath, 2)[0], ':')) { + if ('' === $relativePath || false !== strpos(explode('/', $relativePath, 2)[0], ':')) { $relativePath = "./{$relativePath}"; } elseif ('/' === $relativePath[0]) { if ($base->getAuthority() != '' && $base->getPath() === '') { diff --git a/vendor/guzzlehttp/psr7/src/functions.php b/vendor/guzzlehttp/psr7/src/functions.php index 05649c73d..7e5a3fc0b 100644 --- a/vendor/guzzlehttp/psr7/src/functions.php +++ b/vendor/guzzlehttp/psr7/src/functions.php @@ -8,6 +8,53 @@ use _PhpScoper5ea00cc67502b\Psr\Http\Message\ServerRequestInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface; +use InvalidArgumentException; +use Iterator; +use RuntimeException; +use function array_filter; +use function array_keys; +use function array_map; +use function count; +use function explode; +use function fopen; +use function fseek; +use function func_get_args; +use function fwrite; +use function gettype; +use function hash_final; +use function hash_init; +use function hash_update; +use function implode; +use function in_array; +use function is_array; +use function is_callable; +use function is_scalar; +use function is_string; +use function ltrim; +use function method_exists; +use function min; +use function pathinfo; +use function preg_match; +use function preg_match_all; +use function preg_replace; +use function preg_split; +use function rawurldecode; +use function reset; +use function restore_error_handler; +use function set_error_handler; +use function sprintf; +use function str_replace; +use function strlen; +use function strpos; +use function strtolower; +use function substr; +use function substr_count; +use function trim; +use const PATHINFO_EXTENSION; +use const PHP_QUERY_RFC1738; +use const PHP_QUERY_RFC3986; +use const PREG_SET_ORDER; + /** * Returns the string representation of an HTTP message. * @@ -15,20 +62,20 @@ * * @return string */ -function str(\_PhpScoper5ea00cc67502b\Psr\Http\Message\MessageInterface $message) +function str(MessageInterface $message) { - if ($message instanceof \_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface) { - $msg = \trim($message->getMethod() . ' ' . $message->getRequestTarget()) . ' HTTP/' . $message->getProtocolVersion(); + if ($message instanceof RequestInterface) { + $msg = trim($message->getMethod() . ' ' . $message->getRequestTarget()) . ' HTTP/' . $message->getProtocolVersion(); if (!$message->hasHeader('host')) { $msg .= "\r\nHost: " . $message->getUri()->getHost(); } - } elseif ($message instanceof \_PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface) { + } elseif ($message instanceof ResponseInterface) { $msg = 'HTTP/' . $message->getProtocolVersion() . ' ' . $message->getStatusCode() . ' ' . $message->getReasonPhrase(); } else { - throw new \InvalidArgumentException('Unknown message type'); + throw new InvalidArgumentException('Unknown message type'); } foreach ($message->getHeaders() as $name => $values) { - $msg .= "\r\n{$name}: " . \implode(', ', $values); + $msg .= "\r\n{$name}: " . implode(', ', $values); } return "{$msg}\r\n\r\n" . $message->getBody(); } @@ -42,16 +89,16 @@ function str(\_PhpScoper5ea00cc67502b\Psr\Http\Message\MessageInterface $message * @param string|UriInterface $uri * * @return UriInterface - * @throws \InvalidArgumentException + * @throws InvalidArgumentException */ function uri_for($uri) { - if ($uri instanceof \_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface) { + if ($uri instanceof UriInterface) { return $uri; - } elseif (\is_string($uri)) { - return new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Uri($uri); + } elseif (is_string($uri)) { + return new Uri($uri); } - throw new \InvalidArgumentException('URI must be a string or UriInterface'); + throw new InvalidArgumentException('URI must be a string or UriInterface'); } /** * Create a new stream based on the input type. @@ -60,48 +107,48 @@ function uri_for($uri) * - metadata: Array of custom metadata. * - size: Size of the stream. * - * @param resource|string|null|int|float|bool|StreamInterface|callable|\Iterator $resource Entity body data + * @param resource|string|null|int|float|bool|StreamInterface|callable|Iterator $resource Entity body data * @param array $options Additional options * * @return StreamInterface - * @throws \InvalidArgumentException if the $resource arg is not valid. + * @throws InvalidArgumentException if the $resource arg is not valid. */ function stream_for($resource = '', array $options = []) { - if (\is_scalar($resource)) { - $stream = \fopen('php://temp', 'r+'); + if (is_scalar($resource)) { + $stream = fopen('php://temp', 'r+'); if ($resource !== '') { - \fwrite($stream, $resource); - \fseek($stream, 0); + fwrite($stream, $resource); + fseek($stream, 0); } - return new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Stream($stream, $options); + return new Stream($stream, $options); } - switch (\gettype($resource)) { + switch (gettype($resource)) { case 'resource': - return new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Stream($resource, $options); + return new Stream($resource, $options); case 'object': - if ($resource instanceof \_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface) { + if ($resource instanceof StreamInterface) { return $resource; - } elseif ($resource instanceof \Iterator) { - return new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\PumpStream(function () use($resource) { + } elseif ($resource instanceof Iterator) { + return new PumpStream(function () use($resource) { if (!$resource->valid()) { - return \false; + return false; } $result = $resource->current(); $resource->next(); return $result; }, $options); - } elseif (\method_exists($resource, '__toString')) { + } elseif (method_exists($resource, '__toString')) { return stream_for((string) $resource, $options); } break; case 'NULL': - return new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Stream(\fopen('php://temp', 'r+'), $options); + return new Stream(fopen('php://temp', 'r+'), $options); } - if (\is_callable($resource)) { - return new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\PumpStream($resource, $options); + if (is_callable($resource)) { + return new PumpStream($resource, $options); } - throw new \InvalidArgumentException('Invalid resource type: ' . \gettype($resource)); + throw new InvalidArgumentException('Invalid resource type: ' . gettype($resource)); } /** * Parse an array of header values containing ";" separated data into an @@ -119,13 +166,13 @@ function parse_header($header) $params = $matches = []; foreach (normalize_header($header) as $val) { $part = []; - foreach (\preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) as $kvp) { - if (\preg_match_all('/<[^>]+>|[^=]+/', $kvp, $matches)) { + foreach (preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) as $kvp) { + if (preg_match_all('/<[^>]+>|[^=]+/', $kvp, $matches)) { $m = $matches[0]; if (isset($m[1])) { - $part[\trim($m[0], $trimmed)] = \trim($m[1], $trimmed); + $part[trim($m[0], $trimmed)] = trim($m[1], $trimmed); } else { - $part[] = \trim($m[0], $trimmed); + $part[] = trim($m[0], $trimmed); } } } @@ -145,18 +192,18 @@ function parse_header($header) */ function normalize_header($header) { - if (!\is_array($header)) { - return \array_map('trim', \explode(',', $header)); + if (!is_array($header)) { + return array_map('trim', explode(',', $header)); } $result = []; foreach ($header as $value) { foreach ((array) $value as $v) { - if (\strpos($v, ',') === \false) { + if (strpos($v, ',') === false) { $result[] = $v; continue; } - foreach (\preg_split('/,(?=([^"]*"[^"]*")*[^"]*$)/', $v) as $vv) { - $result[] = \trim($vv); + foreach (preg_split('/,(?=([^"]*"[^"]*")*[^"]*$)/', $v) as $vv) { + $result[] = trim($vv); } } } @@ -179,7 +226,7 @@ function normalize_header($header) * * @return RequestInterface */ -function modify_request(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface $request, array $changes) +function modify_request(RequestInterface $request, array $changes) { if (!$changes) { return $request; @@ -205,16 +252,16 @@ function modify_request(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterfa $headers = _caseless_remove($changes['remove_headers'], $headers); } if (!empty($changes['set_headers'])) { - $headers = _caseless_remove(\array_keys($changes['set_headers']), $headers); + $headers = _caseless_remove(array_keys($changes['set_headers']), $headers); $headers = $changes['set_headers'] + $headers; } if (isset($changes['query'])) { $uri = $uri->withQuery($changes['query']); } - if ($request instanceof \_PhpScoper5ea00cc67502b\Psr\Http\Message\ServerRequestInterface) { - return (new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\ServerRequest(isset($changes['method']) ? $changes['method'] : $request->getMethod(), $uri, $headers, isset($changes['body']) ? $changes['body'] : $request->getBody(), isset($changes['version']) ? $changes['version'] : $request->getProtocolVersion(), $request->getServerParams()))->withParsedBody($request->getParsedBody())->withQueryParams($request->getQueryParams())->withCookieParams($request->getCookieParams())->withUploadedFiles($request->getUploadedFiles()); + if ($request instanceof ServerRequestInterface) { + return (new ServerRequest(isset($changes['method']) ? $changes['method'] : $request->getMethod(), $uri, $headers, isset($changes['body']) ? $changes['body'] : $request->getBody(), isset($changes['version']) ? $changes['version'] : $request->getProtocolVersion(), $request->getServerParams()))->withParsedBody($request->getParsedBody())->withQueryParams($request->getQueryParams())->withCookieParams($request->getCookieParams())->withUploadedFiles($request->getUploadedFiles()); } - return new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Request(isset($changes['method']) ? $changes['method'] : $request->getMethod(), $uri, $headers, isset($changes['body']) ? $changes['body'] : $request->getBody(), isset($changes['version']) ? $changes['version'] : $request->getProtocolVersion()); + return new Request(isset($changes['method']) ? $changes['method'] : $request->getMethod(), $uri, $headers, isset($changes['body']) ? $changes['body'] : $request->getBody(), isset($changes['version']) ? $changes['version'] : $request->getProtocolVersion()); } /** * Attempts to rewind a message body and throws an exception on failure. @@ -224,9 +271,9 @@ function modify_request(\_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterfa * * @param MessageInterface $message Message to rewind * - * @throws \RuntimeException + * @throws RuntimeException */ -function rewind_body(\_PhpScoper5ea00cc67502b\Psr\Http\Message\MessageInterface $message) +function rewind_body(MessageInterface $message) { $body = $message->getBody(); if ($body->tell()) { @@ -243,18 +290,18 @@ function rewind_body(\_PhpScoper5ea00cc67502b\Psr\Http\Message\MessageInterface * @param string $mode Mode used to open the file * * @return resource - * @throws \RuntimeException if the file cannot be opened + * @throws RuntimeException if the file cannot be opened */ function try_fopen($filename, $mode) { $ex = null; - \set_error_handler(function () use($filename, $mode, &$ex) { - $ex = new \RuntimeException(\sprintf('Unable to open %s using mode %s: %s', $filename, $mode, \func_get_args()[1])); + set_error_handler(function () use($filename, $mode, &$ex) { + $ex = new RuntimeException(sprintf('Unable to open %s using mode %s: %s', $filename, $mode, func_get_args()[1])); }); - $handle = \fopen($filename, $mode); - \restore_error_handler(); + $handle = fopen($filename, $mode); + restore_error_handler(); if ($ex) { - /** @var $ex \RuntimeException */ + /** @var $ex RuntimeException */ throw $ex; } return $handle; @@ -267,9 +314,9 @@ function try_fopen($filename, $mode) * @param int $maxLen Maximum number of bytes to read. Pass -1 * to read the entire stream. * @return string - * @throws \RuntimeException on error. + * @throws RuntimeException on error. */ -function copy_to_string(\_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface $stream, $maxLen = -1) +function copy_to_string(StreamInterface $stream, $maxLen = -1) { $buffer = ''; if ($maxLen === -1) { @@ -291,7 +338,7 @@ function copy_to_string(\_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterfac break; } $buffer .= $buf; - $len = \strlen($buffer); + $len = strlen($buffer); } return $buffer; } @@ -304,9 +351,9 @@ function copy_to_string(\_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterfac * @param int $maxLen Maximum number of bytes to read. Pass -1 * to read the entire stream. * - * @throws \RuntimeException on error. + * @throws RuntimeException on error. */ -function copy_to_stream(\_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface $source, \_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface $dest, $maxLen = -1) +function copy_to_stream(StreamInterface $source, StreamInterface $dest, $maxLen = -1) { $bufferSize = 8192; if ($maxLen === -1) { @@ -318,8 +365,8 @@ function copy_to_stream(\_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterfac } else { $remaining = $maxLen; while ($remaining > 0 && !$source->eof()) { - $buf = $source->read(\min($bufferSize, $remaining)); - $len = \strlen($buf); + $buf = $source->read(min($bufferSize, $remaining)); + $len = strlen($buf); if (!$len) { break; } @@ -336,19 +383,19 @@ function copy_to_stream(\_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterfac * @param bool $rawOutput Whether or not to use raw output * * @return string Returns the hash of the stream - * @throws \RuntimeException on error. + * @throws RuntimeException on error. */ -function hash(\_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface $stream, $algo, $rawOutput = \false) +function hash(StreamInterface $stream, $algo, $rawOutput = false) { $pos = $stream->tell(); if ($pos > 0) { $stream->rewind(); } - $ctx = \hash_init($algo); + $ctx = hash_init($algo); while (!$stream->eof()) { - \hash_update($ctx, $stream->read(1048576)); + hash_update($ctx, $stream->read(1048576)); } - $out = \hash_final($ctx, (bool) $rawOutput); + $out = hash_final($ctx, (bool) $rawOutput); $stream->seek($pos); return $out; } @@ -360,7 +407,7 @@ function hash(\_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface $stream, * * @return string */ -function readline(\_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface $stream, $maxLength = null) +function readline(StreamInterface $stream, $maxLength = null) { $buffer = ''; $size = 0; @@ -388,12 +435,12 @@ function parse_request($message) { $data = _parse_message($message); $matches = []; - if (!\preg_match('/^[\\S]+\\s+([a-zA-Z]+:\\/\\/|\\/).*/', $data['start-line'], $matches)) { - throw new \InvalidArgumentException('Invalid request string'); + if (!preg_match('/^[\\S]+\\s+([a-zA-Z]+:\\/\\/|\\/).*/', $data['start-line'], $matches)) { + throw new InvalidArgumentException('Invalid request string'); } - $parts = \explode(' ', $data['start-line'], 3); - $version = isset($parts[2]) ? \explode('/', $parts[2])[1] : '1.1'; - $request = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Request($parts[0], $matches[1] === '/' ? _parse_request_uri($parts[1], $data['headers']) : $parts[1], $data['headers'], $data['body'], $version); + $parts = explode(' ', $data['start-line'], 3); + $version = isset($parts[2]) ? explode('/', $parts[2])[1] : '1.1'; + $request = new Request($parts[0], $matches[1] === '/' ? _parse_request_uri($parts[1], $data['headers']) : $parts[1], $data['headers'], $data['body'], $version); return $matches[1] === '/' ? $request : $request->withRequestTarget($parts[1]); } /** @@ -409,11 +456,11 @@ function parse_response($message) // According to https://tools.ietf.org/html/rfc7230#section-3.1.2 the space // between status-code and reason-phrase is required. But browsers accept // responses without space and reason as well. - if (!\preg_match('/^HTTP\\/.* [0-9]{3}( .*|$)/', $data['start-line'])) { - throw new \InvalidArgumentException('Invalid response string: ' . $data['start-line']); + if (!preg_match('/^HTTP\\/.* [0-9]{3}( .*|$)/', $data['start-line'])) { + throw new InvalidArgumentException('Invalid response string: ' . $data['start-line']); } - $parts = \explode(' ', $data['start-line'], 3); - return new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Response($parts[1], $data['headers'], $data['body'], \explode('/', $parts[0])[1], isset($parts[2]) ? $parts[2] : null); + $parts = explode(' ', $data['start-line'], 3); + return new Response($parts[1], $data['headers'], $data['body'], explode('/', $parts[0])[1], isset($parts[2]) ? $parts[2] : null); } /** * Parse a query string into an associative array. @@ -428,33 +475,33 @@ function parse_response($message) * * @return array */ -function parse_query($str, $urlEncoding = \true) +function parse_query($str, $urlEncoding = true) { $result = []; if ($str === '') { return $result; } - if ($urlEncoding === \true) { + if ($urlEncoding === true) { $decoder = function ($value) { - return \rawurldecode(\str_replace('+', ' ', $value)); + return rawurldecode(str_replace('+', ' ', $value)); }; - } elseif ($urlEncoding === \PHP_QUERY_RFC3986) { + } elseif ($urlEncoding === PHP_QUERY_RFC3986) { $decoder = 'rawurldecode'; - } elseif ($urlEncoding === \PHP_QUERY_RFC1738) { + } elseif ($urlEncoding === PHP_QUERY_RFC1738) { $decoder = 'urldecode'; } else { $decoder = function ($str) { return $str; }; } - foreach (\explode('&', $str) as $kvp) { - $parts = \explode('=', $kvp, 2); + foreach (explode('&', $str) as $kvp) { + $parts = explode('=', $kvp, 2); $key = $decoder($parts[0]); $value = isset($parts[1]) ? $decoder($parts[1]) : null; if (!isset($result[$key])) { $result[$key] = $value; } else { - if (!\is_array($result[$key])) { + if (!is_array($result[$key])) { $result[$key] = [$result[$key]]; } $result[$key][] = $value; @@ -475,26 +522,26 @@ function parse_query($str, $urlEncoding = \true) * to encode using RFC1738. * @return string */ -function build_query(array $params, $encoding = \PHP_QUERY_RFC3986) +function build_query(array $params, $encoding = PHP_QUERY_RFC3986) { if (!$params) { return ''; } - if ($encoding === \false) { + if ($encoding === false) { $encoder = function ($str) { return $str; }; - } elseif ($encoding === \PHP_QUERY_RFC3986) { + } elseif ($encoding === PHP_QUERY_RFC3986) { $encoder = 'rawurlencode'; - } elseif ($encoding === \PHP_QUERY_RFC1738) { + } elseif ($encoding === PHP_QUERY_RFC1738) { $encoder = 'urlencode'; } else { - throw new \InvalidArgumentException('Invalid type'); + throw new InvalidArgumentException('Invalid type'); } $qs = ''; foreach ($params as $k => $v) { $k = $encoder($k); - if (!\is_array($v)) { + if (!is_array($v)) { $qs .= $k; if ($v !== null) { $qs .= '=' . $encoder($v); @@ -510,7 +557,7 @@ function build_query(array $params, $encoding = \PHP_QUERY_RFC3986) } } } - return $qs ? (string) \substr($qs, 0, -1) : ''; + return $qs ? (string) substr($qs, 0, -1) : ''; } /** * Determines the mimetype of a file by looking at its extension. @@ -521,7 +568,7 @@ function build_query(array $params, $encoding = \PHP_QUERY_RFC3986) */ function mimetype_from_filename($filename) { - return mimetype_from_extension(\pathinfo($filename, \PATHINFO_EXTENSION)); + return mimetype_from_extension(pathinfo($filename, PATHINFO_EXTENSION)); } /** * Maps a file extensions to a mimetype. @@ -534,7 +581,7 @@ function mimetype_from_filename($filename) function mimetype_from_extension($extension) { static $mimetypes = ['3gp' => 'video/3gpp', '7z' => 'application/x-7z-compressed', 'aac' => 'audio/x-aac', 'ai' => 'application/postscript', 'aif' => 'audio/x-aiff', 'asc' => 'text/plain', 'asf' => 'video/x-ms-asf', 'atom' => 'application/atom+xml', 'avi' => 'video/x-msvideo', 'bmp' => 'image/bmp', 'bz2' => 'application/x-bzip2', 'cer' => 'application/pkix-cert', 'crl' => 'application/pkix-crl', 'crt' => 'application/x-x509-ca-cert', 'css' => 'text/css', 'csv' => 'text/csv', 'cu' => 'application/cu-seeme', 'deb' => 'application/x-debian-package', 'doc' => 'application/msword', 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'dvi' => 'application/x-dvi', 'eot' => 'application/vnd.ms-fontobject', 'eps' => 'application/postscript', 'epub' => 'application/epub+zip', 'etx' => 'text/x-setext', 'flac' => 'audio/flac', 'flv' => 'video/x-flv', 'gif' => 'image/gif', 'gz' => 'application/gzip', 'htm' => 'text/html', 'html' => 'text/html', 'ico' => 'image/x-icon', 'ics' => 'text/calendar', 'ini' => 'text/plain', 'iso' => 'application/x-iso9660-image', 'jar' => 'application/java-archive', 'jpe' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpeg', 'js' => 'text/javascript', 'json' => 'application/json', 'latex' => 'application/x-latex', 'log' => 'text/plain', 'm4a' => 'audio/mp4', 'm4v' => 'video/mp4', 'mid' => 'audio/midi', 'midi' => 'audio/midi', 'mov' => 'video/quicktime', 'mkv' => 'video/x-matroska', 'mp3' => 'audio/mpeg', 'mp4' => 'video/mp4', 'mp4a' => 'audio/mp4', 'mp4v' => 'video/mp4', 'mpe' => 'video/mpeg', 'mpeg' => 'video/mpeg', 'mpg' => 'video/mpeg', 'mpg4' => 'video/mp4', 'oga' => 'audio/ogg', 'ogg' => 'audio/ogg', 'ogv' => 'video/ogg', 'ogx' => 'application/ogg', 'pbm' => 'image/x-portable-bitmap', 'pdf' => 'application/pdf', 'pgm' => 'image/x-portable-graymap', 'png' => 'image/png', 'pnm' => 'image/x-portable-anymap', 'ppm' => 'image/x-portable-pixmap', 'ppt' => 'application/vnd.ms-powerpoint', 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'ps' => 'application/postscript', 'qt' => 'video/quicktime', 'rar' => 'application/x-rar-compressed', 'ras' => 'image/x-cmu-raster', 'rss' => 'application/rss+xml', 'rtf' => 'application/rtf', 'sgm' => 'text/sgml', 'sgml' => 'text/sgml', 'svg' => 'image/svg+xml', 'swf' => 'application/x-shockwave-flash', 'tar' => 'application/x-tar', 'tif' => 'image/tiff', 'tiff' => 'image/tiff', 'torrent' => 'application/x-bittorrent', 'ttf' => 'application/x-font-ttf', 'txt' => 'text/plain', 'wav' => 'audio/x-wav', 'webm' => 'video/webm', 'webp' => 'image/webp', 'wma' => 'audio/x-ms-wma', 'wmv' => 'video/x-ms-wmv', 'woff' => 'application/x-font-woff', 'wsdl' => 'application/wsdl+xml', 'xbm' => 'image/x-xbitmap', 'xls' => 'application/vnd.ms-excel', 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'xml' => 'application/xml', 'xpm' => 'image/x-xpixmap', 'xwd' => 'image/x-xwindowdump', 'yaml' => 'text/yaml', 'yml' => 'text/yaml', 'zip' => 'application/zip']; - $extension = \strtolower($extension); + $extension = strtolower($extension); return isset($mimetypes[$extension]) ? $mimetypes[$extension] : null; } /** @@ -552,34 +599,34 @@ function mimetype_from_extension($extension) function _parse_message($message) { if (!$message) { - throw new \InvalidArgumentException('Invalid message'); + throw new InvalidArgumentException('Invalid message'); } - $message = \ltrim($message, "\r\n"); - $messageParts = \preg_split("/\r?\n\r?\n/", $message, 2); - if ($messageParts === \false || \count($messageParts) !== 2) { - throw new \InvalidArgumentException('Invalid message: Missing header delimiter'); + $message = ltrim($message, "\r\n"); + $messageParts = preg_split("/\r?\n\r?\n/", $message, 2); + if ($messageParts === false || count($messageParts) !== 2) { + throw new InvalidArgumentException('Invalid message: Missing header delimiter'); } - list($rawHeaders, $body) = $messageParts; + [$rawHeaders, $body] = $messageParts; $rawHeaders .= "\r\n"; // Put back the delimiter we split previously - $headerParts = \preg_split("/\r?\n/", $rawHeaders, 2); - if ($headerParts === \false || \count($headerParts) !== 2) { - throw new \InvalidArgumentException('Invalid message: Missing status line'); + $headerParts = preg_split("/\r?\n/", $rawHeaders, 2); + if ($headerParts === false || count($headerParts) !== 2) { + throw new InvalidArgumentException('Invalid message: Missing status line'); } - list($startLine, $rawHeaders) = $headerParts; - if (\preg_match("/(?:^HTTP\\/|^[A-Z]+ \\S+ HTTP\\/)(\\d+(?:\\.\\d+)?)/i", $startLine, $matches) && $matches[1] === '1.0') { + [$startLine, $rawHeaders] = $headerParts; + if (preg_match("/(?:^HTTP\\/|^[A-Z]+ \\S+ HTTP\\/)(\\d+(?:\\.\\d+)?)/i", $startLine, $matches) && $matches[1] === '1.0') { // Header folding is deprecated for HTTP/1.1, but allowed in HTTP/1.0 - $rawHeaders = \preg_replace(\_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Rfc7230::HEADER_FOLD_REGEX, ' ', $rawHeaders); + $rawHeaders = preg_replace(Rfc7230::HEADER_FOLD_REGEX, ' ', $rawHeaders); } /** @var array[] $headerLines */ - $count = \preg_match_all(\_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Rfc7230::HEADER_REGEX, $rawHeaders, $headerLines, \PREG_SET_ORDER); + $count = preg_match_all(Rfc7230::HEADER_REGEX, $rawHeaders, $headerLines, PREG_SET_ORDER); // If these aren't the same, then one line didn't match and there's an invalid header. - if ($count !== \substr_count($rawHeaders, "\n")) { + if ($count !== substr_count($rawHeaders, "\n")) { // Folding is deprecated, see https://tools.ietf.org/html/rfc7230#section-3.2.4 - if (\preg_match(\_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Rfc7230::HEADER_FOLD_REGEX, $rawHeaders)) { - throw new \InvalidArgumentException('Invalid header syntax: Obsolete line folding'); + if (preg_match(Rfc7230::HEADER_FOLD_REGEX, $rawHeaders)) { + throw new InvalidArgumentException('Invalid header syntax: Obsolete line folding'); } - throw new \InvalidArgumentException('Invalid header syntax'); + throw new InvalidArgumentException('Invalid header syntax'); } $headers = []; foreach ($headerLines as $headerLine) { @@ -598,16 +645,16 @@ function _parse_message($message) */ function _parse_request_uri($path, array $headers) { - $hostKey = \array_filter(\array_keys($headers), function ($k) { - return \strtolower($k) === 'host'; + $hostKey = array_filter(array_keys($headers), function ($k) { + return strtolower($k) === 'host'; }); // If no host is found, then a full URI cannot be constructed. if (!$hostKey) { return $path; } - $host = $headers[\reset($hostKey)][0]; - $scheme = \substr($host, -4) === ':443' ? 'https' : 'http'; - return $scheme . '://' . $host . '/' . \ltrim($path, '/'); + $host = $headers[reset($hostKey)][0]; + $scheme = substr($host, -4) === ':443' ? 'https' : 'http'; + return $scheme . '://' . $host . '/' . ltrim($path, '/'); } /** * Get a short summary of the message body @@ -619,7 +666,7 @@ function _parse_request_uri($path, array $headers) * * @return null|string */ -function get_message_body_summary(\_PhpScoper5ea00cc67502b\Psr\Http\Message\MessageInterface $message, $truncateAt = 120) +function get_message_body_summary(MessageInterface $message, $truncateAt = 120) { $body = $message->getBody(); if (!$body->isSeekable() || !$body->isReadable()) { @@ -636,7 +683,7 @@ function get_message_body_summary(\_PhpScoper5ea00cc67502b\Psr\Http\Message\Mess } // Matches any printable character, including unicode characters: // letters, marks, numbers, punctuation, spacing, and separators. - if (\preg_match('/[^\\pL\\pM\\pN\\pP\\pS\\pZ\\n\\r\\t]/', $summary)) { + if (preg_match('/[^\\pL\\pM\\pN\\pP\\pS\\pZ\\n\\r\\t]/', $summary)) { return null; } return $summary; @@ -646,10 +693,10 @@ function _caseless_remove($keys, array $data) { $result = []; foreach ($keys as &$key) { - $key = \strtolower($key); + $key = strtolower($key); } foreach ($data as $k => $v) { - if (!\in_array(\strtolower($k), $keys)) { + if (!in_array(strtolower($k), $keys)) { $result[$k] = $v; } } diff --git a/vendor/guzzlehttp/psr7/src/functions_include.php b/vendor/guzzlehttp/psr7/src/functions_include.php index ee4493e37..8b368500e 100644 --- a/vendor/guzzlehttp/psr7/src/functions_include.php +++ b/vendor/guzzlehttp/psr7/src/functions_include.php @@ -3,6 +3,8 @@ namespace _PhpScoper5ea00cc67502b; // Don't redefine the functions if included multiple times. -if (!\function_exists('_PhpScoper5ea00cc67502b\\GuzzleHttp\\Psr7\\str')) { +use function function_exists; + +if (!function_exists('_PhpScoper5ea00cc67502b\\GuzzleHttp\\Psr7\\str')) { require __DIR__ . '/functions.php'; } diff --git a/vendor/guzzlehttp/psr7/src/index.php b/vendor/guzzlehttp/psr7/src/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/index.php b/vendor/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/mollie/index.php b/vendor/mollie/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/mollie/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/mollie/mollie-api-php/README.md b/vendor/mollie/mollie-api-php/README.md index 805d9a4de..ca26ca5dd 100644 --- a/vendor/mollie/mollie-api-php/README.md +++ b/vendor/mollie/mollie-api-php/README.md @@ -60,7 +60,7 @@ Find our full documentation online on [docs.mollie.com](https://docs.mollie.com) Initializing the Mollie API client, and setting your API key. ```php -$mollie = new \Mollie\Api\MollieApiClient(); +use Mollie\Api\MollieApiClient;$mollie = new MollieApiClient(); $mollie->setApiKey("test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM"); ``` @@ -141,7 +141,7 @@ the payment. Retrieve the iDEAL method and include the issuers ```php -$method = $mollie->methods->get(\Mollie\Api\Types\PaymentMethod::IDEAL, ["include" => "issuers"]); +use Mollie\Api\Types\PaymentMethod;$method = $mollie->methods->get(PaymentMethod::IDEAL, ["include" => "issuers"]); ``` _`$method->issuers` will be a list of objects. Use the property `$id` of this object in the @@ -158,7 +158,7 @@ $payment = $mollie->payments->create([ "description" => "My first API payment", "redirectUrl" => "https://webshop.example.org/order/12345/", "webhookUrl" => "https://webshop.example.org/mollie-webhook/", - "method" => \Mollie\Api\Types\PaymentMethod::IDEAL, + "method" => PaymentMethod::IDEAL, "issuer" => $selectedIssuerId, // e.g. "ideal_INGBNL2A" ]); ``` diff --git a/vendor/mollie/mollie-api-php/examples/captures/get-capture.php b/vendor/mollie/mollie-api-php/examples/captures/get-capture.php index 191a02cf5..7b02baad9 100644 --- a/vendor/mollie/mollie-api-php/examples/captures/get-capture.php +++ b/vendor/mollie/mollie-api-php/examples/captures/get-capture.php @@ -5,6 +5,10 @@ /* * Retrieve a payment capture using the Mollie API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -20,6 +24,6 @@ $capture = $payment->getCapture('cpt_4qqhO89gsT'); $amount = $capture->amount->currency . ' ' . $capture->amount->value; echo 'Captured ' . $amount; -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/captures/index.php b/vendor/mollie/mollie-api-php/examples/captures/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/mollie/mollie-api-php/examples/captures/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/mollie/mollie-api-php/examples/captures/list-captures.php b/vendor/mollie/mollie-api-php/examples/captures/list-captures.php index b96b582e8..e216b0008 100644 --- a/vendor/mollie/mollie-api-php/examples/captures/list-captures.php +++ b/vendor/mollie/mollie-api-php/examples/captures/list-captures.php @@ -5,6 +5,10 @@ /* * List captures for a payment using the Mollie API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -21,6 +25,6 @@ $amount = $capture->amount->currency . ' ' . $capture->amount->value; echo 'Captured ' . $amount . ' for payment ' . $payment->id; } -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/customers/create-customer-first-payment.php b/vendor/mollie/mollie-api-php/examples/customers/create-customer-first-payment.php index 924f1f592..03502f6d4 100644 --- a/vendor/mollie/mollie-api-php/examples/customers/create-customer-first-payment.php +++ b/vendor/mollie/mollie-api-php/examples/customers/create-customer-first-payment.php @@ -5,6 +5,15 @@ /* * How to create a first payment to allow recurring payments later. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use _PhpScoper5ea00cc67502b\Mollie\Api\Types\SequenceType; +use function dirname; +use function header; +use function htmlspecialchars; +use function strcasecmp; +use function time; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -19,13 +28,13 @@ * Generate a unique order id for this example. It is important to include this unique attribute * in the redirectUrl (below) so a proper return page can be shown to the customer. */ - $orderId = \time(); + $orderId = time(); /* * Determine the url parts to these example files. */ - $protocol = isset($_SERVER['HTTPS']) && \strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http"; + $protocol = isset($_SERVER['HTTPS']) && strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http"; $hostname = $_SERVER['HTTP_HOST']; - $path = \dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']); + $path = dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']); /** * Customer Payment creation parameters. * @@ -42,12 +51,12 @@ "webhookUrl" => "{$protocol}://{$hostname}{$path}/payments/webhook.php", "metadata" => ["order_id" => $orderId], // Flag this payment as a first payment to allow recurring payments later. - "sequenceType" => \_PhpScoper5ea00cc67502b\Mollie\Api\Types\SequenceType::SEQUENCETYPE_FIRST, + "sequenceType" => SequenceType::SEQUENCETYPE_FIRST, ]); /* * In this example we store the order with its payment status in a database. */ - \_PhpScoper5ea00cc67502b\database_write($orderId, $payment->status); + database_write($orderId, $payment->status); /* * Send the customer off to complete the payment. * This request should always be a GET, thus we enforce 303 http response code @@ -55,7 +64,7 @@ * After completion, the customer will have a pending or valid mandate that can be * used for recurring payments and subscriptions. */ - \header("Location: " . $payment->getCheckoutUrl(), \true, 303); -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); + header("Location: " . $payment->getCheckoutUrl(), true, 303); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/customers/create-customer-payment.php b/vendor/mollie/mollie-api-php/examples/customers/create-customer-payment.php index 2cb5a785e..9e13bf176 100644 --- a/vendor/mollie/mollie-api-php/examples/customers/create-customer-payment.php +++ b/vendor/mollie/mollie-api-php/examples/customers/create-customer-payment.php @@ -5,6 +5,14 @@ /* * How to create a new customer in the Mollie API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function dirname; +use function header; +use function htmlspecialchars; +use function strcasecmp; +use function time; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -19,13 +27,13 @@ * Generate a unique order id for this example. It is important to include this unique attribute * in the redirectUrl (below) so a proper return page can be shown to the customer. */ - $orderId = \time(); + $orderId = time(); /* * Determine the url parts to these example files. */ - $protocol = isset($_SERVER['HTTPS']) && \strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http"; + $protocol = isset($_SERVER['HTTPS']) && strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http"; $hostname = $_SERVER['HTTP_HOST']; - $path = \dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']); + $path = dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']); /** * Linking customers to payments has a few benefits * @@ -39,12 +47,12 @@ /* * In this example we store the order with its payment status in a database. */ - \_PhpScoper5ea00cc67502b\database_write($orderId, $payment->status); + database_write($orderId, $payment->status); /* * Send the customer off to complete the payment. * This request should always be a GET, thus we enforce 303 http response code */ - \header("Location: " . $payment->getCheckoutUrl(), \true, 303); -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); + header("Location: " . $payment->getCheckoutUrl(), true, 303); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/customers/create-customer-recurring-payment.php b/vendor/mollie/mollie-api-php/examples/customers/create-customer-recurring-payment.php index 730186477..7f3b8c8b6 100644 --- a/vendor/mollie/mollie-api-php/examples/customers/create-customer-recurring-payment.php +++ b/vendor/mollie/mollie-api-php/examples/customers/create-customer-recurring-payment.php @@ -5,6 +5,14 @@ /* * How to create an on-demand recurring payment. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use _PhpScoper5ea00cc67502b\Mollie\Api\Types\SequenceType; +use function dirname; +use function htmlspecialchars; +use function strcasecmp; +use function time; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -18,13 +26,13 @@ /* * Generate a unique order id for this example. */ - $orderId = \time(); + $orderId = time(); /* * Determine the url parts to these example files. */ - $protocol = isset($_SERVER['HTTPS']) && \strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http"; + $protocol = isset($_SERVER['HTTPS']) && strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http"; $hostname = $_SERVER['HTTP_HOST']; - $path = \dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']); + $path = dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']); /** * Customer Payment creation parameters. * @@ -40,18 +48,18 @@ "webhookUrl" => "{$protocol}://{$hostname}{$path}/payments/webhook.php", "metadata" => ["order_id" => $orderId], // Flag this payment as a recurring payment. - "sequenceType" => \_PhpScoper5ea00cc67502b\Mollie\Api\Types\SequenceType::SEQUENCETYPE_RECURRING, + "sequenceType" => SequenceType::SEQUENCETYPE_RECURRING, ]); /* * In this example we store the order with its payment status in a database. */ - \_PhpScoper5ea00cc67502b\database_write($orderId, $payment->status); + database_write($orderId, $payment->status); /* * The payment will be either pending or paid immediately. The customer * does not have to perform any payment steps. */ - echo "

Selected mandate is '" . \htmlspecialchars($payment->mandateId) . "' (" . \htmlspecialchars($payment->method) . ").

\n"; - echo "

The payment status is '" . \htmlspecialchars($payment->status) . "'.

\n"; -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); + echo "

Selected mandate is '" . htmlspecialchars($payment->mandateId) . "' (" . htmlspecialchars($payment->method) . ").

\n"; + echo "

The payment status is '" . htmlspecialchars($payment->status) . "'.

\n"; +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/customers/create-customer.php b/vendor/mollie/mollie-api-php/examples/customers/create-customer.php index 08c640f2d..3580f0e89 100644 --- a/vendor/mollie/mollie-api-php/examples/customers/create-customer.php +++ b/vendor/mollie/mollie-api-php/examples/customers/create-customer.php @@ -5,6 +5,10 @@ /* * How to create a new customer in the Mollie API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -15,8 +19,8 @@ * * @See https://docs.mollie.com/reference/v2/customers-api/create-customer */ - $customer = $mollie->customers->create(["name" => "Luke Skywalker", "email" => "luke@example.org", "metadata" => ["isJedi" => \TRUE]]); - echo "

New customer created " . \htmlspecialchars($customer->id) . " (" . \htmlspecialchars($customer->name) . ").

"; -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); + $customer = $mollie->customers->create(["name" => "Luke Skywalker", "email" => "luke@example.org", "metadata" => ["isJedi" => TRUE]]); + echo "

New customer created " . htmlspecialchars($customer->id) . " (" . htmlspecialchars($customer->name) . ").

"; +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/customers/delete-customer.php b/vendor/mollie/mollie-api-php/examples/customers/delete-customer.php index 77a6357a7..1c8e41d87 100644 --- a/vendor/mollie/mollie-api-php/examples/customers/delete-customer.php +++ b/vendor/mollie/mollie-api-php/examples/customers/delete-customer.php @@ -5,6 +5,10 @@ /* * Delete a customer from the Mollie API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -12,6 +16,6 @@ require "../initialize.php"; $mollie->customers->delete("cst_fE3F6nvX"); echo "

Customer deleted!

"; -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/customers/index.php b/vendor/mollie/mollie-api-php/examples/customers/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/mollie/mollie-api-php/examples/customers/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/mollie/mollie-api-php/examples/customers/list-customer-payments.php b/vendor/mollie/mollie-api-php/examples/customers/list-customer-payments.php index 71411ca3c..7997823dc 100644 --- a/vendor/mollie/mollie-api-php/examples/customers/list-customer-payments.php +++ b/vendor/mollie/mollie-api-php/examples/customers/list-customer-payments.php @@ -5,6 +5,12 @@ /* * How to retrieve your customers' payments history. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function dirname; +use function htmlspecialchars; +use function strcasecmp; + try { /* * Initialize the Mollie API library with your API key. @@ -15,9 +21,9 @@ /* * Determine the url parts to these example files. */ - $protocol = isset($_SERVER['HTTPS']) && \strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http"; + $protocol = isset($_SERVER['HTTPS']) && strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http"; $hostname = $_SERVER['HTTP_HOST']; - $path = \dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']); + $path = dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']); /* * Retrieve the last created customer for this example. * If no customers are created yet, run create-customer example. @@ -30,10 +36,10 @@ echo "
    "; foreach ($payments as $payment) { echo "
  • "; - echo "" . \htmlspecialchars($payment->id) . "
    "; - echo \htmlspecialchars($payment->description) . "
    "; - echo \htmlspecialchars($payment->amount->currency) . " " . \htmlspecialchars($payment->amount->value) . "
    "; - echo "Status: " . \htmlspecialchars($payment->status) . "
    "; + echo "" . htmlspecialchars($payment->id) . "
    "; + echo htmlspecialchars($payment->description) . "
    "; + echo htmlspecialchars($payment->amount->currency) . " " . htmlspecialchars($payment->amount->value) . "
    "; + echo "Status: " . htmlspecialchars($payment->status) . "
    "; if ($payment->hasRefunds()) { echo "Payment has been (partially) refunded.
    "; } @@ -41,11 +47,11 @@ echo "Payment has been charged back.
    "; } if ($payment->canBeRefunded() && $payment->amountRemaining->currency === 'EUR' && $payment->amountRemaining->value >= '2.00') { - echo " (id) . "\">refund)"; + echo " (id) . "\">refund)"; } echo "
  • "; } echo "
"; -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/customers/update-customer.php b/vendor/mollie/mollie-api-php/examples/customers/update-customer.php index 0e9d0a100..a5f066282 100644 --- a/vendor/mollie/mollie-api-php/examples/customers/update-customer.php +++ b/vendor/mollie/mollie-api-php/examples/customers/update-customer.php @@ -5,6 +5,10 @@ /* * Updating an existing customer via the Mollie API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -22,9 +26,9 @@ $customer->name = "Luke Sky"; $customer->email = "luke@example.org"; $customer->locale = "en_US"; - $customer->metadata->isJedi = \TRUE; + $customer->metadata->isJedi = TRUE; $customer->update(); - echo "

Customer updated: " . \htmlspecialchars($customer->name) . "

"; -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); + echo "

Customer updated: " . htmlspecialchars($customer->name) . "

"; +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/functions.php b/vendor/mollie/mollie-api-php/examples/functions.php index b9cf85cb1..d50f365b6 100644 --- a/vendor/mollie/mollie-api-php/examples/functions.php +++ b/vendor/mollie/mollie-api-php/examples/functions.php @@ -6,16 +6,22 @@ * NOTE: The examples are using a text file as a database. * Please use a real database like MySQL in production code. */ + +use function dirname; +use function file_get_contents; +use function file_put_contents; +use function intval; + function database_read($orderId) { - $orderId = \intval($orderId); - $database = \dirname(__FILE__) . "/database/order-{$orderId}.txt"; - $status = @\file_get_contents($database); + $orderId = intval($orderId); + $database = dirname(__FILE__) . "/database/order-{$orderId}.txt"; + $status = @file_get_contents($database); return $status ? $status : "unknown order"; } function database_write($orderId, $status) { - $orderId = \intval($orderId); - $database = \dirname(__FILE__) . "/database/order-{$orderId}.txt"; - \file_put_contents($database, $status); + $orderId = intval($orderId); + $database = dirname(__FILE__) . "/database/order-{$orderId}.txt"; + file_put_contents($database, $status); } diff --git a/vendor/mollie/mollie-api-php/examples/index.php b/vendor/mollie/mollie-api-php/examples/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/mollie/mollie-api-php/examples/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/mollie/mollie-api-php/examples/initialize.php b/vendor/mollie/mollie-api-php/examples/initialize.php index 6b1ec8589..7b54a8c28 100644 --- a/vendor/mollie/mollie-api-php/examples/initialize.php +++ b/vendor/mollie/mollie-api-php/examples/initialize.php @@ -5,9 +5,15 @@ /* * Make sure to disable the display of errors in production code! */ -\ini_set('display_errors', 1); -\ini_set('display_startup_errors', 1); -\error_reporting(\E_ALL); + +use _PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient; +use function error_reporting; +use function ini_set; +use const E_ALL; + +ini_set('display_errors', 1); +ini_set('display_startup_errors', 1); +error_reporting(E_ALL); require_once __DIR__ . "/../vendor/autoload.php"; require_once __DIR__ . "/functions.php"; /* @@ -15,5 +21,5 @@ * * See: https://www.mollie.com/dashboard/developers/api-keys */ -$mollie = new \_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient(); +$mollie = new MollieApiClient(); $mollie->setApiKey("test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM"); diff --git a/vendor/mollie/mollie-api-php/examples/initialize_with_oauth.php b/vendor/mollie/mollie-api-php/examples/initialize_with_oauth.php index da1fe6115..78ac1181f 100644 --- a/vendor/mollie/mollie-api-php/examples/initialize_with_oauth.php +++ b/vendor/mollie/mollie-api-php/examples/initialize_with_oauth.php @@ -5,9 +5,15 @@ /* * Make sure to disable the display of errors in production code! */ -\ini_set('display_errors', 1); -\ini_set('display_startup_errors', 1); -\error_reporting(\E_ALL); + +use _PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient; +use function error_reporting; +use function ini_set; +use const E_ALL; + +ini_set('display_errors', 1); +ini_set('display_startup_errors', 1); +error_reporting(E_ALL); require_once __DIR__ . "/../vendor/autoload.php"; require_once __DIR__ . "/functions.php"; /* @@ -15,5 +21,5 @@ * * See: https://docs.mollie.com/oauth/overview */ -$mollie = new \_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient(); +$mollie = new MollieApiClient(); $mollie->setAccessToken("access_Wwvu7egPcJLLJ9Kb7J632x8wJ2zMeJ"); diff --git a/vendor/mollie/mollie-api-php/examples/invoices/index.php b/vendor/mollie/mollie-api-php/examples/invoices/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/mollie/mollie-api-php/examples/invoices/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/mollie/mollie-api-php/examples/invoices/list-invoices.php b/vendor/mollie/mollie-api-php/examples/invoices/list-invoices.php index 827931429..fb898610a 100644 --- a/vendor/mollie/mollie-api-php/examples/invoices/list-invoices.php +++ b/vendor/mollie/mollie-api-php/examples/invoices/list-invoices.php @@ -5,6 +5,10 @@ /* * List the Mollie invoices. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -15,23 +19,23 @@ */ $invoices = $mollie->invoices->all(); foreach ($invoices as $invoice) { - echo '
  • Invoice ' . \htmlspecialchars($invoice->reference) . ': (' . \htmlspecialchars($invoice->issuedAt) . ')'; + echo '
  • Invoice ' . htmlspecialchars($invoice->reference) . ': (' . htmlspecialchars($invoice->issuedAt) . ')'; echo '
    Status: ' . $invoice->status; echo ''; foreach ($invoice->lines as $line) { echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; echo ''; } - echo ''; + echo ''; echo '
    PeriodDescriptionCountVAT PercentageAmount
    ' . \htmlspecialchars($line->period) . '' . \htmlspecialchars($line->description) . '' . \htmlspecialchars($line->count) . '' . \htmlspecialchars($line->vatPercentage) . '' . \htmlspecialchars($line->amount->currency . " " . $line->amount->value) . '' . htmlspecialchars($line->period) . '' . htmlspecialchars($line->description) . '' . htmlspecialchars($line->count) . '' . htmlspecialchars($line->vatPercentage) . '' . htmlspecialchars($line->amount->currency . " " . $line->amount->value) . '
    Gross Total' . \htmlspecialchars($invoice->grossAmount->value . " " . $invoice->grossAmount->currency) . '
    Gross Total' . htmlspecialchars($invoice->grossAmount->value . " " . $invoice->grossAmount->currency) . '
    '; echo 'Click here to open PDF'; echo '
  • '; } -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/mandates/create-mandate.php b/vendor/mollie/mollie-api-php/examples/mandates/create-mandate.php index 97146915b..0bb4ab2d3 100644 --- a/vendor/mollie/mollie-api-php/examples/mandates/create-mandate.php +++ b/vendor/mollie/mollie-api-php/examples/mandates/create-mandate.php @@ -5,6 +5,11 @@ /* * Create a customer mandate via the Mollie API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use _PhpScoper5ea00cc67502b\Mollie\Api\Types\MandateMethod; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -18,8 +23,8 @@ /* * Create a SEPA Direct Debit mandate for the customer */ - $mandate = $customer->createMandate(["method" => \_PhpScoper5ea00cc67502b\Mollie\Api\Types\MandateMethod::DIRECTDEBIT, "consumerAccount" => 'NL34ABNA0243341423', "consumerName" => 'B. A. Example']); + $mandate = $customer->createMandate(["method" => MandateMethod::DIRECTDEBIT, "consumerAccount" => 'NL34ABNA0243341423', "consumerName" => 'B. A. Example']); echo "

    Mandate created with id " . $mandate->id . " for customer " . $customer->name . "

    "; -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/mandates/index.php b/vendor/mollie/mollie-api-php/examples/mandates/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/mollie/mollie-api-php/examples/mandates/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/mollie/mollie-api-php/examples/mandates/list-mandates.php b/vendor/mollie/mollie-api-php/examples/mandates/list-mandates.php index b88e2bf70..4629502f7 100644 --- a/vendor/mollie/mollie-api-php/examples/mandates/list-mandates.php +++ b/vendor/mollie/mollie-api-php/examples/mandates/list-mandates.php @@ -5,6 +5,10 @@ /* * List all customer mandates */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -19,9 +23,9 @@ */ echo "
      "; foreach ($customer->mandates() as $mandate) { - echo "
    • " . \htmlspecialchars($mandate->id) . " - " . \htmlspecialchars($mandate->method) . ": " . \htmlspecialchars($mandate->status) . "
    • "; + echo "
    • " . htmlspecialchars($mandate->id) . " - " . htmlspecialchars($mandate->method) . ": " . htmlspecialchars($mandate->status) . "
    • "; } echo "
    "; -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/mandates/revoke-mandate.php b/vendor/mollie/mollie-api-php/examples/mandates/revoke-mandate.php index 62f59e111..0cedab273 100644 --- a/vendor/mollie/mollie-api-php/examples/mandates/revoke-mandate.php +++ b/vendor/mollie/mollie-api-php/examples/mandates/revoke-mandate.php @@ -5,6 +5,10 @@ /* * Revoke a customer mandate */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -23,6 +27,6 @@ */ $mandate->revoke(); echo "

    Mandate has been successfully revoked.

    "; -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/orders/cancel-order-lines.php b/vendor/mollie/mollie-api-php/examples/orders/cancel-order-lines.php index a797ba06f..1aea4cfd9 100644 --- a/vendor/mollie/mollie-api-php/examples/orders/cancel-order-lines.php +++ b/vendor/mollie/mollie-api-php/examples/orders/cancel-order-lines.php @@ -5,6 +5,10 @@ /* * Cancel order lines using the Mollie API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -29,6 +33,6 @@ } else { echo "Unable to cancel line " . $lineId . " for your order " . $orderId . "."; } -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/orders/cancel-order.php b/vendor/mollie/mollie-api-php/examples/orders/cancel-order.php index eede6b83d..ffd3de516 100644 --- a/vendor/mollie/mollie-api-php/examples/orders/cancel-order.php +++ b/vendor/mollie/mollie-api-php/examples/orders/cancel-order.php @@ -5,6 +5,10 @@ /* * Cancel an order using the Mollie API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -22,6 +26,6 @@ } else { echo "Unable to cancel your order " . $order->id . "."; } -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/orders/create-order.php b/vendor/mollie/mollie-api-php/examples/orders/create-order.php index 7b610ed9a..05566d42b 100644 --- a/vendor/mollie/mollie-api-php/examples/orders/create-order.php +++ b/vendor/mollie/mollie-api-php/examples/orders/create-order.php @@ -5,6 +5,15 @@ /* * How to create a new order in the Mollie API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function dirname; +use function header; +use function htmlspecialchars; +use function strcasecmp; +use function strval; +use function time; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -14,24 +23,24 @@ * Generate a unique order id for this example. It is important to include this unique attribute * in the redirectUrl (below) so a proper return page can be shown to the customer. */ - $orderId = \time(); + $orderId = time(); /* * Determine the url parts to these example files. */ - $protocol = isset($_SERVER['HTTPS']) && \strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http"; + $protocol = isset($_SERVER['HTTPS']) && strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http"; $hostname = $_SERVER['HTTP_HOST']; - $path = \dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']); + $path = dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']); /* * Order creation parameters. * * See: https://docs.mollie.com/reference/v2/orders-api/create-order */ - $order = $mollie->orders->create(["amount" => ["value" => "1027.99", "currency" => "EUR"], "billingAddress" => ["streetAndNumber" => "Keizersgracht 313", "postalCode" => "1016 EE", "city" => "Amsterdam", "country" => "nl", "givenName" => "Luke", "familyName" => "Skywalker", "email" => "luke@skywalker.com"], "shippingAddress" => ["streetAndNumber" => "Keizersgracht 313", "postalCode" => "1016 EE", "city" => "Amsterdam", "country" => "nl", "givenName" => "Luke", "familyName" => "Skywalker", "email" => "luke@skywalker.com"], "metadata" => ["order_id" => $orderId], "consumerDateOfBirth" => "1958-01-31", "locale" => "en_US", "orderNumber" => \strval($orderId), "redirectUrl" => "{$protocol}://{$hostname}{$path}/orders/return.php?order_id={$orderId}", "webhookUrl" => "{$protocol}://{$hostname}{$path}/orders/webhook.php", "method" => "ideal", "lines" => [["sku" => "5702016116977", "name" => "LEGO 42083 Bugatti Chiron", "productUrl" => "https://shop.lego.com/nl-NL/Bugatti-Chiron-42083", "imageUrl" => 'https://sh-s7-live-s.legocdn.com/is/image//LEGO/42083_alt1?$main$', "quantity" => 2, "vatRate" => "21.00", "unitPrice" => ["currency" => "EUR", "value" => "399.00"], "totalAmount" => ["currency" => "EUR", "value" => "698.00"], "discountAmount" => ["currency" => "EUR", "value" => "100.00"], "vatAmount" => ["currency" => "EUR", "value" => "121.14"]], ["type" => "digital", "sku" => "5702015594028", "name" => "LEGO 42056 Porsche 911 GT3 RS", "productUrl" => "https://shop.lego.com/nl-NL/Porsche-911-GT3-RS-42056", "imageUrl" => 'https://sh-s7-live-s.legocdn.com/is/image/LEGO/42056?$PDPDefault$', "quantity" => 1, "vatRate" => "21.00", "unitPrice" => ["currency" => "EUR", "value" => "329.99"], "totalAmount" => ["currency" => "EUR", "value" => "329.99"], "vatAmount" => ["currency" => "EUR", "value" => "57.27"]]]]); + $order = $mollie->orders->create(["amount" => ["value" => "1027.99", "currency" => "EUR"], "billingAddress" => ["streetAndNumber" => "Keizersgracht 313", "postalCode" => "1016 EE", "city" => "Amsterdam", "country" => "nl", "givenName" => "Luke", "familyName" => "Skywalker", "email" => "luke@skywalker.com"], "shippingAddress" => ["streetAndNumber" => "Keizersgracht 313", "postalCode" => "1016 EE", "city" => "Amsterdam", "country" => "nl", "givenName" => "Luke", "familyName" => "Skywalker", "email" => "luke@skywalker.com"], "metadata" => ["order_id" => $orderId], "consumerDateOfBirth" => "1958-01-31", "locale" => "en_US", "orderNumber" => strval($orderId), "redirectUrl" => "{$protocol}://{$hostname}{$path}/orders/return.php?order_id={$orderId}", "webhookUrl" => "{$protocol}://{$hostname}{$path}/orders/webhook.php", "method" => "ideal", "lines" => [["sku" => "5702016116977", "name" => "LEGO 42083 Bugatti Chiron", "productUrl" => "https://shop.lego.com/nl-NL/Bugatti-Chiron-42083", "imageUrl" => 'https://sh-s7-live-s.legocdn.com/is/image//LEGO/42083_alt1?$main$', "quantity" => 2, "vatRate" => "21.00", "unitPrice" => ["currency" => "EUR", "value" => "399.00"], "totalAmount" => ["currency" => "EUR", "value" => "698.00"], "discountAmount" => ["currency" => "EUR", "value" => "100.00"], "vatAmount" => ["currency" => "EUR", "value" => "121.14"]], ["type" => "digital", "sku" => "5702015594028", "name" => "LEGO 42056 Porsche 911 GT3 RS", "productUrl" => "https://shop.lego.com/nl-NL/Porsche-911-GT3-RS-42056", "imageUrl" => 'https://sh-s7-live-s.legocdn.com/is/image/LEGO/42056?$PDPDefault$', "quantity" => 1, "vatRate" => "21.00", "unitPrice" => ["currency" => "EUR", "value" => "329.99"], "totalAmount" => ["currency" => "EUR", "value" => "329.99"], "vatAmount" => ["currency" => "EUR", "value" => "57.27"]]]]); /* * Send the customer off to complete the order payment. * This request should always be a GET, thus we enforce 303 http response code */ - \header("Location: " . $order->getCheckoutUrl(), \true, 303); -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); + header("Location: " . $order->getCheckoutUrl(), true, 303); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/orders/index.php b/vendor/mollie/mollie-api-php/examples/orders/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/mollie/mollie-api-php/examples/orders/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/mollie/mollie-api-php/examples/orders/list-methods.php b/vendor/mollie/mollie-api-php/examples/orders/list-methods.php index 254220b74..086898e7a 100644 --- a/vendor/mollie/mollie-api-php/examples/orders/list-methods.php +++ b/vendor/mollie/mollie-api-php/examples/orders/list-methods.php @@ -5,6 +5,10 @@ /* * How to get the currently activated payment methods for the Orders API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key. @@ -20,10 +24,10 @@ $methods = $mollie->methods->all(['resource' => 'orders']); foreach ($methods as $method) { echo '
    '; - echo ' '; - echo \htmlspecialchars($method->description) . ' (' . \htmlspecialchars($method->id) . ')'; + echo ' '; + echo htmlspecialchars($method->description) . ' (' . htmlspecialchars($method->id) . ')'; echo '
    '; } -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/orders/list-orders.php b/vendor/mollie/mollie-api-php/examples/orders/list-orders.php index 8722966b9..d789c9c74 100644 --- a/vendor/mollie/mollie-api-php/examples/orders/list-orders.php +++ b/vendor/mollie/mollie-api-php/examples/orders/list-orders.php @@ -5,7 +5,12 @@ /* * List orders using the Mollie API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\OrderCollection; +use function htmlspecialchars; +use function str_replace; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -18,12 +23,12 @@ */ echo '
      '; $latestOrders = $mollie->orders->page(); - \_PhpScoper5ea00cc67502b\printOrders($latestOrders); + printOrders($latestOrders); $previousOrders = $latestOrders->next(); - \_PhpScoper5ea00cc67502b\printOrders($previousOrders); + printOrders($previousOrders); echo '
    '; -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } function printOrders($orders) { @@ -31,13 +36,13 @@ function printOrders($orders) return; } foreach ($orders as $order) { - echo '
  • Order ' . \htmlspecialchars($order->id) . ': (' . \htmlspecialchars($order->createdAt) . ')'; - echo '
    Status: ' . \htmlspecialchars($order->status); + echo '
  • Order ' . htmlspecialchars($order->id) . ': (' . htmlspecialchars($order->createdAt) . ')'; + echo '
    Status: ' . htmlspecialchars($order->status); echo ''; echo ''; - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; + echo ''; echo ''; echo '
    Billed toShipped toTotal amount
    ' . \htmlspecialchars($order->shippingAddress->givenName) . ' ' . \htmlspecialchars($order->shippingAddress->familyName) . '' . \htmlspecialchars($order->billingAddress->givenName) . ' ' . \htmlspecialchars($order->billingAddress->familyName) . '' . \htmlspecialchars($order->amount->currency) . \str_replace('.', ',', \htmlspecialchars($order->amount->value)) . '' . htmlspecialchars($order->shippingAddress->givenName) . ' ' . htmlspecialchars($order->shippingAddress->familyName) . '' . htmlspecialchars($order->billingAddress->givenName) . ' ' . htmlspecialchars($order->billingAddress->familyName) . '' . htmlspecialchars($order->amount->currency) . str_replace('.', ',', htmlspecialchars($order->amount->value)) . '
    '; echo 'Click here to pay'; diff --git a/vendor/mollie/mollie-api-php/examples/orders/refund-order-completely.php b/vendor/mollie/mollie-api-php/examples/orders/refund-order-completely.php index 3685f8348..7a373a1a5 100644 --- a/vendor/mollie/mollie-api-php/examples/orders/refund-order-completely.php +++ b/vendor/mollie/mollie-api-php/examples/orders/refund-order-completely.php @@ -5,6 +5,10 @@ /* * Refund all eligible items for an order using the Mollie API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -19,6 +23,6 @@ $refund = $order->refundAll(); echo 'Refund ' . $refund->id . ' was created for order ' . $order->id; echo 'You will receive ' . $refund->amount->currency . $refund->amount->value; -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/orders/refund-order-partially.php b/vendor/mollie/mollie-api-php/examples/orders/refund-order-partially.php index e3f5131ee..414175135 100644 --- a/vendor/mollie/mollie-api-php/examples/orders/refund-order-partially.php +++ b/vendor/mollie/mollie-api-php/examples/orders/refund-order-partially.php @@ -5,6 +5,10 @@ /* * Refund some items for an order using the Mollie API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -19,6 +23,6 @@ $refund = $order->refund(['lines' => [['id' => 'odl_dgtxyl', 'quantity' => 1]], "description" => "Required quantity not in stock, refunding one photo book."]); echo 'Refund ' . $refund->id . ' was created for part of your order ' . $order->id; echo 'You will receive ' . $refund->amount->currency . $refund->amount->value; -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/orders/webhook.php b/vendor/mollie/mollie-api-php/examples/orders/webhook.php index 1230219fc..01c7ff9c3 100644 --- a/vendor/mollie/mollie-api-php/examples/orders/webhook.php +++ b/vendor/mollie/mollie-api-php/examples/orders/webhook.php @@ -5,6 +5,10 @@ /* * Handle an order status change using the Mollie API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -21,7 +25,7 @@ /* * Update the order in the database. */ - \_PhpScoper5ea00cc67502b\database_write($orderId, $order->status); + database_write($orderId, $order->status); if ($order->isPaid() || $order->isAuthorized()) { /* * The order is paid or authorized @@ -44,6 +48,6 @@ * The order is pending. */ } -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/payments/create-ideal-payment.php b/vendor/mollie/mollie-api-php/examples/payments/create-ideal-payment.php index f32dabd05..459173ee5 100644 --- a/vendor/mollie/mollie-api-php/examples/payments/create-ideal-payment.php +++ b/vendor/mollie/mollie-api-php/examples/payments/create-ideal-payment.php @@ -5,6 +5,15 @@ /* * How to prepare an iDEAL payment with the Mollie API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use _PhpScoper5ea00cc67502b\Mollie\Api\Types\PaymentMethod; +use function dirname; +use function header; +use function htmlspecialchars; +use function strcasecmp; +use function time; + try { /* * Initialize the Mollie API library with your API key. @@ -16,10 +25,10 @@ * First, let the customer pick the bank in a simple HTML form. This step is actually optional. */ if ($_SERVER["REQUEST_METHOD"] != "POST") { - $method = $mollie->methods->get(\_PhpScoper5ea00cc67502b\Mollie\Api\Types\PaymentMethod::IDEAL, ["include" => "issuers"]); + $method = $mollie->methods->get(PaymentMethod::IDEAL, ["include" => "issuers"]); echo '
    Select your bank:
    '; @@ -29,13 +38,13 @@ * Generate a unique order id for this example. It is important to include this unique attribute * in the redirectUrl (below) so a proper return page can be shown to the customer. */ - $orderId = \time(); + $orderId = time(); /* * Determine the url parts to these example files. */ - $protocol = isset($_SERVER['HTTPS']) && \strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http"; + $protocol = isset($_SERVER['HTTPS']) && strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http"; $hostname = $_SERVER['HTTP_HOST']; - $path = \dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']); + $path = dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']); /* * Payment parameters: * amount Amount in EUROs. This example creates a € 27.50 payment. @@ -46,16 +55,16 @@ * metadata Custom metadata that is stored with the payment. * issuer The customer's bank. If empty the customer can select it later. */ - $payment = $mollie->payments->create(["amount" => ["currency" => "EUR", "value" => "27.50"], "method" => \_PhpScoper5ea00cc67502b\Mollie\Api\Types\PaymentMethod::IDEAL, "description" => "Order #{$orderId}", "redirectUrl" => "{$protocol}://{$hostname}{$path}/payments/return.php?order_id={$orderId}", "webhookUrl" => "{$protocol}://{$hostname}{$path}/payments/webhook.php", "metadata" => ["order_id" => $orderId], "issuer" => !empty($_POST["issuer"]) ? $_POST["issuer"] : null]); + $payment = $mollie->payments->create(["amount" => ["currency" => "EUR", "value" => "27.50"], "method" => PaymentMethod::IDEAL, "description" => "Order #{$orderId}", "redirectUrl" => "{$protocol}://{$hostname}{$path}/payments/return.php?order_id={$orderId}", "webhookUrl" => "{$protocol}://{$hostname}{$path}/payments/webhook.php", "metadata" => ["order_id" => $orderId], "issuer" => !empty($_POST["issuer"]) ? $_POST["issuer"] : null]); /* * In this example we store the order with its payment status in a database. */ - \_PhpScoper5ea00cc67502b\database_write($orderId, $payment->status); + database_write($orderId, $payment->status); /* * Send the customer off to complete the payment. * This request should always be a GET, thus we enforce 303 http response code */ - \header("Location: " . $payment->getCheckoutUrl(), \true, 303); -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); + header("Location: " . $payment->getCheckoutUrl(), true, 303); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/payments/create-payment-oauth.php b/vendor/mollie/mollie-api-php/examples/payments/create-payment-oauth.php index dfa01e293..4be57890a 100644 --- a/vendor/mollie/mollie-api-php/examples/payments/create-payment-oauth.php +++ b/vendor/mollie/mollie-api-php/examples/payments/create-payment-oauth.php @@ -5,6 +5,17 @@ /* * Example 10 - Using OAuth access token to prepare a new payment. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function dirname; +use function header; +use function htmlspecialchars; +use function reset; +use function strcasecmp; +use function time; +use const PHP_EOL; +use const PHP_SAPI; + try { /* * Initialize the Mollie API library with your OAuth access token. @@ -14,19 +25,19 @@ * Generate a unique order id for this example. It is important to include this unique attribute * in the redirectUrl (below) so a proper return page can be shown to the customer. */ - $orderId = \time(); + $orderId = time(); /* * Determine the url parts to these example files. */ - $protocol = isset($_SERVER['HTTPS']) && \strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http"; + $protocol = isset($_SERVER['HTTPS']) && strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http"; $hostname = $_SERVER['HTTP_HOST'] ?: "my.app"; - $path = \dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']); + $path = dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']); /* * Since unlike an API key the OAuth access token does NOT belong to a profile, we need to retrieve a profile * so we can specify the profileId-parameter when creating a payment below. */ $profiles = $mollie->profiles->page(); - $profile = \reset($profiles); + $profile = reset($profiles); /** * Paramaters for creating a payment via oAuth * @@ -36,16 +47,16 @@ /* * In this example we store the order with its payment status in a database. */ - \_PhpScoper5ea00cc67502b\database_write($orderId, $payment->status); + database_write($orderId, $payment->status); /* * Send the customer off to complete the payment. * This request should always be a GET, thus we enforce 303 http response code */ - if (\PHP_SAPI === "cli") { - echo "Redirect to: " . $payment->getCheckoutUrl() . \PHP_EOL; + if (PHP_SAPI === "cli") { + echo "Redirect to: " . $payment->getCheckoutUrl() . PHP_EOL; return; } - \header("Location: " . $payment->getCheckoutUrl(), \true, 303); -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); + header("Location: " . $payment->getCheckoutUrl(), true, 303); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/payments/create-payment.php b/vendor/mollie/mollie-api-php/examples/payments/create-payment.php index b361f4a90..bca5d2c97 100644 --- a/vendor/mollie/mollie-api-php/examples/payments/create-payment.php +++ b/vendor/mollie/mollie-api-php/examples/payments/create-payment.php @@ -5,6 +5,14 @@ /* * How to prepare a new payment with the Mollie API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function dirname; +use function header; +use function htmlspecialchars; +use function strcasecmp; +use function time; + try { /* * Initialize the Mollie API library with your API key. @@ -16,13 +24,13 @@ * Generate a unique order id for this example. It is important to include this unique attribute * in the redirectUrl (below) so a proper return page can be shown to the customer. */ - $orderId = \time(); + $orderId = time(); /* * Determine the url parts to these example files. */ - $protocol = isset($_SERVER['HTTPS']) && \strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http"; + $protocol = isset($_SERVER['HTTPS']) && strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http"; $hostname = $_SERVER['HTTP_HOST']; - $path = \dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']); + $path = dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']); /* * Payment parameters: * amount Amount in EUROs. This example creates a € 10,- payment. @@ -35,12 +43,12 @@ /* * In this example we store the order with its payment status in a database. */ - \_PhpScoper5ea00cc67502b\database_write($orderId, $payment->status); + database_write($orderId, $payment->status); /* * Send the customer off to complete the payment. * This request should always be a GET, thus we enforce 303 http response code */ - \header("Location: " . $payment->getCheckoutUrl(), \true, 303); -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); + header("Location: " . $payment->getCheckoutUrl(), true, 303); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/payments/index.php b/vendor/mollie/mollie-api-php/examples/payments/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/mollie/mollie-api-php/examples/payments/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/mollie/mollie-api-php/examples/payments/list-methods.php b/vendor/mollie/mollie-api-php/examples/payments/list-methods.php index 2df8fc65b..d9a9191e4 100644 --- a/vendor/mollie/mollie-api-php/examples/payments/list-methods.php +++ b/vendor/mollie/mollie-api-php/examples/payments/list-methods.php @@ -5,6 +5,10 @@ /* * How to get the currently activated payment methods for the Payments API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key. @@ -20,10 +24,10 @@ $methods = $mollie->methods->allActive(); foreach ($methods as $method) { echo '
    '; - echo ' '; - echo \htmlspecialchars($method->description) . ' (' . \htmlspecialchars($method->id) . ')'; + echo ' '; + echo htmlspecialchars($method->description) . ' (' . htmlspecialchars($method->id) . ')'; echo '
    '; } -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/payments/list-payments.php b/vendor/mollie/mollie-api-php/examples/payments/list-payments.php index 22f94fb44..2d937283a 100644 --- a/vendor/mollie/mollie-api-php/examples/payments/list-payments.php +++ b/vendor/mollie/mollie-api-php/examples/payments/list-payments.php @@ -5,6 +5,12 @@ /* * How to list your payments. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function dirname; +use function htmlspecialchars; +use function strcasecmp; + try { /* * Initialize the Mollie API library with your API key. @@ -15,9 +21,9 @@ /* * Determine the url parts to these example files. */ - $protocol = isset($_SERVER['HTTPS']) && \strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http"; + $protocol = isset($_SERVER['HTTPS']) && strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http"; $hostname = $_SERVER['HTTP_HOST']; - $path = \dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']); + $path = dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']); /* * Get the all payments for this API key ordered by newest. */ @@ -25,10 +31,10 @@ echo "
      "; foreach ($payments as $payment) { echo "
    • "; - echo "" . \htmlspecialchars($payment->id) . "
      "; - echo \htmlspecialchars($payment->description) . "
      "; - echo \htmlspecialchars($payment->amount->currency) . " " . \htmlspecialchars($payment->amount->value) . "
      "; - echo "Status: " . \htmlspecialchars($payment->status) . "
      "; + echo "" . htmlspecialchars($payment->id) . "
      "; + echo htmlspecialchars($payment->description) . "
      "; + echo htmlspecialchars($payment->amount->currency) . " " . htmlspecialchars($payment->amount->value) . "
      "; + echo "Status: " . htmlspecialchars($payment->status) . "
      "; if ($payment->hasRefunds()) { echo "Payment has been (partially) refunded.
      "; } @@ -36,7 +42,7 @@ echo "Payment has been charged back.
      "; } if ($payment->canBeRefunded() && $payment->amountRemaining->currency === 'EUR' && $payment->amountRemaining->value >= '2.00') { - echo " (id) . "\">refund)"; + echo " (id) . "\">refund)"; } echo "
    • "; } @@ -49,10 +55,10 @@ echo "
        "; foreach ($nextPayments as $payment) { echo "
      • "; - echo "" . \htmlspecialchars($payment->id) . "
        "; - echo \htmlspecialchars($payment->description) . "
        "; - echo \htmlspecialchars($payment->amount->currency) . " " . \htmlspecialchars($payment->amount->value) . "
        "; - echo "Status: " . \htmlspecialchars($payment->status) . "
        "; + echo "" . htmlspecialchars($payment->id) . "
        "; + echo htmlspecialchars($payment->description) . "
        "; + echo htmlspecialchars($payment->amount->currency) . " " . htmlspecialchars($payment->amount->value) . "
        "; + echo "Status: " . htmlspecialchars($payment->status) . "
        "; if ($payment->hasRefunds()) { echo "Payment has been (partially) refunded.
        "; } @@ -60,12 +66,12 @@ echo "Payment has been charged back.
        "; } if ($payment->canBeRefunded() && $payment->amountRemaining->currency === 'EUR' && $payment->amountRemaining->value >= '2.00') { - echo " (id) . "\">refund)"; + echo " (id) . "\">refund)"; } echo "
      • "; } echo "
      "; } -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/payments/refund-payment.php b/vendor/mollie/mollie-api-php/examples/payments/refund-payment.php index 541b854ef..6c70a47f0 100644 --- a/vendor/mollie/mollie-api-php/examples/payments/refund-payment.php +++ b/vendor/mollie/mollie-api-php/examples/payments/refund-payment.php @@ -5,6 +5,13 @@ /* * How to refund a payment programmatically */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function dirname; +use function htmlspecialchars; +use function strcasecmp; +use const PHP_EOL; + try { /* * Initialize the Mollie API library with your API key. @@ -15,9 +22,9 @@ /* * Determine the url parts to these example files. */ - $protocol = isset($_SERVER['HTTPS']) && \strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http"; + $protocol = isset($_SERVER['HTTPS']) && strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http"; $hostname = $_SERVER['HTTP_HOST']; - $path = \dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']); + $path = dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']); if (isset($_GET['payment_id'])) { /* * Retrieve the payment you want to refund from the API. @@ -31,9 +38,9 @@ * https://docs.mollie.com/reference/v2/refunds-api/create-refund */ $refund = $payment->refund(["amount" => ["currency" => "EUR", "value" => "2.00"]]); - echo "{$refund->amount->currency} {$refund->amount->value} of payment {$paymentId} refunded.", \PHP_EOL; + echo "{$refund->amount->currency} {$refund->amount->value} of payment {$paymentId} refunded.", PHP_EOL; } else { - echo "Payment {$paymentId} can not be refunded.", \PHP_EOL; + echo "Payment {$paymentId} can not be refunded.", PHP_EOL; } /* * Retrieve all refunds on a payment. @@ -41,10 +48,10 @@ echo "
        "; foreach ($payment->refunds() as $refund) { echo "
      • "; - echo "" . \htmlspecialchars($refund->id) . "
        "; - echo \htmlspecialchars($refund->description) . "
        "; - echo \htmlspecialchars($refund->amount->currency) . " " . \htmlspecialchars($refund->amount->value) . "
        "; - echo "Status: " . \htmlspecialchars($refund->status); + echo "" . htmlspecialchars($refund->id) . "
        "; + echo htmlspecialchars($refund->description) . "
        "; + echo htmlspecialchars($refund->amount->currency) . " " . htmlspecialchars($refund->amount->value) . "
        "; + echo "Status: " . htmlspecialchars($refund->status); echo "
      • "; } echo "
      "; @@ -56,6 +63,6 @@ echo 'Create an iDEAL payment
      '; echo 'List payments
      '; echo "

      "; -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/payments/return.php b/vendor/mollie/mollie-api-php/examples/payments/return.php index c99d473cb..62e36df86 100644 --- a/vendor/mollie/mollie-api-php/examples/payments/return.php +++ b/vendor/mollie/mollie-api-php/examples/payments/return.php @@ -12,15 +12,20 @@ * NOTE: The examples are using a text file as a database. * Please use a real database like MySQL in production code. */ + +use function dirname; +use function htmlspecialchars; +use function strcasecmp; + require_once "../functions.php"; -$status = \_PhpScoper5ea00cc67502b\database_read($_GET["order_id"]); +$status = database_read($_GET["order_id"]); /* * Determine the url parts to these example files. */ -$protocol = isset($_SERVER['HTTPS']) && \strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http"; +$protocol = isset($_SERVER['HTTPS']) && strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http"; $hostname = $_SERVER['HTTP_HOST']; -$path = \dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']); -echo "

      Your payment status is '" . \htmlspecialchars($status) . "'.

      "; +$path = dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']); +echo "

      Your payment status is '" . htmlspecialchars($status) . "'.

      "; echo "

      "; echo 'Create a payment
      '; echo 'Create an iDEAL payment
      '; diff --git a/vendor/mollie/mollie-api-php/examples/payments/webhook.php b/vendor/mollie/mollie-api-php/examples/payments/webhook.php index 196b1fc68..082468372 100644 --- a/vendor/mollie/mollie-api-php/examples/payments/webhook.php +++ b/vendor/mollie/mollie-api-php/examples/payments/webhook.php @@ -7,6 +7,10 @@ * * See: https://docs.mollie.com/guides/webhooks */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key. @@ -22,7 +26,7 @@ /* * Update the order in the database. */ - \_PhpScoper5ea00cc67502b\database_write($orderId, $payment->status); + database_write($orderId, $payment->status); if ($payment->isPaid() && !$payment->hasRefunds() && !$payment->hasChargebacks()) { /* * The payment is paid and isn't refunded or charged back. @@ -59,6 +63,6 @@ * The status of the payment is still "paid" */ } -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/profiles/create-profile.php b/vendor/mollie/mollie-api-php/examples/profiles/create-profile.php index fbd4cad8f..317a308ba 100644 --- a/vendor/mollie/mollie-api-php/examples/profiles/create-profile.php +++ b/vendor/mollie/mollie-api-php/examples/profiles/create-profile.php @@ -5,6 +5,10 @@ /* * Create a profile via the Mollie API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -16,7 +20,7 @@ * @See https://docs.mollie.com/reference/v2/profiles-api/create-profile */ $profile = $mollie->profiles->create(["name" => "My website name", "website" => "https://www.mywebsite.com", "email" => "info@mywebsite.com", "phone" => "+31208202070", "categoryCode" => 5399, "mode" => "live"]); - echo "

      Profile created: " . \htmlspecialchars($profile->name) . "

      "; -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "

      API call failed: " . \htmlspecialchars($e->getMessage()) . "

      "; + echo "

      Profile created: " . htmlspecialchars($profile->name) . "

      "; +} catch (ApiException $e) { + echo "

      API call failed: " . htmlspecialchars($e->getMessage()) . "

      "; } diff --git a/vendor/mollie/mollie-api-php/examples/profiles/delete-profile.php b/vendor/mollie/mollie-api-php/examples/profiles/delete-profile.php index 75636c4ca..7084490a4 100644 --- a/vendor/mollie/mollie-api-php/examples/profiles/delete-profile.php +++ b/vendor/mollie/mollie-api-php/examples/profiles/delete-profile.php @@ -5,6 +5,10 @@ /* * Delete a profile via the Mollie API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -17,6 +21,6 @@ */ $profile = $mollie->profiles->delete("pfl_v9hTwCvYqw"); echo "

      Profile deleted

      "; -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "

      API call failed: " . \htmlspecialchars($e->getMessage()) . "

      "; +} catch (ApiException $e) { + echo "

      API call failed: " . htmlspecialchars($e->getMessage()) . "

      "; } diff --git a/vendor/mollie/mollie-api-php/examples/profiles/index.php b/vendor/mollie/mollie-api-php/examples/profiles/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/mollie/mollie-api-php/examples/profiles/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/mollie/mollie-api-php/examples/profiles/list-profiles.php b/vendor/mollie/mollie-api-php/examples/profiles/list-profiles.php index 6c0be4184..3e35a4c6b 100644 --- a/vendor/mollie/mollie-api-php/examples/profiles/list-profiles.php +++ b/vendor/mollie/mollie-api-php/examples/profiles/list-profiles.php @@ -5,6 +5,10 @@ /* * Using OAuth access token to list profiles of an account. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your OAuth access token. @@ -16,9 +20,9 @@ $profiles = $mollie->profiles->page(); foreach ($profiles as $profile) { echo '
      '; - echo \htmlspecialchars($profile->name) . ' - ' . \htmlspecialchars($profile->website) . ' (' . \htmlspecialchars($profile->id) . ')'; + echo htmlspecialchars($profile->name) . ' - ' . htmlspecialchars($profile->website) . ' (' . htmlspecialchars($profile->id) . ')'; echo '
      '; } -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/profiles/update-profile.php b/vendor/mollie/mollie-api-php/examples/profiles/update-profile.php index 929fbf5cc..ca58a877a 100644 --- a/vendor/mollie/mollie-api-php/examples/profiles/update-profile.php +++ b/vendor/mollie/mollie-api-php/examples/profiles/update-profile.php @@ -5,6 +5,10 @@ /* * Updating an existing profile via the Mollie API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -25,7 +29,7 @@ $profile->phone = '0612345670'; $profile->categoryCode = 5399; $profile->update(); - echo "

      Profile updated: " . \htmlspecialchars($profile->name) . "

      "; -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "

      API call failed: " . \htmlspecialchars($e->getMessage()) . "

      "; + echo "

      Profile updated: " . htmlspecialchars($profile->name) . "

      "; +} catch (ApiException $e) { + echo "

      API call failed: " . htmlspecialchars($e->getMessage()) . "

      "; } diff --git a/vendor/mollie/mollie-api-php/examples/settlements/index.php b/vendor/mollie/mollie-api-php/examples/settlements/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/mollie/mollie-api-php/examples/settlements/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/mollie/mollie-api-php/examples/settlements/list-settlements.php b/vendor/mollie/mollie-api-php/examples/settlements/list-settlements.php index 7229a5fa9..52ca79124 100644 --- a/vendor/mollie/mollie-api-php/examples/settlements/list-settlements.php +++ b/vendor/mollie/mollie-api-php/examples/settlements/list-settlements.php @@ -5,6 +5,12 @@ /* * Using OAuth access token to list settlements of an account. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; +use function json_decode; +use function json_encode; + try { /* * Initialize the Mollie API library with your OAuth access token. @@ -16,39 +22,39 @@ $settlements = $mollie->settlements->page(); echo '
        '; foreach ($settlements as $settlement) { - echo '
      • Settlement ' . \htmlspecialchars($settlement->reference) . ': (' . \htmlspecialchars($settlement->createdAt) . ')'; + echo '
      • Settlement ' . htmlspecialchars($settlement->reference) . ': (' . htmlspecialchars($settlement->createdAt) . ')'; echo ''; // Convert from stdClass to array - $settlement_periods = \json_decode(\json_encode($settlement->periods), \TRUE); + $settlement_periods = json_decode(json_encode($settlement->periods), TRUE); foreach ($settlement_periods as $year => $months) { foreach ($months as $month => $monthly_settlement) { foreach ($monthly_settlement['revenue'] as $revenue) { echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; echo ''; } foreach ($monthly_settlement['costs'] as $revenue) { echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; echo ''; } } } - echo ''; + echo ''; echo '
        MonthDescriptionCountNetVATGross
        ' . \htmlspecialchars($year . '-' . $month) . '' . \htmlspecialchars($revenue['description']) . '' . \htmlspecialchars($revenue['count']) . ' x' . \htmlspecialchars($revenue['amountNet']['value'] ? $revenue['amountNet']['value'] . " " . $revenue['amountNet']['currency'] : '-') . '' . \htmlspecialchars($revenue['amountVat']['value'] ? $revenue['amountVat']['value'] . " " . $revenue['amountVat']['currency'] : '-') . '' . \htmlspecialchars($revenue['amountGross']['value'] ? $revenue['amountGross']['value'] . " " . $revenue['amountGross']['currency'] : '-') . '' . htmlspecialchars($year . '-' . $month) . '' . htmlspecialchars($revenue['description']) . '' . htmlspecialchars($revenue['count']) . ' x' . htmlspecialchars($revenue['amountNet']['value'] ? $revenue['amountNet']['value'] . " " . $revenue['amountNet']['currency'] : '-') . '' . htmlspecialchars($revenue['amountVat']['value'] ? $revenue['amountVat']['value'] . " " . $revenue['amountVat']['currency'] : '-') . '' . htmlspecialchars($revenue['amountGross']['value'] ? $revenue['amountGross']['value'] . " " . $revenue['amountGross']['currency'] : '-') . '
        ' . \htmlspecialchars($year . '-' . $month) . '' . \htmlspecialchars($revenue['description']) . '' . \htmlspecialchars($revenue['count']) . ' x' . \htmlspecialchars($revenue['amountNet']['value'] ? $revenue['amountNet']['value'] . " " . $revenue['amountNet']['currency'] : '-') . '' . \htmlspecialchars($revenue['amountVat']['value'] ? $revenue['amountVat']['value'] . " " . $revenue['amountVat']['currency'] : '-') . '' . \htmlspecialchars($revenue['amountGross']['value'] ? $revenue['amountGross']['value'] . " " . $revenue['amountGross']['currency'] : '-') . '' . htmlspecialchars($year . '-' . $month) . '' . htmlspecialchars($revenue['description']) . '' . htmlspecialchars($revenue['count']) . ' x' . htmlspecialchars($revenue['amountNet']['value'] ? $revenue['amountNet']['value'] . " " . $revenue['amountNet']['currency'] : '-') . '' . htmlspecialchars($revenue['amountVat']['value'] ? $revenue['amountVat']['value'] . " " . $revenue['amountVat']['currency'] : '-') . '' . htmlspecialchars($revenue['amountGross']['value'] ? $revenue['amountGross']['value'] . " " . $revenue['amountGross']['currency'] : '-') . '
        TOTAL' . \htmlspecialchars($settlement->amount->value . " " . $settlement->amount->currency) . '
        TOTAL' . htmlspecialchars($settlement->amount->value . " " . $settlement->amount->currency) . '
        '; echo '
      • '; } echo '
      '; -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/shipments/create-shipment-all.php b/vendor/mollie/mollie-api-php/examples/shipments/create-shipment-all.php index 5a71bb88f..b8948036e 100644 --- a/vendor/mollie/mollie-api-php/examples/shipments/create-shipment-all.php +++ b/vendor/mollie/mollie-api-php/examples/shipments/create-shipment-all.php @@ -5,6 +5,10 @@ /* * Create a shipment for an entire order using the Mollie API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -21,6 +25,6 @@ foreach ($shipment->lines as $line) { echo $line->name . ' - status: ' . $line->status . '.'; } -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/shipments/create-shipment-partial.php b/vendor/mollie/mollie-api-php/examples/shipments/create-shipment-partial.php index f4e939099..b37b63ab3 100644 --- a/vendor/mollie/mollie-api-php/examples/shipments/create-shipment-partial.php +++ b/vendor/mollie/mollie-api-php/examples/shipments/create-shipment-partial.php @@ -5,6 +5,10 @@ /* * Example 32 - Create a shipment for part of an order using the Mollie API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -23,6 +27,6 @@ foreach ($shipment->lines as $line) { echo $line->name . '- status: ' . $line->status . '.'; } -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/shipments/get-shipment.php b/vendor/mollie/mollie-api-php/examples/shipments/get-shipment.php index 2ee014456..c3b671d23 100644 --- a/vendor/mollie/mollie-api-php/examples/shipments/get-shipment.php +++ b/vendor/mollie/mollie-api-php/examples/shipments/get-shipment.php @@ -5,6 +5,10 @@ /* * Retrieve a shipment using the Mollie API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -21,6 +25,6 @@ foreach ($shipment->lines as $line) { echo $line->name . ' - status: ' . $line->status . '.'; } -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/shipments/index.php b/vendor/mollie/mollie-api-php/examples/shipments/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/mollie/mollie-api-php/examples/shipments/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/mollie/mollie-api-php/examples/shipments/list-shipments.php b/vendor/mollie/mollie-api-php/examples/shipments/list-shipments.php index 54fde07b2..c3ccc2214 100644 --- a/vendor/mollie/mollie-api-php/examples/shipments/list-shipments.php +++ b/vendor/mollie/mollie-api-php/examples/shipments/list-shipments.php @@ -5,6 +5,10 @@ /* * List shipment for an order using the Mollie API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -24,6 +28,6 @@ echo $line->name . ' - status: ' . $line->status . '.'; } } -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/shipments/update-shipment.php b/vendor/mollie/mollie-api-php/examples/shipments/update-shipment.php index ee77f8c20..3e1202860 100644 --- a/vendor/mollie/mollie-api-php/examples/shipments/update-shipment.php +++ b/vendor/mollie/mollie-api-php/examples/shipments/update-shipment.php @@ -5,6 +5,10 @@ /* * Update shipment tracking information using the Mollie API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -28,6 +32,6 @@ foreach ($shipment->lines as $line) { echo $line->name . ' - status: ' . $line->status . '.'; } -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/subscriptions/cancel-subscription.php b/vendor/mollie/mollie-api-php/examples/subscriptions/cancel-subscription.php index d67758be4..b94f0c007 100644 --- a/vendor/mollie/mollie-api-php/examples/subscriptions/cancel-subscription.php +++ b/vendor/mollie/mollie-api-php/examples/subscriptions/cancel-subscription.php @@ -5,6 +5,10 @@ /* * How to cancel a subscription. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -28,7 +32,7 @@ /* * The subscription status should now be canceled */ - echo "

      The subscription status is now: '" . \htmlspecialchars($canceledSubscription->status) . "'.

      \n"; -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); + echo "

      The subscription status is now: '" . htmlspecialchars($canceledSubscription->status) . "'.

      \n"; +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/subscriptions/create-subscription.php b/vendor/mollie/mollie-api-php/examples/subscriptions/create-subscription.php index 8a8ff8d3a..3b2663312 100644 --- a/vendor/mollie/mollie-api-php/examples/subscriptions/create-subscription.php +++ b/vendor/mollie/mollie-api-php/examples/subscriptions/create-subscription.php @@ -5,6 +5,13 @@ /* * How to create a regular subscription. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function dirname; +use function htmlspecialchars; +use function strcasecmp; +use function time; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -13,9 +20,9 @@ /* * Determine the url parts to these example files. */ - $protocol = isset($_SERVER['HTTPS']) && \strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http"; + $protocol = isset($_SERVER['HTTPS']) && strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http"; $hostname = $_SERVER['HTTP_HOST']; - $path = \dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']); + $path = dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']); /* * Retrieve the last created customer for this example. * If no customers are created yet, run create-customer example. @@ -25,7 +32,7 @@ * Generate a unique subscription id for this example. It is important to include this unique attribute * in the webhookUrl (below) so new payments can be associated with this subscription. */ - $subscriptionId = \time(); + $subscriptionId = time(); /** * Customer Subscription creation parameters. * @@ -41,10 +48,10 @@ * a pending or valid mandate. If the customer has no mandates an error is returned. You * should then set up a "first payment" for the customer. */ - echo "

      The subscription status is '" . \htmlspecialchars($subscription->status) . "'.

      \n"; + echo "

      The subscription status is '" . htmlspecialchars($subscription->status) . "'.

      \n"; echo "

      "; echo '18-cancel-subscription
      '; echo "

      "; -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/examples/subscriptions/index.php b/vendor/mollie/mollie-api-php/examples/subscriptions/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/mollie/mollie-api-php/examples/subscriptions/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/mollie/mollie-api-php/examples/subscriptions/update-subscription.php b/vendor/mollie/mollie-api-php/examples/subscriptions/update-subscription.php index 31b83bbe7..1b35f03ee 100644 --- a/vendor/mollie/mollie-api-php/examples/subscriptions/update-subscription.php +++ b/vendor/mollie/mollie-api-php/examples/subscriptions/update-subscription.php @@ -5,6 +5,10 @@ /* * Updating an existing subscription via the Mollie API. */ + +use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; +use function htmlspecialchars; + try { /* * Initialize the Mollie API library with your API key or OAuth access token. @@ -27,6 +31,6 @@ $subscription->description = 'Monthly subscription'; $subscription->update(); echo "

      Subscription updated: " . $subscription->id . "

      "; -} catch (\_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException $e) { - echo "API call failed: " . \htmlspecialchars($e->getMessage()); +} catch (ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); } diff --git a/vendor/mollie/mollie-api-php/index.php b/vendor/mollie/mollie-api-php/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/mollie/mollie-api-php/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/mollie/mollie-api-php/src/CompatibilityChecker.php b/vendor/mollie/mollie-api-php/src/CompatibilityChecker.php index ad46f92a2..28a0444ca 100644 --- a/vendor/mollie/mollie-api-php/src/CompatibilityChecker.php +++ b/vendor/mollie/mollie-api-php/src/CompatibilityChecker.php @@ -3,6 +3,11 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api; use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\IncompatiblePlatform; +use function extension_loaded; +use function function_exists; +use function version_compare; +use const PHP_VERSION; + class CompatibilityChecker { /** @@ -16,10 +21,10 @@ class CompatibilityChecker public function checkCompatibility() { if (!$this->satisfiesPhpVersion()) { - throw new \_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\IncompatiblePlatform("The client requires PHP version >= " . self::MIN_PHP_VERSION . ", you have " . \PHP_VERSION . ".", \_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\IncompatiblePlatform::INCOMPATIBLE_PHP_VERSION); + throw new IncompatiblePlatform("The client requires PHP version >= " . self::MIN_PHP_VERSION . ", you have " . PHP_VERSION . ".", IncompatiblePlatform::INCOMPATIBLE_PHP_VERSION); } if (!$this->satisfiesJsonExtension()) { - throw new \_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\IncompatiblePlatform("PHP extension json is not enabled. Please make sure to enable 'json' in your PHP configuration.", \_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\IncompatiblePlatform::INCOMPATIBLE_JSON_EXTENSION); + throw new IncompatiblePlatform("PHP extension json is not enabled. Please make sure to enable 'json' in your PHP configuration.", IncompatiblePlatform::INCOMPATIBLE_JSON_EXTENSION); } } /** @@ -28,7 +33,7 @@ public function checkCompatibility() */ public function satisfiesPhpVersion() { - return (bool) \version_compare(\PHP_VERSION, self::MIN_PHP_VERSION, ">="); + return (bool) version_compare(PHP_VERSION, self::MIN_PHP_VERSION, ">="); } /** * @return bool @@ -37,11 +42,11 @@ public function satisfiesPhpVersion() public function satisfiesJsonExtension() { // Check by extension_loaded - if (\function_exists('extension_loaded') && \extension_loaded('json')) { - return \true; - } elseif (\function_exists('json_encode')) { - return \true; + if (function_exists('extension_loaded') && extension_loaded('json')) { + return true; + } elseif (function_exists('json_encode')) { + return true; } - return \false; + return false; } } diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/ChargebackEndpoint.php b/vendor/mollie/mollie-api-php/src/Endpoints/ChargebackEndpoint.php index c6e960f51..4770d3785 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/ChargebackEndpoint.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/ChargebackEndpoint.php @@ -5,7 +5,9 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Chargeback; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\ChargebackCollection; -class ChargebackEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CollectionEndpointAbstract +use stdClass; + +class ChargebackEndpoint extends CollectionEndpointAbstract { protected $resourcePath = "chargebacks"; /** @@ -15,19 +17,19 @@ class ChargebackEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\C */ protected function getResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Chargeback($this->client); + return new Chargeback($this->client); } /** * Get the collection object that is used by this API endpoint. Every API endpoint uses one type of collection object. * * @param int $count - * @param \stdClass $_links + * @param stdClass $_links * * @return ChargebackCollection */ protected function getResourceCollectionObject($count, $_links) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ChargebackCollection($this->client, $count, $_links); + return new ChargebackCollection($this->client, $count, $_links); } /** * Retrieves a collection of Chargebacks from Mollie. diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/CollectionEndpointAbstract.php b/vendor/mollie/mollie-api-php/src/Endpoints/CollectionEndpointAbstract.php index 0b679bf0f..4ba3803e9 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/CollectionEndpointAbstract.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/CollectionEndpointAbstract.php @@ -3,13 +3,15 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Endpoints; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseCollection; -abstract class CollectionEndpointAbstract extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\EndpointAbstract +use stdClass; + +abstract class CollectionEndpointAbstract extends EndpointAbstract { /** * Get the collection object that is used by this API endpoint. Every API endpoint uses one type of collection object. * * @param int $count - * @param \stdClass $_links + * @param stdClass $_links * * @return BaseCollection */ diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/CustomerEndpoint.php b/vendor/mollie/mollie-api-php/src/Endpoints/CustomerEndpoint.php index 9e080c4fd..7d83a5a15 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/CustomerEndpoint.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/CustomerEndpoint.php @@ -5,7 +5,9 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\CustomerCollection; -class CustomerEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CollectionEndpointAbstract +use stdClass; + +class CustomerEndpoint extends CollectionEndpointAbstract { protected $resourcePath = "customers"; /** @@ -15,19 +17,19 @@ class CustomerEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\Col */ protected function getResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer($this->client); + return new Customer($this->client); } /** * Get the collection object that is used by this API endpoint. Every API endpoint uses one type of collection object. * * @param int $count - * @param \stdClass $_links + * @param stdClass $_links * * @return CustomerCollection */ protected function getResourceCollectionObject($count, $_links) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\CustomerCollection($this->client, $count, $_links); + return new CustomerCollection($this->client, $count, $_links); } /** * Creates a customer in Mollie. diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/CustomerPaymentsEndpoint.php b/vendor/mollie/mollie-api-php/src/Endpoints/CustomerPaymentsEndpoint.php index 35e1fcd2f..f37a8b23b 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/CustomerPaymentsEndpoint.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/CustomerPaymentsEndpoint.php @@ -5,7 +5,12 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Payment; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\PaymentCollection; -class CustomerPaymentsEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CollectionEndpointAbstract +use Mollie\Api\Exceptions\ApiException; +use Mollie\Api\Resources\BaseCollection; +use Mollie\Api\Resources\BaseResource; +use stdClass; + +class CustomerPaymentsEndpoint extends CollectionEndpointAbstract { protected $resourcePath = "customers_payments"; /** @@ -15,19 +20,19 @@ class CustomerPaymentsEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpo */ protected function getResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Payment($this->client); + return new Payment($this->client); } /** * Get the collection object that is used by this API endpoint. Every API endpoint uses one type of collection object. * * @param int $count - * @param \stdClass $_links + * @param stdClass $_links * * @return PaymentCollection */ protected function getResourceCollectionObject($count, $_links) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\PaymentCollection($this->client, $count, $_links); + return new PaymentCollection($this->client, $count, $_links); } /** * Create a subscription for a Customer @@ -37,9 +42,9 @@ protected function getResourceCollectionObject($count, $_links) * @param array $filters * * @return Payment - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ - public function createFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer $customer, array $options = [], array $filters = []) + public function createFor(Customer $customer, array $options = [], array $filters = []) { return $this->createForId($customer->id, $options, $filters); } @@ -50,8 +55,8 @@ public function createFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer * @param array $options * @param array $filters * - * @return \Mollie\Api\Resources\BaseResource|\Mollie\Api\Resources\Payment - * @throws \Mollie\Api\Exceptions\ApiException + * @return BaseResource|\Mollie\Api\Resources\Payment + * @throws ApiException */ public function createForId($customerId, array $options = [], array $filters = []) { @@ -65,9 +70,9 @@ public function createForId($customerId, array $options = [], array $filters = [ * @param array $parameters * * @return PaymentCollection - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ - public function listFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer $customer, $from = null, $limit = null, array $parameters = []) + public function listFor(Customer $customer, $from = null, $limit = null, array $parameters = []) { return $this->listForId($customer->id, $from, $limit, $parameters); } @@ -77,8 +82,8 @@ public function listFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer $ * @param int $limit * @param array $parameters * - * @return \Mollie\Api\Resources\BaseCollection|\Mollie\Api\Resources\PaymentCollection - * @throws \Mollie\Api\Exceptions\ApiException + * @return BaseCollection|\Mollie\Api\Resources\PaymentCollection + * @throws ApiException */ public function listForId($customerId, $from = null, $limit = null, array $parameters = []) { diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/EndpointAbstract.php b/vendor/mollie/mollie-api-php/src/Endpoints/EndpointAbstract.php index 45730ccfa..658d61633 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/EndpointAbstract.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/EndpointAbstract.php @@ -7,13 +7,21 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseCollection; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory; +use InvalidArgumentException; +use function array_merge; +use function explode; +use function http_build_query; +use function strpos; +use function strtolower; +use function urlencode; + abstract class EndpointAbstract { - const REST_CREATE = \_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_POST; - const REST_UPDATE = \_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_PATCH; - const REST_READ = \_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_GET; - const REST_LIST = \_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_GET; - const REST_DELETE = \_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_DELETE; + const REST_CREATE = MollieApiClient::HTTP_POST; + const REST_UPDATE = MollieApiClient::HTTP_PATCH; + const REST_READ = MollieApiClient::HTTP_GET; + const REST_LIST = MollieApiClient::HTTP_GET; + const REST_DELETE = MollieApiClient::HTTP_DELETE; /** * @var MollieApiClient */ @@ -29,7 +37,7 @@ abstract class EndpointAbstract /** * @param MollieApiClient $api */ - public function __construct(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient $api) + public function __construct(MollieApiClient $api) { $this->client = $api; } @@ -43,14 +51,14 @@ protected function buildQueryString(array $filters) return ""; } foreach ($filters as $key => $value) { - if ($value === \true) { + if ($value === true) { $filters[$key] = "true"; } - if ($value === \false) { + if ($value === false) { $filters[$key] = "false"; } } - return "?" . \http_build_query($filters, "", "&"); + return "?" . http_build_query($filters, "", "&"); } /** * @param array $body @@ -61,7 +69,7 @@ protected function buildQueryString(array $filters) protected function rest_create(array $body, array $filters) { $result = $this->client->performHttpCall(self::REST_CREATE, $this->getResourcePath() . $this->buildQueryString($filters), $this->parseRequestBody($body)); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createFromApiResult($result, $this->getResourceObject()); + return ResourceFactory::createFromApiResult($result, $this->getResourceObject()); } /** * Retrieves a single object from the REST API. @@ -74,11 +82,11 @@ protected function rest_create(array $body, array $filters) protected function rest_read($id, array $filters) { if (empty($id)) { - throw new \_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException("Invalid resource id."); + throw new ApiException("Invalid resource id."); } - $id = \urlencode($id); + $id = urlencode($id); $result = $this->client->performHttpCall(self::REST_READ, "{$this->getResourcePath()}/{$id}" . $this->buildQueryString($filters)); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createFromApiResult($result, $this->getResourceObject()); + return ResourceFactory::createFromApiResult($result, $this->getResourceObject()); } /** * Sends a DELETE request to a single Molle API object. @@ -92,14 +100,14 @@ protected function rest_read($id, array $filters) protected function rest_delete($id, array $body = []) { if (empty($id)) { - throw new \_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException("Invalid resource id."); + throw new ApiException("Invalid resource id."); } - $id = \urlencode($id); + $id = urlencode($id); $result = $this->client->performHttpCall(self::REST_DELETE, "{$this->getResourcePath()}/{$id}", $this->parseRequestBody($body)); if ($result === null) { return null; } - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createFromApiResult($result, $this->getResourceObject()); + return ResourceFactory::createFromApiResult($result, $this->getResourceObject()); } /** * Get a collection of objects from the REST API. @@ -113,13 +121,13 @@ protected function rest_delete($id, array $body = []) */ protected function rest_list($from = null, $limit = null, array $filters = []) { - $filters = \array_merge(["from" => $from, "limit" => $limit], $filters); + $filters = array_merge(["from" => $from, "limit" => $limit], $filters); $apiPath = $this->getResourcePath() . $this->buildQueryString($filters); $result = $this->client->performHttpCall(self::REST_LIST, $apiPath); /** @var BaseCollection $collection */ $collection = $this->getResourceCollectionObject($result->count, $result->_links); foreach ($result->_embedded->{$collection->getCollectionResourceName()} as $dataResult) { - $collection[] = \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createFromApiResult($dataResult, $this->getResourceObject()); + $collection[] = ResourceFactory::createFromApiResult($dataResult, $this->getResourceObject()); } return $collection; } @@ -134,7 +142,7 @@ protected abstract function getResourceObject(); */ public function setResourcePath($resourcePath) { - $this->resourcePath = \strtolower($resourcePath); + $this->resourcePath = strtolower($resourcePath); } /** * @return string @@ -142,10 +150,10 @@ public function setResourcePath($resourcePath) */ public function getResourcePath() { - if (\strpos($this->resourcePath, "_") !== \false) { - list($parentResource, $childResource) = \explode("_", $this->resourcePath, 2); + if (strpos($this->resourcePath, "_") !== false) { + [$parentResource, $childResource] = explode("_", $this->resourcePath, 2); if (empty($this->parentId)) { - throw new \_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException("Subresource '{$this->resourcePath}' used without parent '{$parentResource}' ID."); + throw new ApiException("Subresource '{$this->resourcePath}' used without parent '{$parentResource}' ID."); } return "{$parentResource}/{$this->parentId}/{$childResource}"; } @@ -163,8 +171,8 @@ protected function parseRequestBody(array $body) } try { $encoded = \_PhpScoper5ea00cc67502b\GuzzleHttp\json_encode($body); - } catch (\InvalidArgumentException $e) { - throw new \_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException("Error encoding parameters into JSON: '" . $e->getMessage() . "'."); + } catch (InvalidArgumentException $e) { + throw new ApiException("Error encoding parameters into JSON: '" . $e->getMessage() . "'."); } return $encoded; } diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/InvoiceEndpoint.php b/vendor/mollie/mollie-api-php/src/Endpoints/InvoiceEndpoint.php index 4212e29c6..5aae9c7a5 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/InvoiceEndpoint.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/InvoiceEndpoint.php @@ -5,29 +5,33 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Invoice; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\InvoiceCollection; -class InvoiceEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CollectionEndpointAbstract +use Mollie\Api\Resources\BaseCollection; +use Mollie\Api\Resources\BaseResource; +use stdClass; + +class InvoiceEndpoint extends CollectionEndpointAbstract { protected $resourcePath = "invoices"; /** * Get the object that is used by this API. Every API uses one type of object. * - * @return \Mollie\Api\Resources\BaseResource + * @return BaseResource */ protected function getResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Invoice($this->client); + return new Invoice($this->client); } /** * Get the collection object that is used by this API. Every API uses one type of collection object. * * @param int $count - * @param \stdClass $_links + * @param stdClass $_links * - * @return \Mollie\Api\Resources\BaseCollection + * @return BaseCollection */ protected function getResourceCollectionObject($count, $_links) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\InvoiceCollection($this->client, $count, $_links); + return new InvoiceCollection($this->client, $count, $_links); } /** * Retrieve an Invoice from Mollie. @@ -63,7 +67,7 @@ public function page($from = null, $limit = null, array $parameters = []) * * @param array|null $parameters * - * @return \Mollie\Api\Resources\BaseCollection + * @return BaseCollection */ public function all(array $parameters = []) { diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/MandateEndpoint.php b/vendor/mollie/mollie-api-php/src/Endpoints/MandateEndpoint.php index 8866863ff..f8ed4381b 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/MandateEndpoint.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/MandateEndpoint.php @@ -6,7 +6,11 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Mandate; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\MandateCollection; -class MandateEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CollectionEndpointAbstract +use Mollie\Api\Exceptions\ApiException; +use Mollie\Api\Resources\BaseResource; +use stdClass; + +class MandateEndpoint extends CollectionEndpointAbstract { protected $resourcePath = "customers_mandates"; /** @@ -16,19 +20,19 @@ class MandateEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\Coll */ protected function getResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Mandate($this->client); + return new Mandate($this->client); } /** * Get the collection object that is used by this API endpoint. Every API endpoint uses one type of collection object. * * @param int $count - * @param \stdClass $_links + * @param stdClass $_links * * @return MandateCollection */ protected function getResourceCollectionObject($count, $_links) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\MandateCollection($this->client, $count, $_links); + return new MandateCollection($this->client, $count, $_links); } /** * @param Customer $customer @@ -36,9 +40,9 @@ protected function getResourceCollectionObject($count, $_links) * @param array $filters * * @return \Mollie\Api\Resources\Mandate - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ - public function createFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer $customer, array $options = [], array $filters = []) + public function createFor(Customer $customer, array $options = [], array $filters = []) { return $this->createForId($customer->id, $options, $filters); } @@ -47,8 +51,8 @@ public function createFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer * @param array $options * @param array $filters * - * @return \Mollie\Api\Resources\BaseResource|\Mollie\Api\Resources\Mandate - * @throws \Mollie\Api\Exceptions\ApiException + * @return BaseResource|\Mollie\Api\Resources\Mandate + * @throws ApiException */ public function createForId($customerId, array $options = [], array $filters = []) { @@ -60,10 +64,10 @@ public function createForId($customerId, array $options = [], array $filters = [ * @param string $mandateId * @param array $parameters * - * @return \Mollie\Api\Resources\BaseResource|\Mollie\Api\Resources\Mandate - * @throws \Mollie\Api\Exceptions\ApiException + * @return BaseResource|\Mollie\Api\Resources\Mandate + * @throws ApiException */ - public function getFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer $customer, $mandateId, array $parameters = []) + public function getFor(Customer $customer, $mandateId, array $parameters = []) { return $this->getForId($customer->id, $mandateId, $parameters); } @@ -72,8 +76,8 @@ public function getFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer $c * @param string $mandateId * @param array $parameters * - * @return \Mollie\Api\Resources\BaseResource - * @throws \Mollie\Api\Exceptions\ApiException + * @return BaseResource + * @throws ApiException */ public function getForId($customerId, $mandateId, array $parameters = []) { @@ -87,9 +91,9 @@ public function getForId($customerId, $mandateId, array $parameters = []) * @param array $parameters * * @return \Mollie\Api\Resources\BaseCollection|\Mollie\Api\Resources\MandateCollection - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ - public function listFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer $customer, $from = null, $limit = null, array $parameters = []) + public function listFor(Customer $customer, $from = null, $limit = null, array $parameters = []) { return $this->listForId($customer->id, $from, $limit, $parameters); } @@ -100,7 +104,7 @@ public function listFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer $ * @param array $parameters * * @return \Mollie\Api\Resources\BaseCollection|\Mollie\Api\Resources\MandateCollection - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ public function listForId($customerId, $from = null, $limit = null, array $parameters = []) { @@ -113,9 +117,9 @@ public function listForId($customerId, $from = null, $limit = null, array $param * @param array $data * * @return null - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ - public function revokeFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer $customer, $mandateId, $data = []) + public function revokeFor(Customer $customer, $mandateId, $data = []) { return $this->revokeForId($customer->id, $mandateId, $data); } @@ -125,7 +129,7 @@ public function revokeFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer * @param array $data * * @return null - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ public function revokeForId($customerId, $mandateId, $data = []) { diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/MethodEndpoint.php b/vendor/mollie/mollie-api-php/src/Endpoints/MethodEndpoint.php index effdd68bd..0a0ed3e51 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/MethodEndpoint.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/MethodEndpoint.php @@ -6,7 +6,11 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Method; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\MethodCollection; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory; -class MethodEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CollectionEndpointAbstract +use Mollie\Api\Resources\BaseCollection; +use Mollie\Api\Resources\BaseResource; +use stdClass; + +class MethodEndpoint extends CollectionEndpointAbstract { protected $resourcePath = "methods"; /** @@ -14,7 +18,7 @@ class MethodEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\Colle */ protected function getResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Method($this->client); + return new Method($this->client); } /** * Retrieve all active methods. In test mode, this includes pending methods. The results are not paginated. @@ -22,7 +26,7 @@ protected function getResourceObject() * @deprecated Use allActive() instead * @param array $parameters * - * @return \Mollie\Api\Resources\BaseCollection|\Mollie\Api\Resources\MethodCollection + * @return BaseCollection|\Mollie\Api\Resources\MethodCollection * @throws ApiException */ public function all(array $parameters = []) @@ -35,7 +39,7 @@ public function all(array $parameters = []) * * @param array $parameters * - * @return \Mollie\Api\Resources\BaseCollection|\Mollie\Api\Resources\MethodCollection + * @return BaseCollection|\Mollie\Api\Resources\MethodCollection * @throws ApiException */ public function allActive(array $parameters = []) @@ -47,26 +51,26 @@ public function allActive(array $parameters = []) * results are not paginated. Make sure to include the profileId parameter if using an OAuth Access Token. * * @param array $parameters Query string parameters. - * @return \Mollie\Api\Resources\BaseCollection|\Mollie\Api\Resources\MethodCollection + * @return BaseCollection|\Mollie\Api\Resources\MethodCollection * @throws \Mollie\Api\Exceptions\ApiException */ public function allAvailable(array $parameters = []) { $url = 'methods/all' . $this->buildQueryString($parameters); $result = $this->client->performHttpCall('GET', $url); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createBaseResourceCollection($this->client, \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Method::class, $result->_embedded->methods, $result->_links); + return ResourceFactory::createBaseResourceCollection($this->client, Method::class, $result->_embedded->methods, $result->_links); } /** * Get the collection object that is used by this API endpoint. Every API endpoint uses one type of collection object. * * @param int $count - * @param \stdClass $_links + * @param stdClass $_links * * @return MethodCollection */ protected function getResourceCollectionObject($count, $_links) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\MethodCollection($count, $_links); + return new MethodCollection($count, $_links); } /** * Retrieve a payment method from Mollie. @@ -75,13 +79,13 @@ protected function getResourceCollectionObject($count, $_links) * * @param string $methodId * @param array $parameters - * @return \Mollie\Api\Resources\BaseResource|\Mollie\Api\Resources\Method + * @return BaseResource|\Mollie\Api\Resources\Method * @throws ApiException */ public function get($methodId, array $parameters = []) { if (empty($methodId)) { - throw new \_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException("Method ID is empty."); + throw new ApiException("Method ID is empty."); } return parent::rest_read($methodId, $parameters); } diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/OnboardingEndpoint.php b/vendor/mollie/mollie-api-php/src/Endpoints/OnboardingEndpoint.php index 7597189a7..7d4f85f65 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/OnboardingEndpoint.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/OnboardingEndpoint.php @@ -6,12 +6,14 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Onboarding; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory; -class OnboardingEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\EndpointAbstract +use BadMethodCallException; + +class OnboardingEndpoint extends EndpointAbstract { protected $resourcePath = "onboarding/me"; protected function getResourceCollectionObject($count, $links) { - throw new \BadMethodCallException('not implemented'); + throw new BadMethodCallException('not implemented'); } /** * Get the object that is used by this API endpoint. Every API endpoint uses one type of object. @@ -20,7 +22,7 @@ protected function getResourceCollectionObject($count, $links) */ protected function getResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Onboarding($this->client); + return new Onboarding($this->client); } /** * Retrieve the organization's onboarding status from Mollie. @@ -52,7 +54,7 @@ public function submit(array $parameters = []) protected function rest_read($id, array $filters) { $result = $this->client->performHttpCall(self::REST_READ, $this->getResourcePath() . $this->buildQueryString($filters)); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createFromApiResult($result, $this->getResourceObject()); + return ResourceFactory::createFromApiResult($result, $this->getResourceObject()); } protected function rest_create(array $body, array $filters) { diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/OrderEndpoint.php b/vendor/mollie/mollie-api-php/src/Endpoints/OrderEndpoint.php index ac722d80f..45f59a287 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/OrderEndpoint.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/OrderEndpoint.php @@ -5,7 +5,10 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Order; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\OrderCollection; -class OrderEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CollectionEndpointAbstract +use stdClass; +use function strpos; + +class OrderEndpoint extends CollectionEndpointAbstract { protected $resourcePath = "orders"; /** @@ -20,20 +23,20 @@ class OrderEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\Collec */ protected function getResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Order($this->client); + return new Order($this->client); } /** * Get the collection object that is used by this API endpoint. Every API * endpoint uses one type of collection object. * * @param int $count - * @param \stdClass $_links + * @param stdClass $_links * * @return OrderCollection */ protected function getResourceCollectionObject($count, $_links) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\OrderCollection($this->client, $count, $_links); + return new OrderCollection($this->client, $count, $_links); } /** * Creates a order in Mollie. @@ -61,8 +64,8 @@ public function create(array $data = [], array $filters = []) */ public function get($orderId, array $parameters = []) { - if (empty($orderId) || \strpos($orderId, self::RESOURCE_ID_PREFIX) !== 0) { - throw new \_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException("Invalid order ID: '{$orderId}'. An order ID should start with '" . self::RESOURCE_ID_PREFIX . "'."); + if (empty($orderId) || strpos($orderId, self::RESOURCE_ID_PREFIX) !== 0) { + throw new ApiException("Invalid order ID: '{$orderId}'. An order ID should start with '" . self::RESOURCE_ID_PREFIX . "'."); } return parent::rest_read($orderId, $parameters); } diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/OrderLineEndpoint.php b/vendor/mollie/mollie-api-php/src/Endpoints/OrderLineEndpoint.php index 5276cdfa1..d7d8a91b0 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/OrderLineEndpoint.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/OrderLineEndpoint.php @@ -7,7 +7,10 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\OrderLine; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\OrderLineCollection; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory; -class OrderLineEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CollectionEndpointAbstract +use stdClass; +use function is_array; + +class OrderLineEndpoint extends CollectionEndpointAbstract { protected $resourcePath = "orders_lines"; /** @@ -22,20 +25,20 @@ class OrderLineEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\Co */ protected function getResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\OrderLine($this->client); + return new OrderLine($this->client); } /** * Get the collection object that is used by this API endpoint. Every API * endpoint uses one type of collection object. * * @param int $count - * @param \stdClass $_links + * @param stdClass $_links * * @return OrderLineCollection */ protected function getResourceCollectionObject($count, $_links) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\OrderLineCollection($count, $_links); + return new OrderLineCollection($count, $_links); } /** * Cancel lines for the provided order. @@ -49,7 +52,7 @@ protected function getResourceCollectionObject($count, $_links) * @return null * @throws ApiException */ - public function cancelFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Order $order, array $data) + public function cancelFor(Order $order, array $data) { return $this->cancelForId($order->id, $data); } @@ -67,8 +70,8 @@ public function cancelFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Order $o */ public function cancelForId($orderId, array $data) { - if (!isset($data['lines']) || !\is_array($data['lines'])) { - throw new \_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException("A lines array is required."); + if (!isset($data['lines']) || !is_array($data['lines'])) { + throw new ApiException("A lines array is required."); } $this->parentId = $orderId; $this->client->performHttpCall(self::REST_DELETE, "{$this->getResourcePath()}", $this->parseRequestBody($data)); diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/OrderPaymentEndpoint.php b/vendor/mollie/mollie-api-php/src/Endpoints/OrderPaymentEndpoint.php index 7da02b24d..052d5998a 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/OrderPaymentEndpoint.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/OrderPaymentEndpoint.php @@ -5,7 +5,11 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Order; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Payment; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\PaymentCollection; -class OrderPaymentEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CollectionEndpointAbstract +use Mollie\Api\Exceptions\ApiException; +use Mollie\Api\Resources\BaseResource; +use stdClass; + +class OrderPaymentEndpoint extends CollectionEndpointAbstract { protected $resourcePath = "orders_payments"; /** @@ -20,20 +24,20 @@ class OrderPaymentEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints */ protected function getResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Payment($this->client); + return new Payment($this->client); } /** * Get the collection object that is used by this API endpoint. Every API * endpoint uses one type of collection object. * * @param int $count - * @param \stdClass $_links + * @param stdClass $_links * * @return \Mollie\Api\Resources\PaymentCollection */ protected function getResourceCollectionObject($count, $_links) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\PaymentCollection($this->client, $count, $_links); + return new PaymentCollection($this->client, $count, $_links); } /** * Creates a payment in Mollie for a specific order. @@ -42,10 +46,10 @@ protected function getResourceCollectionObject($count, $_links) * @param array $data An array containing details on the order payment. * @param array $filters * - * @return \Mollie\Api\Resources\BaseResource|\Mollie\Api\Resources\Payment - * @throws \Mollie\Api\Exceptions\ApiException + * @return BaseResource|\Mollie\Api\Resources\Payment + * @throws ApiException */ - public function createFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Order $order, array $data, array $filters = []) + public function createFor(Order $order, array $data, array $filters = []) { return $this->createForId($order->id, $data, $filters); } @@ -56,8 +60,8 @@ public function createFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Order $o * @param array $data An array containing details on the order payment. * @param array $filters * - * @return \Mollie\Api\Resources\BaseResource|\Mollie\Api\Resources\Payment - * @throws \Mollie\Api\Exceptions\ApiException + * @return BaseResource|\Mollie\Api\Resources\Payment + * @throws ApiException */ public function createForId($orderId, array $data, array $filters = []) { diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/OrderRefundEndpoint.php b/vendor/mollie/mollie-api-php/src/Endpoints/OrderRefundEndpoint.php index 1e6d806e6..018beded5 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/OrderRefundEndpoint.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/OrderRefundEndpoint.php @@ -5,7 +5,11 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Order; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Refund; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\RefundCollection; -class OrderRefundEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CollectionEndpointAbstract +use Mollie\Api\Exceptions\ApiException; +use Mollie\Api\Resources\BaseResource; +use stdClass; + +class OrderRefundEndpoint extends CollectionEndpointAbstract { protected $resourcePath = "orders_refunds"; /** @@ -15,19 +19,19 @@ class OrderRefundEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\ */ protected function getResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Refund($this->client); + return new Refund($this->client); } /** * Get the collection object that is used by this API endpoint. Every API endpoint uses one type of collection object. * * @param int $count - * @param \stdClass $_links + * @param stdClass $_links * * @return RefundCollection */ protected function getResourceCollectionObject($count, $_links) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\RefundCollection($this->client, $count, $_links); + return new RefundCollection($this->client, $count, $_links); } /** * Refund some order lines. You can provide an empty array for the @@ -38,9 +42,9 @@ protected function getResourceCollectionObject($count, $_links) * @param array $filters * * @return Refund - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ - public function createFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Order $order, array $data, array $filters = []) + public function createFor(Order $order, array $data, array $filters = []) { return $this->createForId($order->id, $data, $filters); } @@ -52,8 +56,8 @@ public function createFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Order $o * @param array $data * @param array $filters * - * @return \Mollie\Api\Resources\BaseResource|\Mollie\Api\Resources\Refund - * @throws \Mollie\Api\Exceptions\ApiException + * @return BaseResource|\Mollie\Api\Resources\Refund + * @throws ApiException */ public function createForId($orderId, array $data, array $filters = []) { diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/OrganizationEndpoint.php b/vendor/mollie/mollie-api-php/src/Endpoints/OrganizationEndpoint.php index 0f842cb04..ef95c9c73 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/OrganizationEndpoint.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/OrganizationEndpoint.php @@ -6,7 +6,9 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Method; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Organization; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\OrganizationCollection; -class OrganizationEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CollectionEndpointAbstract +use stdClass; + +class OrganizationEndpoint extends CollectionEndpointAbstract { protected $resourcePath = "organizations"; /** @@ -14,19 +16,19 @@ class OrganizationEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints */ protected function getResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Organization($this->client); + return new Organization($this->client); } /** * Get the collection object that is used by this API endpoint. Every API endpoint uses one type of collection object. * * @param int $count - * @param \stdClass $_links + * @param stdClass $_links * * @return OrganizationCollection */ protected function getResourceCollectionObject($count, $_links) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\OrganizationCollection($this->client, $count, $_links); + return new OrganizationCollection($this->client, $count, $_links); } /** * Retrieve an organization from Mollie. @@ -41,7 +43,7 @@ protected function getResourceCollectionObject($count, $_links) public function get($organizationId, array $parameters = []) { if (empty($organizationId)) { - throw new \_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException("Organization ID is empty."); + throw new ApiException("Organization ID is empty."); } return parent::rest_read($organizationId, $parameters); } diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/PaymentCaptureEndpoint.php b/vendor/mollie/mollie-api-php/src/Endpoints/PaymentCaptureEndpoint.php index fdfc66c1e..0d40a85ec 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/PaymentCaptureEndpoint.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/PaymentCaptureEndpoint.php @@ -5,7 +5,11 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Capture; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\CaptureCollection; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Payment; -class PaymentCaptureEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CollectionEndpointAbstract +use Mollie\Api\Exceptions\ApiException; +use Mollie\Api\Resources\BaseResource; +use stdClass; + +class PaymentCaptureEndpoint extends CollectionEndpointAbstract { protected $resourcePath = "payments_captures"; /** @@ -15,19 +19,19 @@ class PaymentCaptureEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoin */ protected function getResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Capture($this->client); + return new Capture($this->client); } /** * Get the collection object that is used by this API endpoint. Every API endpoint uses one type of collection object. * * @param int $count - * @param \stdClass $_links + * @param stdClass $_links * * @return \Mollie\Api\Resources\CaptureCollection */ protected function getResourceCollectionObject($count, $_links) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\CaptureCollection($this->client, $count, $_links); + return new CaptureCollection($this->client, $count, $_links); } /** * @param Payment $payment @@ -35,9 +39,9 @@ protected function getResourceCollectionObject($count, $_links) * @param array $parameters * * @return Capture - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ - public function getFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Payment $payment, $captureId, array $parameters = []) + public function getFor(Payment $payment, $captureId, array $parameters = []) { return $this->getForId($payment->id, $captureId, $parameters); } @@ -46,8 +50,8 @@ public function getFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Payment $pa * @param string $captureId * @param array $parameters * - * @return \Mollie\Api\Resources\BaseResource|\Mollie\Api\Resources\Capture - * @throws \Mollie\Api\Exceptions\ApiException + * @return BaseResource|\Mollie\Api\Resources\Capture + * @throws ApiException */ public function getForId($paymentId, $captureId, array $parameters = []) { diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/PaymentChargebackEndpoint.php b/vendor/mollie/mollie-api-php/src/Endpoints/PaymentChargebackEndpoint.php index a543b76f6..f5ac54380 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/PaymentChargebackEndpoint.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/PaymentChargebackEndpoint.php @@ -5,7 +5,10 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Chargeback; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\ChargebackCollection; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Payment; -class PaymentChargebackEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CollectionEndpointAbstract +use Mollie\Api\Exceptions\ApiException; +use stdClass; + +class PaymentChargebackEndpoint extends CollectionEndpointAbstract { protected $resourcePath = "payments_chargebacks"; /** @@ -15,19 +18,19 @@ class PaymentChargebackEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endp */ protected function getResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Chargeback($this->client); + return new Chargeback($this->client); } /** * Get the collection object that is used by this API endpoint. Every API endpoint uses one type of collection object. * * @param int $count - * @param \stdClass $_links + * @param stdClass $_links * * @return ChargebackCollection */ protected function getResourceCollectionObject($count, $_links) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ChargebackCollection($this->client, $count, $_links); + return new ChargebackCollection($this->client, $count, $_links); } /** * @param Payment $payment @@ -35,9 +38,9 @@ protected function getResourceCollectionObject($count, $_links) * @param array $parameters * * @return Chargeback - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ - public function getFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Payment $payment, $chargebackId, array $parameters = []) + public function getFor(Payment $payment, $chargebackId, array $parameters = []) { return $this->getForId($payment->id, $chargebackId, $parameters); } @@ -47,7 +50,7 @@ public function getFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Payment $pa * @param array $parameters * * @return Chargeback - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ public function getForId($paymentId, $chargebackId, array $parameters = []) { diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/PaymentEndpoint.php b/vendor/mollie/mollie-api-php/src/Endpoints/PaymentEndpoint.php index 0e7b2ae69..ad1a4a0fd 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/PaymentEndpoint.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/PaymentEndpoint.php @@ -7,7 +7,13 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\PaymentCollection; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Refund; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory; -class PaymentEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CollectionEndpointAbstract +use stdClass; +use function count; +use function json_encode; +use function strpos; +use function urlencode; + +class PaymentEndpoint extends CollectionEndpointAbstract { protected $resourcePath = "payments"; /** @@ -19,19 +25,19 @@ class PaymentEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\Coll */ protected function getResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Payment($this->client); + return new Payment($this->client); } /** * Get the collection object that is used by this API endpoint. Every API endpoint uses one type of collection object. * * @param int $count - * @param \stdClass $_links + * @param stdClass $_links * * @return PaymentCollection */ protected function getResourceCollectionObject($count, $_links) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\PaymentCollection($this->client, $count, $_links); + return new PaymentCollection($this->client, $count, $_links); } /** * Creates a payment in Mollie. @@ -58,8 +64,8 @@ public function create(array $data = [], array $filters = []) */ public function get($paymentId, array $parameters = []) { - if (empty($paymentId) || \strpos($paymentId, self::RESOURCE_ID_PREFIX) !== 0) { - throw new \_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException("Invalid payment ID: '{$paymentId}'. A payment ID should start with '" . self::RESOURCE_ID_PREFIX . "'."); + if (empty($paymentId) || strpos($paymentId, self::RESOURCE_ID_PREFIX) !== 0) { + throw new ApiException("Invalid payment ID: '{$paymentId}'. A payment ID should start with '" . self::RESOURCE_ID_PREFIX . "'."); } return parent::rest_read($paymentId, $parameters); } @@ -121,14 +127,14 @@ public function page($from = null, $limit = null, array $parameters = []) * @return Refund * @throws ApiException */ - public function refund(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Payment $payment, $data = []) + public function refund(Payment $payment, $data = []) { - $resource = "{$this->getResourcePath()}/" . \urlencode($payment->id) . "/refunds"; + $resource = "{$this->getResourcePath()}/" . urlencode($payment->id) . "/refunds"; $body = null; - if (\count($data) > 0) { - $body = \json_encode($data); + if (count($data) > 0) { + $body = json_encode($data); } $result = $this->client->performHttpCall(self::REST_CREATE, $resource, $body); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createFromApiResult($result, new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Refund($this->client)); + return ResourceFactory::createFromApiResult($result, new Refund($this->client)); } } diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/PaymentRefundEndpoint.php b/vendor/mollie/mollie-api-php/src/Endpoints/PaymentRefundEndpoint.php index 1c4e982e6..215f42787 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/PaymentRefundEndpoint.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/PaymentRefundEndpoint.php @@ -5,7 +5,11 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Payment; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Refund; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\RefundCollection; -class PaymentRefundEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CollectionEndpointAbstract +use Mollie\Api\Exceptions\ApiException; +use Mollie\Api\Resources\BaseResource; +use stdClass; + +class PaymentRefundEndpoint extends CollectionEndpointAbstract { protected $resourcePath = "payments_refunds"; /** @@ -15,19 +19,19 @@ class PaymentRefundEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoint */ protected function getResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Refund($this->client); + return new Refund($this->client); } /** * Get the collection object that is used by this API endpoint. Every API endpoint uses one type of collection object. * * @param int $count - * @param \stdClass $_links + * @param stdClass $_links * * @return RefundCollection */ protected function getResourceCollectionObject($count, $_links) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\RefundCollection($this->client, $count, $_links); + return new RefundCollection($this->client, $count, $_links); } /** * @param Payment $payment @@ -35,9 +39,9 @@ protected function getResourceCollectionObject($count, $_links) * @param array $parameters * * @return Refund - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ - public function getFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Payment $payment, $refundId, array $parameters = []) + public function getFor(Payment $payment, $refundId, array $parameters = []) { return $this->getForId($payment->id, $refundId, $parameters); } @@ -46,8 +50,8 @@ public function getFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Payment $pa * @param string $refundId * @param array $parameters * - * @return \Mollie\Api\Resources\BaseResource|\Mollie\Api\Resources\Refund - * @throws \Mollie\Api\Exceptions\ApiException + * @return BaseResource|\Mollie\Api\Resources\Refund + * @throws ApiException */ public function getForId($paymentId, $refundId, array $parameters = []) { diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/PermissionEndpoint.php b/vendor/mollie/mollie-api-php/src/Endpoints/PermissionEndpoint.php index 12c17e327..91c2e08de 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/PermissionEndpoint.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/PermissionEndpoint.php @@ -5,7 +5,9 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Permission; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\PermissionCollection; -class PermissionEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CollectionEndpointAbstract +use stdClass; + +class PermissionEndpoint extends CollectionEndpointAbstract { protected $resourcePath = "permissions"; /** @@ -16,20 +18,20 @@ class PermissionEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\C */ protected function getResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Permission($this->client); + return new Permission($this->client); } /** * Get the collection object that is used by this API endpoint. Every API * endpoint uses one type of collection object. * * @param int $count - * @param \stdClass $_links + * @param stdClass $_links * * @return PermissionCollection */ protected function getResourceCollectionObject($count, $_links) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\PermissionCollection($count, $_links); + return new PermissionCollection($count, $_links); } /** * Retrieve a single Permission from Mollie. diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/ProfileEndpoint.php b/vendor/mollie/mollie-api-php/src/Endpoints/ProfileEndpoint.php index 6c6178e76..beaf71d04 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/ProfileEndpoint.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/ProfileEndpoint.php @@ -6,10 +6,14 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\CurrentProfile; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Profile; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\ProfileCollection; -class ProfileEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CollectionEndpointAbstract +use Mollie\Api\Resources\BaseCollection; +use Mollie\Api\Resources\BaseResource; +use stdClass; + +class ProfileEndpoint extends CollectionEndpointAbstract { protected $resourcePath = "profiles"; - protected $resourceClass = \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Profile::class; + protected $resourceClass = Profile::class; /** * Get the object that is used by this API endpoint. Every API endpoint uses one type of object. * @@ -23,13 +27,13 @@ protected function getResourceObject() * Get the collection object that is used by this API endpoint. Every API endpoint uses one type of collection object. * * @param int $count - * @param \stdClass $_links + * @param stdClass $_links * * @return ProfileCollection */ protected function getResourceCollectionObject($count, $_links) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ProfileCollection($this->client, $count, $_links); + return new ProfileCollection($this->client, $count, $_links); } /** * Creates a Profile in Mollie. @@ -37,7 +41,7 @@ protected function getResourceCollectionObject($count, $_links) * @param array $data An array containing details on the profile. * @param array $filters * - * @return \Mollie\Api\Resources\BaseResource|\Mollie\Api\Resources\Profile + * @return BaseResource|\Mollie\Api\Resources\Profile * @throws ApiException */ public function create(array $data = [], array $filters = []) @@ -52,7 +56,7 @@ public function create(array $data = [], array $filters = []) * @param string $profileId * @param array $parameters * - * @return \Mollie\Api\Resources\BaseResource|\Mollie\Api\Resources\Profile + * @return BaseResource|\Mollie\Api\Resources\Profile * @throws ApiException */ public function get($profileId, array $parameters = []) @@ -67,12 +71,12 @@ public function get($profileId, array $parameters = []) * * @param array $parameters * - * @return \Mollie\Api\Resources\BaseResource|\Mollie\Api\Resources\CurrentProfile + * @return BaseResource|\Mollie\Api\Resources\CurrentProfile * @throws ApiException */ public function getCurrent(array $parameters = []) { - $this->resourceClass = \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\CurrentProfile::class; + $this->resourceClass = CurrentProfile::class; return $this->rest_read('me', $parameters); } /** @@ -84,7 +88,7 @@ public function getCurrent(array $parameters = []) * @param string $profileId * * @param array $data - * @return \Mollie\Api\Resources\BaseResource|\Mollie\Api\Resources\Profile + * @return BaseResource|\Mollie\Api\Resources\Profile * @throws ApiException */ public function delete($profileId, array $data = []) @@ -98,7 +102,7 @@ public function delete($profileId, array $data = []) * @param int $limit * @param array $parameters * - * @return \Mollie\Api\Resources\BaseCollection|\Mollie\Api\Resources\ProfileCollection + * @return BaseCollection|\Mollie\Api\Resources\ProfileCollection * @throws ApiException */ public function page($from = null, $limit = null, array $parameters = []) diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/ProfileMethodEndpoint.php b/vendor/mollie/mollie-api-php/src/Endpoints/ProfileMethodEndpoint.php index e599debde..fe81b3a80 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/ProfileMethodEndpoint.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/ProfileMethodEndpoint.php @@ -6,7 +6,14 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\MethodCollection; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Profile; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory; -class ProfileMethodEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CollectionEndpointAbstract +use Mollie\Api\Exceptions\ApiException; +use Mollie\Api\Resources\BaseResource; +use stdClass; +use function count; +use function json_encode; +use function urlencode; + +class ProfileMethodEndpoint extends CollectionEndpointAbstract { protected $resourcePath = "profiles_methods"; /** @@ -16,19 +23,19 @@ class ProfileMethodEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoint */ protected function getResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Method($this->client); + return new Method($this->client); } /** * Get the collection object that is used by this API endpoint. Every API endpoint uses one type of collection object. * * @param int $count - * @param \stdClass $_links + * @param stdClass $_links * * @return MethodCollection() */ protected function getResourceCollectionObject($count, $_links) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\MethodCollection($count, $_links); + return new MethodCollection($count, $_links); } /** * Enable a method for the provided Profile ID. @@ -36,19 +43,19 @@ protected function getResourceCollectionObject($count, $_links) * @param $profileId * @param $methodId * @param array $data - * @return \Mollie\Api\Resources\BaseResource - * @throws \Mollie\Api\Exceptions\ApiException + * @return BaseResource + * @throws ApiException */ public function createForId($profileId, $methodId, array $data = []) { $this->parentId = $profileId; - $resource = $this->getResourcePath() . '/' . \urlencode($methodId); + $resource = $this->getResourcePath() . '/' . urlencode($methodId); $body = null; - if (\count($data) > 0) { - $body = \json_encode($data); + if (count($data) > 0) { + $body = json_encode($data); } $result = $this->client->performHttpCall(self::REST_CREATE, $resource, $body); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createFromApiResult($result, new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Method($this->client)); + return ResourceFactory::createFromApiResult($result, new Method($this->client)); } /** * Enable a method for the provided Profile object. @@ -57,7 +64,7 @@ public function createForId($profileId, $methodId, array $data = []) * @param string $methodId * @param array $data * @return Method - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ public function createFor($profile, $methodId, array $data = []) { @@ -68,8 +75,8 @@ public function createFor($profile, $methodId, array $data = []) * * @param $methodId * @param array $data - * @return \Mollie\Api\Resources\BaseResource - * @throws \Mollie\Api\Exceptions\ApiException + * @return BaseResource + * @throws ApiException */ public function createForCurrentProfile($methodId, array $data = []) { @@ -81,8 +88,8 @@ public function createForCurrentProfile($methodId, array $data = []) * @param $profileId * @param $methodId * @param array $data - * @return \Mollie\Api\Resources\BaseResource - * @throws \Mollie\Api\Exceptions\ApiException + * @return BaseResource + * @throws ApiException */ public function deleteForId($profileId, $methodId, array $data = []) { @@ -95,8 +102,8 @@ public function deleteForId($profileId, $methodId, array $data = []) * @param $profile * @param $methodId * @param array $data - * @return \Mollie\Api\Resources\BaseResource - * @throws \Mollie\Api\Exceptions\ApiException + * @return BaseResource + * @throws ApiException */ public function deleteFor($profile, $methodId, array $data = []) { @@ -107,8 +114,8 @@ public function deleteFor($profile, $methodId, array $data = []) * * @param $methodId * @param array $data - * @return \Mollie\Api\Resources\BaseResource - * @throws \Mollie\Api\Exceptions\ApiException + * @return BaseResource + * @throws ApiException */ public function deleteForCurrentProfile($methodId, array $data) { diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/RefundEndpoint.php b/vendor/mollie/mollie-api-php/src/Endpoints/RefundEndpoint.php index ba2d14a49..e87f46ba0 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/RefundEndpoint.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/RefundEndpoint.php @@ -5,7 +5,9 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Refund; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\RefundCollection; -class RefundEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CollectionEndpointAbstract +use stdClass; + +class RefundEndpoint extends CollectionEndpointAbstract { protected $resourcePath = "refunds"; /** @@ -15,19 +17,19 @@ class RefundEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\Colle */ protected function getResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Refund($this->client); + return new Refund($this->client); } /** * Get the collection object that is used by this API endpoint. Every API endpoint uses one type of collection object. * * @param int $count - * @param \stdClass $_links + * @param stdClass $_links * * @return RefundCollection */ protected function getResourceCollectionObject($count, $_links) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\RefundCollection($this->client, $count, $_links); + return new RefundCollection($this->client, $count, $_links); } /** * Retrieves a collection of Refunds from Mollie. diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/SettlementsEndpoint.php b/vendor/mollie/mollie-api-php/src/Endpoints/SettlementsEndpoint.php index a0ab48de2..5a13cc4e9 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/SettlementsEndpoint.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/SettlementsEndpoint.php @@ -5,29 +5,33 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Settlement; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\SettlementCollection; -class SettlementsEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CollectionEndpointAbstract +use Mollie\Api\Resources\BaseCollection; +use Mollie\Api\Resources\BaseResource; +use stdClass; + +class SettlementsEndpoint extends CollectionEndpointAbstract { protected $resourcePath = "settlements"; /** * Get the object that is used by this API. Every API uses one type of object. * - * @return \Mollie\Api\Resources\BaseResource + * @return BaseResource */ protected function getResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Settlement($this->client); + return new Settlement($this->client); } /** * Get the collection object that is used by this API. Every API uses one type of collection object. * * @param int $count - * @param \stdClass $_links + * @param stdClass $_links * - * @return \Mollie\Api\Resources\BaseCollection + * @return BaseCollection */ protected function getResourceCollectionObject($count, $_links) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\SettlementCollection($this->client, $count, $_links); + return new SettlementCollection($this->client, $count, $_links); } /** * Retrieve a single settlement from Mollie. diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/ShipmentEndpoint.php b/vendor/mollie/mollie-api-php/src/Endpoints/ShipmentEndpoint.php index 55d9a8b00..3f6095408 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/ShipmentEndpoint.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/ShipmentEndpoint.php @@ -5,7 +5,12 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Order; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Shipment; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\ShipmentCollection; -class ShipmentEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CollectionEndpointAbstract +use Mollie\Api\Exceptions\ApiException; +use Mollie\Api\Resources\BaseCollection; +use Mollie\Api\Resources\BaseResource; +use stdClass; + +class ShipmentEndpoint extends CollectionEndpointAbstract { protected $resourcePath = "orders_shipments"; /** @@ -19,20 +24,20 @@ class ShipmentEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\Col */ protected function getResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Shipment($this->client); + return new Shipment($this->client); } /** * Get the collection object that is used by this API endpoint. Every API * endpoint uses one type of collection object. * * @param int $count - * @param \stdClass $_links + * @param stdClass $_links * * @return ShipmentCollection */ protected function getResourceCollectionObject($count, $_links) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ShipmentCollection($count, $_links); + return new ShipmentCollection($count, $_links); } /** * Create a shipment for some order lines. You can provide an empty array for the @@ -43,9 +48,9 @@ protected function getResourceCollectionObject($count, $_links) * @param array $filters * * @return Shipment - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ - public function createFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Order $order, array $options = [], array $filters = []) + public function createFor(Order $order, array $options = [], array $filters = []) { return $this->createForId($order->id, $options, $filters); } @@ -58,7 +63,7 @@ public function createFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Order $o * @param array $filters * * @return Shipment - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ public function createForId($orderId, array $options = [], array $filters = []) { @@ -73,9 +78,9 @@ public function createForId($orderId, array $options = [], array $filters = []) * @param array $parameters * * @return Shipment - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ - public function getFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Order $order, $shipmentId, array $parameters = []) + public function getFor(Order $order, $shipmentId, array $parameters = []) { return $this->getForId($order->id, $shipmentId, $parameters); } @@ -86,8 +91,8 @@ public function getFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Order $orde * @param string $shipmentId * @param array $parameters * - * @return \Mollie\Api\Resources\BaseResource|\Mollie\Api\Resources\Shipment - * @throws \Mollie\Api\Exceptions\ApiException + * @return BaseResource|\Mollie\Api\Resources\Shipment + * @throws ApiException */ public function getForId($orderId, $shipmentId, array $parameters = []) { @@ -101,9 +106,9 @@ public function getForId($orderId, $shipmentId, array $parameters = []) * @param array $parameters * * @return ShipmentCollection - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ - public function listFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Order $order, array $parameters = []) + public function listFor(Order $order, array $parameters = []) { return $this->listForId($order->id, $parameters); } @@ -113,8 +118,8 @@ public function listFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Order $ord * @param string $orderId * @param array $parameters * - * @return \Mollie\Api\Resources\BaseCollection|\Mollie\Api\Resources\ShipmentCollection - * @throws \Mollie\Api\Exceptions\ApiException + * @return BaseCollection|\Mollie\Api\Resources\ShipmentCollection + * @throws ApiException */ public function listForId($orderId, array $parameters = []) { diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/SubscriptionEndpoint.php b/vendor/mollie/mollie-api-php/src/Endpoints/SubscriptionEndpoint.php index d396b2f4c..b979ead32 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/SubscriptionEndpoint.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/SubscriptionEndpoint.php @@ -6,7 +6,11 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\Subscription; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\SubscriptionCollection; -class SubscriptionEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CollectionEndpointAbstract +use Mollie\Api\Exceptions\ApiException; +use stdClass; +use function array_merge; + +class SubscriptionEndpoint extends CollectionEndpointAbstract { protected $resourcePath = "customers_subscriptions"; /** @@ -16,19 +20,19 @@ class SubscriptionEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints */ protected function getResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Subscription($this->client); + return new Subscription($this->client); } /** * Get the collection object that is used by this API endpoint. Every API endpoint uses one type of collection object. * * @param int $count - * @param \stdClass $_links + * @param stdClass $_links * * @return SubscriptionCollection */ protected function getResourceCollectionObject($count, $_links) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\SubscriptionCollection($this->client, $count, $_links); + return new SubscriptionCollection($this->client, $count, $_links); } /** * Create a subscription for a Customer @@ -39,7 +43,7 @@ protected function getResourceCollectionObject($count, $_links) * * @return Subscription */ - public function createFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer $customer, array $options = [], array $filters = []) + public function createFor(Customer $customer, array $options = [], array $filters = []) { $this->parentId = $customer->id; return parent::rest_create($options, $filters); @@ -51,7 +55,7 @@ public function createFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer * * @return Subscription */ - public function getFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer $customer, $subscriptionId, array $parameters = []) + public function getFor(Customer $customer, $subscriptionId, array $parameters = []) { $this->parentId = $customer->id; return parent::rest_read($subscriptionId, $parameters); @@ -64,7 +68,7 @@ public function getFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer $c * * @return SubscriptionCollection */ - public function listFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer $customer, $from = null, $limit = null, array $parameters = []) + public function listFor(Customer $customer, $from = null, $limit = null, array $parameters = []) { $this->parentId = $customer->id; return parent::rest_list($from, $limit, $parameters); @@ -75,9 +79,9 @@ public function listFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer $ * * @param array $data * @return null - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ - public function cancelFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer $customer, $subscriptionId, array $data = []) + public function cancelFor(Customer $customer, $subscriptionId, array $data = []) { $this->parentId = $customer->id; return parent::rest_delete($subscriptionId, $data); @@ -90,17 +94,17 @@ public function cancelFor(\_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer * @param array $parameters * * @return SubscriptionCollection - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ public function page($from = null, $limit = null, array $parameters = []) { - $filters = \array_merge(["from" => $from, "limit" => $limit], $parameters); + $filters = array_merge(["from" => $from, "limit" => $limit], $parameters); $apiPath = 'subscriptions' . $this->buildQueryString($filters); $result = $this->client->performHttpCall(self::REST_LIST, $apiPath); /** @var SubscriptionCollection $collection */ $collection = $this->getResourceCollectionObject($result->count, $result->_links); foreach ($result->_embedded->{$collection->getCollectionResourceName()} as $dataResult) { - $collection[] = \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createFromApiResult($dataResult, $this->getResourceObject()); + $collection[] = ResourceFactory::createFromApiResult($dataResult, $this->getResourceObject()); } return $collection; } diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/WalletEndpoint.php b/vendor/mollie/mollie-api-php/src/Endpoints/WalletEndpoint.php index 8b5e9dafb..fc3c7c68d 100644 --- a/vendor/mollie/mollie-api-php/src/Endpoints/WalletEndpoint.php +++ b/vendor/mollie/mollie-api-php/src/Endpoints/WalletEndpoint.php @@ -3,7 +3,9 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Endpoints; use _PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource; -class WalletEndpoint extends \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\EndpointAbstract +use function json_encode; + +class WalletEndpoint extends EndpointAbstract { /** * Get the object that is used by this API endpoint. Every API endpoint uses one type of object. @@ -18,6 +20,6 @@ public function requestApplePayPaymentSession($domain, $validationUrl) { $body = $this->parseRequestBody(['domain' => $domain, 'validationUrl' => $validationUrl]); $response = $this->client->performHttpCall(self::REST_CREATE, 'wallets/applepay/sessions', $body); - return \json_encode($response); + return json_encode($response); } } diff --git a/vendor/mollie/mollie-api-php/src/Endpoints/index.php b/vendor/mollie/mollie-api-php/src/Endpoints/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/mollie/mollie-api-php/src/Endpoints/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/mollie/mollie-api-php/src/Exceptions/ApiException.php b/vendor/mollie/mollie-api-php/src/Exceptions/ApiException.php index 396e65263..49721e12f 100644 --- a/vendor/mollie/mollie-api-php/src/Exceptions/ApiException.php +++ b/vendor/mollie/mollie-api-php/src/Exceptions/ApiException.php @@ -3,8 +3,17 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions; use _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Response; +use Exception; +use GuzzleHttp\Exception\RequestException; +use Psr\Http\Message\ResponseInterface; use Throwable; -class ApiException extends \Exception +use function array_key_exists; +use function json_decode; +use function json_last_error; +use function method_exists; +use const JSON_ERROR_NONE; + +class ApiException extends Exception { /** * @var string @@ -23,10 +32,10 @@ class ApiException extends \Exception * @param int $code * @param string|null $field * @param \GuzzleHttp\Psr7\Response|null $response - * @param \Throwable|null $previous + * @param Throwable|null $previous * @throws \Mollie\Api\Exceptions\ApiException */ - public function __construct($message = "", $code = 0, $field = null, \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Response $response = null, \Throwable $previous = null) + public function __construct($message = "", $code = 0, $field = null, Response $response = null, Throwable $previous = null) { if (!empty($field)) { $this->field = (string) $field; @@ -47,15 +56,15 @@ public function __construct($message = "", $code = 0, $field = null, \_PhpScoper parent::__construct($message, $code, $previous); } /** - * @param \GuzzleHttp\Exception\RequestException $guzzleException - * @param \Throwable $previous + * @param RequestException $guzzleException + * @param Throwable $previous * @return \Mollie\Api\Exceptions\ApiException * @throws \Mollie\Api\Exceptions\ApiException */ - public static function createFromGuzzleException($guzzleException, \Throwable $previous = null) + public static function createFromGuzzleException($guzzleException, Throwable $previous = null) { // Not all Guzzle Exceptions implement hasResponse() / getResponse() - if (\method_exists($guzzleException, 'hasResponse') && \method_exists($guzzleException, 'getResponse')) { + if (method_exists($guzzleException, 'hasResponse') && method_exists($guzzleException, 'getResponse')) { if ($guzzleException->hasResponse()) { return static::createFromResponse($guzzleException->getResponse()); } @@ -63,12 +72,12 @@ public static function createFromGuzzleException($guzzleException, \Throwable $p return new static($guzzleException->getMessage(), $guzzleException->getCode(), null, $previous); } /** - * @param \Psr\Http\Message\ResponseInterface $response - * @param \Throwable|null $previous + * @param ResponseInterface $response + * @param Throwable|null $previous * @return \Mollie\Api\Exceptions\ApiException * @throws \Mollie\Api\Exceptions\ApiException */ - public static function createFromResponse($response, \Throwable $previous = null) + public static function createFromResponse($response, Throwable $previous = null) { $object = static::parseResponseBody($response); $field = null; @@ -118,7 +127,7 @@ public function hasResponse() */ public function hasLink($key) { - return \array_key_exists($key, $this->links); + return array_key_exists($key, $this->links); } /** * @param $key @@ -150,8 +159,8 @@ public function getUrl($key) protected static function parseResponseBody($response) { $body = (string) $response->getBody(); - $object = @\json_decode($body); - if (\json_last_error() !== \JSON_ERROR_NONE) { + $object = @json_decode($body); + if (json_last_error() !== JSON_ERROR_NONE) { throw new static("Unable to decode Mollie response: '{$body}'."); } return $object; diff --git a/vendor/mollie/mollie-api-php/src/Exceptions/IncompatiblePlatform.php b/vendor/mollie/mollie-api-php/src/Exceptions/IncompatiblePlatform.php index 485e0e9a7..ec035ead6 100644 --- a/vendor/mollie/mollie-api-php/src/Exceptions/IncompatiblePlatform.php +++ b/vendor/mollie/mollie-api-php/src/Exceptions/IncompatiblePlatform.php @@ -2,7 +2,7 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions; -class IncompatiblePlatform extends \_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException +class IncompatiblePlatform extends ApiException { const INCOMPATIBLE_PHP_VERSION = 1000; const INCOMPATIBLE_CURL_EXTENSION = 2000; diff --git a/vendor/mollie/mollie-api-php/src/Exceptions/index.php b/vendor/mollie/mollie-api-php/src/Exceptions/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/mollie/mollie-api-php/src/Exceptions/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/mollie/mollie-api-php/src/MollieApiClient.php b/vendor/mollie/mollie-api-php/src/MollieApiClient.php index 4e1f86229..d4e9f6db0 100644 --- a/vendor/mollie/mollie-api-php/src/MollieApiClient.php +++ b/vendor/mollie/mollie-api-php/src/MollieApiClient.php @@ -2,10 +2,12 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api; +use _PhpScoper5ea00cc67502b\Composer\CaBundle\CaBundle; use _PhpScoper5ea00cc67502b\GuzzleHttp\Client; use _PhpScoper5ea00cc67502b\GuzzleHttp\ClientInterface; use _PhpScoper5ea00cc67502b\GuzzleHttp\Exception\GuzzleException; use _PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Request; +use _PhpScoper5ea00cc67502b\GuzzleHttp\RequestOptions; use _PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\ChargebackEndpoint; use _PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CustomerEndpoint; use _PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CustomerPaymentsEndpoint; @@ -34,6 +36,19 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\IncompatiblePlatform; use _PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface; use _PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface; +use stdClass; +use function function_exists; +use function implode; +use function json_decode; +use function json_last_error; +use function php_uname; +use function phpversion; +use function preg_match; +use function rtrim; +use function str_replace; +use function trim; +use const JSON_ERROR_NONE; + class MollieApiClient { /** @@ -232,42 +247,42 @@ class MollieApiClient * * @throws IncompatiblePlatform */ - public function __construct(\_PhpScoper5ea00cc67502b\GuzzleHttp\ClientInterface $httpClient = null) + public function __construct(ClientInterface $httpClient = null) { - $this->httpClient = $httpClient ? $httpClient : new \_PhpScoper5ea00cc67502b\GuzzleHttp\Client([\_PhpScoper5ea00cc67502b\GuzzleHttp\RequestOptions::VERIFY => \_PhpScoper5ea00cc67502b\Composer\CaBundle\CaBundle::getBundledCaBundlePath(), \_PhpScoper5ea00cc67502b\GuzzleHttp\RequestOptions::TIMEOUT => self::TIMEOUT]); - $compatibilityChecker = new \_PhpScoper5ea00cc67502b\Mollie\Api\CompatibilityChecker(); + $this->httpClient = $httpClient ? $httpClient : new Client([RequestOptions::VERIFY => CaBundle::getBundledCaBundlePath(), RequestOptions::TIMEOUT => self::TIMEOUT]); + $compatibilityChecker = new CompatibilityChecker(); $compatibilityChecker->checkCompatibility(); $this->initializeEndpoints(); $this->addVersionString("Mollie/" . self::CLIENT_VERSION); - $this->addVersionString("PHP/" . \phpversion()); - $this->addVersionString("Guzzle/" . \_PhpScoper5ea00cc67502b\GuzzleHttp\ClientInterface::VERSION); + $this->addVersionString("PHP/" . phpversion()); + $this->addVersionString("Guzzle/" . ClientInterface::VERSION); } public function initializeEndpoints() { - $this->payments = new \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\PaymentEndpoint($this); - $this->methods = new \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\MethodEndpoint($this); - $this->profileMethods = new \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\ProfileMethodEndpoint($this); - $this->customers = new \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CustomerEndpoint($this); - $this->settlements = new \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\SettlementsEndpoint($this); - $this->subscriptions = new \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\SubscriptionEndpoint($this); - $this->customerPayments = new \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\CustomerPaymentsEndpoint($this); - $this->mandates = new \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\MandateEndpoint($this); - $this->invoices = new \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\InvoiceEndpoint($this); - $this->permissions = new \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\PermissionEndpoint($this); - $this->profiles = new \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\ProfileEndpoint($this); - $this->onboarding = new \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\OnboardingEndpoint($this); - $this->organizations = new \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\OrganizationEndpoint($this); - $this->orders = new \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\OrderEndpoint($this); - $this->orderLines = new \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\OrderLineEndpoint($this); - $this->orderPayments = new \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\OrderPaymentEndpoint($this); - $this->orderRefunds = new \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\OrderRefundEndpoint($this); - $this->shipments = new \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\ShipmentEndpoint($this); - $this->refunds = new \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\RefundEndpoint($this); - $this->paymentRefunds = new \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\PaymentRefundEndpoint($this); - $this->paymentCaptures = new \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\PaymentCaptureEndpoint($this); - $this->chargebacks = new \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\ChargebackEndpoint($this); - $this->paymentChargebacks = new \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\PaymentChargebackEndpoint($this); - $this->wallets = new \_PhpScoper5ea00cc67502b\Mollie\Api\Endpoints\WalletEndpoint($this); + $this->payments = new PaymentEndpoint($this); + $this->methods = new MethodEndpoint($this); + $this->profileMethods = new ProfileMethodEndpoint($this); + $this->customers = new CustomerEndpoint($this); + $this->settlements = new SettlementsEndpoint($this); + $this->subscriptions = new SubscriptionEndpoint($this); + $this->customerPayments = new CustomerPaymentsEndpoint($this); + $this->mandates = new MandateEndpoint($this); + $this->invoices = new InvoiceEndpoint($this); + $this->permissions = new PermissionEndpoint($this); + $this->profiles = new ProfileEndpoint($this); + $this->onboarding = new OnboardingEndpoint($this); + $this->organizations = new OrganizationEndpoint($this); + $this->orders = new OrderEndpoint($this); + $this->orderLines = new OrderLineEndpoint($this); + $this->orderPayments = new OrderPaymentEndpoint($this); + $this->orderRefunds = new OrderRefundEndpoint($this); + $this->shipments = new ShipmentEndpoint($this); + $this->refunds = new RefundEndpoint($this); + $this->paymentRefunds = new PaymentRefundEndpoint($this); + $this->paymentCaptures = new PaymentCaptureEndpoint($this); + $this->chargebacks = new ChargebackEndpoint($this); + $this->paymentChargebacks = new PaymentChargebackEndpoint($this); + $this->wallets = new WalletEndpoint($this); } /** * @param string $url @@ -276,7 +291,7 @@ public function initializeEndpoints() */ public function setApiEndpoint($url) { - $this->apiEndpoint = \rtrim(\trim($url), '/'); + $this->apiEndpoint = rtrim(trim($url), '/'); return $this; } /** @@ -294,12 +309,12 @@ public function getApiEndpoint() */ public function setApiKey($apiKey) { - $apiKey = \trim($apiKey); - if (!\preg_match('/^(live|test)_\\w{30,}$/', $apiKey)) { - throw new \_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException("Invalid API key: '{$apiKey}'. An API key must start with 'test_' or 'live_' and must be at least 30 characters long."); + $apiKey = trim($apiKey); + if (!preg_match('/^(live|test)_\\w{30,}$/', $apiKey)) { + throw new ApiException("Invalid API key: '{$apiKey}'. An API key must start with 'test_' or 'live_' and must be at least 30 characters long."); } $this->apiKey = $apiKey; - $this->oauthAccess = \false; + $this->oauthAccess = false; return $this; } /** @@ -310,12 +325,12 @@ public function setApiKey($apiKey) */ public function setAccessToken($accessToken) { - $accessToken = \trim($accessToken); - if (!\preg_match('/^access_\\w+$/', $accessToken)) { - throw new \_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException("Invalid OAuth access token: '{$accessToken}'. An access token must start with 'access_'."); + $accessToken = trim($accessToken); + if (!preg_match('/^access_\\w+$/', $accessToken)) { + throw new ApiException("Invalid OAuth access token: '{$accessToken}'. An access token must start with 'access_'."); } $this->apiKey = $accessToken; - $this->oauthAccess = \true; + $this->oauthAccess = true; return $this; } /** @@ -334,7 +349,7 @@ public function usesOAuth() */ public function addVersionString($versionString) { - $this->versionStrings[] = \str_replace([" ", "\t", "\n", "\r"], '-', $versionString); + $this->versionStrings[] = str_replace([" ", "\t", "\n", "\r"], '-', $versionString); return $this; } /** @@ -345,7 +360,7 @@ public function addVersionString($versionString) * @param string $apiMethod * @param string|null|resource|StreamInterface $httpBody * - * @return \stdClass + * @return stdClass * @throws ApiException * * @codeCoverageIgnore @@ -365,7 +380,7 @@ public function performHttpCall($httpMethod, $apiMethod, $httpBody = null) * @param string $url * @param string|null|resource|StreamInterface $httpBody * - * @return \stdClass|null + * @return stdClass|null * @throws ApiException * * @codeCoverageIgnore @@ -373,24 +388,24 @@ public function performHttpCall($httpMethod, $apiMethod, $httpBody = null) public function performHttpCallToFullUrl($httpMethod, $url, $httpBody = null) { if (empty($this->apiKey)) { - throw new \_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException("You have not set an API key or OAuth access token. Please use setApiKey() to set the API key."); + throw new ApiException("You have not set an API key or OAuth access token. Please use setApiKey() to set the API key."); } - $userAgent = \implode(' ', $this->versionStrings); + $userAgent = implode(' ', $this->versionStrings); if ($this->usesOAuth()) { $userAgent .= " OAuth/2.0"; } $headers = ['Accept' => "application/json", 'Authorization' => "Bearer {$this->apiKey}", 'User-Agent' => $userAgent]; - if (\function_exists("php_uname")) { - $headers['X-Mollie-Client-Info'] = \php_uname(); + if (function_exists("php_uname")) { + $headers['X-Mollie-Client-Info'] = php_uname(); } - $request = new \_PhpScoper5ea00cc67502b\GuzzleHttp\Psr7\Request($httpMethod, $url, $headers, $httpBody); + $request = new Request($httpMethod, $url, $headers, $httpBody); try { - $response = $this->httpClient->send($request, ['http_errors' => \false]); - } catch (\_PhpScoper5ea00cc67502b\GuzzleHttp\Exception\GuzzleException $e) { - throw \_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException::createFromGuzzleException($e); + $response = $this->httpClient->send($request, ['http_errors' => false]); + } catch (GuzzleException $e) { + throw ApiException::createFromGuzzleException($e); } if (!$response) { - throw new \_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException("Did not receive API response."); + throw new ApiException("Did not receive API response."); } return $this->parseResponseBody($response); } @@ -398,24 +413,24 @@ public function performHttpCallToFullUrl($httpMethod, $url, $httpBody = null) * Parse the PSR-7 Response body * * @param ResponseInterface $response - * @return \stdClass|null + * @return stdClass|null * @throws ApiException */ - private function parseResponseBody(\_PhpScoper5ea00cc67502b\Psr\Http\Message\ResponseInterface $response) + private function parseResponseBody(ResponseInterface $response) { $body = (string) $response->getBody(); if (empty($body)) { if ($response->getStatusCode() === self::HTTP_NO_CONTENT) { return null; } - throw new \_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException("No response body found."); + throw new ApiException("No response body found."); } - $object = @\json_decode($body); - if (\json_last_error() !== \JSON_ERROR_NONE) { - throw new \_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException("Unable to decode Mollie response: '{$body}'."); + $object = @json_decode($body); + if (json_last_error() !== JSON_ERROR_NONE) { + throw new ApiException("Unable to decode Mollie response: '{$body}'."); } if ($response->getStatusCode() >= 400) { - throw \_PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException::createFromResponse($response); + throw ApiException::createFromResponse($response); } return $object; } diff --git a/vendor/mollie/mollie-api-php/src/Resources/BaseCollection.php b/vendor/mollie/mollie-api-php/src/Resources/BaseCollection.php index c3b02382d..8e29c85d7 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/BaseCollection.php +++ b/vendor/mollie/mollie-api-php/src/Resources/BaseCollection.php @@ -2,7 +2,10 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; -abstract class BaseCollection extends \ArrayObject +use ArrayObject; +use stdClass; + +abstract class BaseCollection extends ArrayObject { /** * Total number of retrieved objects. @@ -11,12 +14,12 @@ abstract class BaseCollection extends \ArrayObject */ public $count; /** - * @var \stdClass + * @var stdClass */ public $_links; /** * @param int $count - * @param \stdClass $_links + * @param stdClass $_links */ public function __construct($count, $_links) { diff --git a/vendor/mollie/mollie-api-php/src/Resources/BaseResource.php b/vendor/mollie/mollie-api-php/src/Resources/BaseResource.php index 90486d66c..b55411868 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/BaseResource.php +++ b/vendor/mollie/mollie-api-php/src/Resources/BaseResource.php @@ -12,7 +12,7 @@ abstract class BaseResource /** * @param $client */ - public function __construct(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient $client) + public function __construct(MollieApiClient $client) { $this->client = $client; } diff --git a/vendor/mollie/mollie-api-php/src/Resources/Capture.php b/vendor/mollie/mollie-api-php/src/Resources/Capture.php index a130859e3..8dc3da5cf 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/Capture.php +++ b/vendor/mollie/mollie-api-php/src/Resources/Capture.php @@ -2,7 +2,9 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; -class Capture extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource +use stdClass; + +class Capture extends BaseResource { /** * Always 'capture' for this object @@ -23,13 +25,13 @@ class Capture extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource /** * Amount object containing the value and currency * - * @var \stdClass + * @var stdClass */ public $amount; /** * Amount object containing the settlement value and currency * - * @var \stdClass + * @var stdClass */ public $settlementAmount; /** @@ -55,7 +57,7 @@ class Capture extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource */ public $createdAt; /** - * @var \stdClass + * @var stdClass */ public $_links; } diff --git a/vendor/mollie/mollie-api-php/src/Resources/CaptureCollection.php b/vendor/mollie/mollie-api-php/src/Resources/CaptureCollection.php index 233f9145d..c2641c2ed 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/CaptureCollection.php +++ b/vendor/mollie/mollie-api-php/src/Resources/CaptureCollection.php @@ -2,7 +2,7 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; -class CaptureCollection extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\CursorCollection +class CaptureCollection extends CursorCollection { /** * @return string @@ -16,6 +16,6 @@ public function getCollectionResourceName() */ protected function createResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Capture($this->client); + return new Capture($this->client); } } diff --git a/vendor/mollie/mollie-api-php/src/Resources/Chargeback.php b/vendor/mollie/mollie-api-php/src/Resources/Chargeback.php index 466e78b80..e20b926bd 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/Chargeback.php +++ b/vendor/mollie/mollie-api-php/src/Resources/Chargeback.php @@ -2,13 +2,15 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; +use stdClass; + /** * @method Refund[]|RefundCollection all($from = null, $limit = 50, array $filters = []) * @method Refund get($refundId, array $filters = []) * @method Refund create(array $data = [], array $filters = []) * @method Refund delete($refundId) */ -class Chargeback extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource +class Chargeback extends BaseResource { /** * Id of the payment method. @@ -19,7 +21,7 @@ class Chargeback extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResou /** * The $amount that was refunded. * - * @var \stdClass + * @var stdClass */ public $amount; /** @@ -38,11 +40,11 @@ class Chargeback extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResou /** * The settlement amount * - * @var \stdClass + * @var stdClass */ public $settlementAmount; /** - * @var \stdClass + * @var stdClass */ public $_links; } diff --git a/vendor/mollie/mollie-api-php/src/Resources/ChargebackCollection.php b/vendor/mollie/mollie-api-php/src/Resources/ChargebackCollection.php index 952c08d13..a9cd5d4d6 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/ChargebackCollection.php +++ b/vendor/mollie/mollie-api-php/src/Resources/ChargebackCollection.php @@ -2,7 +2,7 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; -class ChargebackCollection extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\CursorCollection +class ChargebackCollection extends CursorCollection { /** * @return string @@ -16,6 +16,6 @@ public function getCollectionResourceName() */ protected function createResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Chargeback($this->client); + return new Chargeback($this->client); } } diff --git a/vendor/mollie/mollie-api-php/src/Resources/CurrentProfile.php b/vendor/mollie/mollie-api-php/src/Resources/CurrentProfile.php index 7119c2583..b08df4281 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/CurrentProfile.php +++ b/vendor/mollie/mollie-api-php/src/Resources/CurrentProfile.php @@ -3,7 +3,7 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; -class CurrentProfile extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Profile +class CurrentProfile extends Profile { /** * Enable a payment method for this profile. diff --git a/vendor/mollie/mollie-api-php/src/Resources/CursorCollection.php b/vendor/mollie/mollie-api-php/src/Resources/CursorCollection.php index d30700b3c..0cfd26875 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/CursorCollection.php +++ b/vendor/mollie/mollie-api-php/src/Resources/CursorCollection.php @@ -3,7 +3,10 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; use _PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient; -abstract class CursorCollection extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseCollection +use Mollie\Api\Exceptions\ApiException; +use stdClass; + +abstract class CursorCollection extends BaseCollection { /** * @var MollieApiClient @@ -12,9 +15,9 @@ abstract class CursorCollection extends \_PhpScoper5ea00cc67502b\Mollie\Api\Reso /** * @param MollieApiClient $client * @param int $count - * @param \stdClass $_links + * @param stdClass $_links */ - public final function __construct(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient $client, $count, $_links) + public final function __construct(MollieApiClient $client, $count, $_links) { parent::__construct($count, $_links); $this->client = $client; @@ -27,17 +30,17 @@ protected abstract function createResourceObject(); * Return the next set of resources when available * * @return CursorCollection|null - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ public final function next() { if (!$this->hasNext()) { return null; } - $result = $this->client->performHttpCallToFullUrl(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_GET, $this->_links->next->href); + $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->next->href); $collection = new static($this->client, $result->count, $result->_links); foreach ($result->_embedded->{$collection->getCollectionResourceName()} as $dataResult) { - $collection[] = \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createFromApiResult($dataResult, $this->createResourceObject()); + $collection[] = ResourceFactory::createFromApiResult($dataResult, $this->createResourceObject()); } return $collection; } @@ -45,17 +48,17 @@ public final function next() * Return the previous set of resources when available * * @return CursorCollection|null - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ public final function previous() { if (!$this->hasPrevious()) { return null; } - $result = $this->client->performHttpCallToFullUrl(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_GET, $this->_links->previous->href); + $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->previous->href); $collection = new static($this->client, $result->count, $result->_links); foreach ($result->_embedded->{$collection->getCollectionResourceName()} as $dataResult) { - $collection[] = \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createFromApiResult($dataResult, $this->createResourceObject()); + $collection[] = ResourceFactory::createFromApiResult($dataResult, $this->createResourceObject()); } return $collection; } diff --git a/vendor/mollie/mollie-api-php/src/Resources/Customer.php b/vendor/mollie/mollie-api-php/src/Resources/Customer.php index b0d465dc9..f16f83bb1 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/Customer.php +++ b/vendor/mollie/mollie-api-php/src/Resources/Customer.php @@ -3,7 +3,11 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; use _PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient; -class Customer extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource +use stdClass; +use function array_merge; +use function json_encode; + +class Customer extends BaseResource { /** * @var string @@ -34,7 +38,7 @@ class Customer extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResourc */ public $locale; /** - * @var \stdClass|mixed|null + * @var stdClass|mixed|null */ public $metadata; /** @@ -46,7 +50,7 @@ class Customer extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResourc */ public $createdAt; /** - * @var \stdClass + * @var stdClass */ public $_links; /** @@ -57,9 +61,9 @@ public function update() if (!isset($this->_links->self->href)) { return $this; } - $body = \json_encode(array("name" => $this->name, "email" => $this->email, "locale" => $this->locale, "metadata" => $this->metadata)); - $result = $this->client->performHttpCallToFullUrl(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_PATCH, $this->_links->self->href, $body); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createFromApiResult($result, new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer($this->client)); + $body = json_encode(array("name" => $this->name, "email" => $this->email, "locale" => $this->locale, "metadata" => $this->metadata)); + $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_PATCH, $this->_links->self->href, $body); + return ResourceFactory::createFromApiResult($result, new Customer($this->client)); } /** * @param array $options @@ -166,10 +170,10 @@ public function hasValidMandate() $mandates = $this->mandates(); foreach ($mandates as $mandate) { if ($mandate->isValid()) { - return \true; + return true; } } - return \false; + return false; } /** * Helper function to check for specific payment method mandate with status valid @@ -181,10 +185,10 @@ public function hasValidMandateForMethod($method) $mandates = $this->mandates(); foreach ($mandates as $mandate) { if ($mandate->method === $method && $mandate->isValid()) { - return \true; + return true; } } - return \false; + return false; } /** * When accessed by oAuth we want to pass the testmode by default @@ -195,7 +199,7 @@ private function getPresetOptions() { $options = []; if ($this->client->usesOAuth()) { - $options["testmode"] = $this->mode === "test" ? \true : \false; + $options["testmode"] = $this->mode === "test" ? true : false; } return $options; } @@ -207,6 +211,6 @@ private function getPresetOptions() */ private function withPresetOptions(array $options) { - return \array_merge($this->getPresetOptions(), $options); + return array_merge($this->getPresetOptions(), $options); } } diff --git a/vendor/mollie/mollie-api-php/src/Resources/CustomerCollection.php b/vendor/mollie/mollie-api-php/src/Resources/CustomerCollection.php index 9440c7a9f..8b535b80e 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/CustomerCollection.php +++ b/vendor/mollie/mollie-api-php/src/Resources/CustomerCollection.php @@ -2,7 +2,7 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; -class CustomerCollection extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\CursorCollection +class CustomerCollection extends CursorCollection { /** * @return string @@ -16,6 +16,6 @@ public function getCollectionResourceName() */ protected function createResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Customer($this->client); + return new Customer($this->client); } } diff --git a/vendor/mollie/mollie-api-php/src/Resources/Invoice.php b/vendor/mollie/mollie-api-php/src/Resources/Invoice.php index 845961ebb..6bbb7fdea 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/Invoice.php +++ b/vendor/mollie/mollie-api-php/src/Resources/Invoice.php @@ -3,7 +3,9 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; use _PhpScoper5ea00cc67502b\Mollie\Api\Types\InvoiceStatus; -class Invoice extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource +use stdClass; + +class Invoice extends BaseResource { /** * @var string @@ -46,32 +48,32 @@ class Invoice extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource /** * Amount object containing the total amount of the invoice excluding VAT. * - * @var \stdClass + * @var stdClass */ public $netAmount; /** * Amount object containing the VAT amount of the invoice. Only for merchants registered in the Netherlands. * - * @var \stdClass + * @var stdClass */ public $vatAmount; /** * Total amount of the invoice including VAT. * - * @var \stdClass + * @var stdClass */ public $grossAmount; /** * Object containing the invoice lines. * See https://docs.mollie.com/reference/v2/invoices-api/get-invoice for reference * - * @var \stdClass + * @var stdClass */ public $lines; /** * Contains a PDF to the Invoice * - * @var \stdClass + * @var stdClass */ public $_links; /** @@ -79,20 +81,20 @@ class Invoice extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource */ public function isPaid() { - return $this->status == \_PhpScoper5ea00cc67502b\Mollie\Api\Types\InvoiceStatus::STATUS_PAID; + return $this->status == InvoiceStatus::STATUS_PAID; } /** * @return bool */ public function isOpen() { - return $this->status == \_PhpScoper5ea00cc67502b\Mollie\Api\Types\InvoiceStatus::STATUS_OPEN; + return $this->status == InvoiceStatus::STATUS_OPEN; } /** * @return bool */ public function isOverdue() { - return $this->status == \_PhpScoper5ea00cc67502b\Mollie\Api\Types\InvoiceStatus::STATUS_OVERDUE; + return $this->status == InvoiceStatus::STATUS_OVERDUE; } } diff --git a/vendor/mollie/mollie-api-php/src/Resources/InvoiceCollection.php b/vendor/mollie/mollie-api-php/src/Resources/InvoiceCollection.php index 9ad6403e1..c34e5c9c1 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/InvoiceCollection.php +++ b/vendor/mollie/mollie-api-php/src/Resources/InvoiceCollection.php @@ -2,7 +2,7 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; -class InvoiceCollection extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\CursorCollection +class InvoiceCollection extends CursorCollection { /** * @return string @@ -16,6 +16,6 @@ public function getCollectionResourceName() */ protected function createResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Invoice($this->client); + return new Invoice($this->client); } } diff --git a/vendor/mollie/mollie-api-php/src/Resources/Issuer.php b/vendor/mollie/mollie-api-php/src/Resources/Issuer.php index 966bb4a36..7fed72778 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/Issuer.php +++ b/vendor/mollie/mollie-api-php/src/Resources/Issuer.php @@ -2,7 +2,9 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; -class Issuer extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource +use stdClass; + +class Issuer extends BaseResource { /** * Id of the issuer. @@ -26,7 +28,7 @@ class Issuer extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource /** * Object containing a size1x or size2x image * - * @var \stdClass + * @var stdClass */ public $image; } diff --git a/vendor/mollie/mollie-api-php/src/Resources/IssuerCollection.php b/vendor/mollie/mollie-api-php/src/Resources/IssuerCollection.php index 8fd2c4ada..a6ab4c14d 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/IssuerCollection.php +++ b/vendor/mollie/mollie-api-php/src/Resources/IssuerCollection.php @@ -2,7 +2,7 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; -class IssuerCollection extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseCollection +class IssuerCollection extends BaseCollection { /** * @return string|null diff --git a/vendor/mollie/mollie-api-php/src/Resources/Mandate.php b/vendor/mollie/mollie-api-php/src/Resources/Mandate.php index 2869a05b2..879b3a611 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/Mandate.php +++ b/vendor/mollie/mollie-api-php/src/Resources/Mandate.php @@ -4,7 +4,10 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient; use _PhpScoper5ea00cc67502b\Mollie\Api\Types\MandateStatus; -class Mandate extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource +use stdClass; +use function json_encode; + +class Mandate extends BaseResource { /** * @var string @@ -27,7 +30,7 @@ class Mandate extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource */ public $method; /** - * @var \stdClass|null + * @var stdClass|null */ public $details; /** @@ -49,7 +52,7 @@ class Mandate extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource */ public $signatureDate; /** - * @var \stdClass + * @var stdClass */ public $_links; /** @@ -57,21 +60,21 @@ class Mandate extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource */ public function isValid() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\MandateStatus::STATUS_VALID; + return $this->status === MandateStatus::STATUS_VALID; } /** * @return bool */ public function isPending() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\MandateStatus::STATUS_PENDING; + return $this->status === MandateStatus::STATUS_PENDING; } /** * @return bool */ public function isInvalid() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\MandateStatus::STATUS_INVALID; + return $this->status === MandateStatus::STATUS_INVALID; } /** * Revoke the mandate @@ -85,9 +88,9 @@ public function revoke() } $body = null; if ($this->client->usesOAuth()) { - $body = \json_encode(["testmode" => $this->mode === "test" ? \true : \false]); + $body = json_encode(["testmode" => $this->mode === "test" ? true : false]); } - $result = $this->client->performHttpCallToFullUrl(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_DELETE, $this->_links->self->href, $body); + $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_DELETE, $this->_links->self->href, $body); return $result; } } diff --git a/vendor/mollie/mollie-api-php/src/Resources/MandateCollection.php b/vendor/mollie/mollie-api-php/src/Resources/MandateCollection.php index df6953a9d..30f8090b9 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/MandateCollection.php +++ b/vendor/mollie/mollie-api-php/src/Resources/MandateCollection.php @@ -2,7 +2,7 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; -class MandateCollection extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\CursorCollection +class MandateCollection extends CursorCollection { /** * @return string @@ -16,7 +16,7 @@ public function getCollectionResourceName() */ protected function createResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Mandate($this->client); + return new Mandate($this->client); } /** * @param string $status diff --git a/vendor/mollie/mollie-api-php/src/Resources/Method.php b/vendor/mollie/mollie-api-php/src/Resources/Method.php index 319bd3982..209b0b0f0 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/Method.php +++ b/vendor/mollie/mollie-api-php/src/Resources/Method.php @@ -2,7 +2,9 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; -class Method extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource +use stdClass; + +class Method extends BaseResource { /** * Id of the payment method. @@ -20,20 +22,20 @@ class Method extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource * An object containing value and currency. It represents the minimum payment amount required to use this * payment method. * - * @var \stdClass + * @var stdClass */ public $minimumAmount; /** * An object containing value and currency. It represents the maximum payment amount allowed when using this * payment method. * - * @var \stdClass + * @var stdClass */ public $maximumAmount; /** * The $image->size1x and $image->size2x to display the payment method logo. * - * @var \stdClass + * @var stdClass */ public $image; /** @@ -51,7 +53,7 @@ class Method extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource */ public $pricing; /** - * @var \stdClass + * @var stdClass */ public $_links; /** @@ -61,7 +63,7 @@ class Method extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource */ public function issuers() { - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createBaseResourceCollection($this->client, \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Issuer::class, $this->issuers); + return ResourceFactory::createBaseResourceCollection($this->client, Issuer::class, $this->issuers); } /** * Get the method price value objects. @@ -70,6 +72,6 @@ public function issuers() */ public function pricing() { - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createBaseResourceCollection($this->client, \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\MethodPrice::class, $this->pricing); + return ResourceFactory::createBaseResourceCollection($this->client, MethodPrice::class, $this->pricing); } } diff --git a/vendor/mollie/mollie-api-php/src/Resources/MethodCollection.php b/vendor/mollie/mollie-api-php/src/Resources/MethodCollection.php index b34b6648e..0223400e9 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/MethodCollection.php +++ b/vendor/mollie/mollie-api-php/src/Resources/MethodCollection.php @@ -2,7 +2,7 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; -class MethodCollection extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseCollection +class MethodCollection extends BaseCollection { /** * @return string diff --git a/vendor/mollie/mollie-api-php/src/Resources/MethodPrice.php b/vendor/mollie/mollie-api-php/src/Resources/MethodPrice.php index 5704e0bb2..b8ddc46d3 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/MethodPrice.php +++ b/vendor/mollie/mollie-api-php/src/Resources/MethodPrice.php @@ -2,7 +2,9 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; -class MethodPrice extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource +use stdClass; + +class MethodPrice extends BaseResource { /** * The area or product-type where the pricing is applied for, translated in the optional locale passed. @@ -14,7 +16,7 @@ class MethodPrice extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseReso /** * The fixed price per transaction. This excludes the variable amount. * - * @var \stdClass An amount object consisting of `value` and `currency` + * @var stdClass An amount object consisting of `value` and `currency` */ public $fixed; /** diff --git a/vendor/mollie/mollie-api-php/src/Resources/MethodPriceCollection.php b/vendor/mollie/mollie-api-php/src/Resources/MethodPriceCollection.php index f00ac8584..d3e6b78c5 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/MethodPriceCollection.php +++ b/vendor/mollie/mollie-api-php/src/Resources/MethodPriceCollection.php @@ -2,7 +2,7 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; -class MethodPriceCollection extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseCollection +class MethodPriceCollection extends BaseCollection { /** * @return string|null diff --git a/vendor/mollie/mollie-api-php/src/Resources/Onboarding.php b/vendor/mollie/mollie-api-php/src/Resources/Onboarding.php index a6455d847..30b8acf20 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/Onboarding.php +++ b/vendor/mollie/mollie-api-php/src/Resources/Onboarding.php @@ -3,7 +3,9 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; use _PhpScoper5ea00cc67502b\Mollie\Api\Types\OnboardingStatus; -class Onboarding extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource +use stdClass; + +class Onboarding extends BaseResource { /** * @var string @@ -33,7 +35,7 @@ class Onboarding extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResou */ public $canReceiveSettlements; /** - * @var \stdClass + * @var stdClass */ public $_links; /** @@ -41,20 +43,20 @@ class Onboarding extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResou */ public function needsData() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OnboardingStatus::NEEDS_DATA; + return $this->status === OnboardingStatus::NEEDS_DATA; } /** * @return bool */ public function isInReview() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OnboardingStatus::IN_REVIEW; + return $this->status === OnboardingStatus::IN_REVIEW; } /** * @return bool */ public function isCompleted() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OnboardingStatus::COMPLETED; + return $this->status === OnboardingStatus::COMPLETED; } } diff --git a/vendor/mollie/mollie-api-php/src/Resources/Order.php b/vendor/mollie/mollie-api-php/src/Resources/Order.php index c7f75f957..dd7a04906 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/Order.php +++ b/vendor/mollie/mollie-api-php/src/Resources/Order.php @@ -4,7 +4,12 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient; use _PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderStatus; -class Order extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource +use Mollie\Api\Exceptions\ApiException; +use stdClass; +use function array_merge; +use function json_encode; + +class Order extends BaseResource { /** * @var string @@ -33,19 +38,19 @@ class Order extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource /** * Amount object containing the value and currency * - * @var \stdClass + * @var stdClass */ public $amount; /** * The total amount captured, thus far. * - * @var \stdClass + * @var stdClass */ public $amountCaptured; /** * The total amount refunded, thus far. * - * @var \stdClass + * @var stdClass */ public $amountRefunded; /** @@ -57,7 +62,7 @@ class Order extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource /** * The person and the address the order is billed to. * - * @var \stdClass + * @var stdClass */ public $billingAddress; /** @@ -75,7 +80,7 @@ class Order extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource /** * The person and the address the order is billed to. * - * @var \stdClass + * @var stdClass */ public $shippingAddress; /** @@ -95,7 +100,7 @@ class Order extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource * During creation of the order you can set custom metadata that is stored with * the order, and given back whenever you retrieve that order. * - * @var \stdClass|mixed|null + * @var stdClass|mixed|null */ public $metadata; /** @@ -132,11 +137,11 @@ class Order extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource /** * An object with several URL objects relevant to the customer. Every URL object will contain an href and a type field. * - * @var \stdClass + * @var stdClass */ public $_links; /** - * @var \stdClass + * @var stdClass */ public $_embedded; /** @@ -146,7 +151,7 @@ class Order extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource */ public function isCreated() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderStatus::STATUS_CREATED; + return $this->status === OrderStatus::STATUS_CREATED; } /** * Is this order paid for? @@ -155,7 +160,7 @@ public function isCreated() */ public function isPaid() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderStatus::STATUS_PAID; + return $this->status === OrderStatus::STATUS_PAID; } /** * Is this order authorized? @@ -164,7 +169,7 @@ public function isPaid() */ public function isAuthorized() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderStatus::STATUS_AUTHORIZED; + return $this->status === OrderStatus::STATUS_AUTHORIZED; } /** * Is this order canceled? @@ -173,7 +178,7 @@ public function isAuthorized() */ public function isCanceled() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderStatus::STATUS_CANCELED; + return $this->status === OrderStatus::STATUS_CANCELED; } /** * (Deprecated) Is this order refunded? @@ -183,7 +188,7 @@ public function isCanceled() */ public function isRefunded() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderStatus::STATUS_REFUNDED; + return $this->status === OrderStatus::STATUS_REFUNDED; } /** * Is this order shipping? @@ -192,7 +197,7 @@ public function isRefunded() */ public function isShipping() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderStatus::STATUS_SHIPPING; + return $this->status === OrderStatus::STATUS_SHIPPING; } /** * Is this order completed? @@ -201,7 +206,7 @@ public function isShipping() */ public function isCompleted() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderStatus::STATUS_COMPLETED; + return $this->status === OrderStatus::STATUS_COMPLETED; } /** * Is this order expired? @@ -210,7 +215,7 @@ public function isCompleted() */ public function isExpired() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderStatus::STATUS_EXPIRED; + return $this->status === OrderStatus::STATUS_EXPIRED; } /** * Is this order completed? @@ -219,7 +224,7 @@ public function isExpired() */ public function isPending() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderStatus::STATUS_PENDING; + return $this->status === OrderStatus::STATUS_PENDING; } /** * Cancels this order. @@ -229,7 +234,7 @@ public function isPending() * be found. * * @return Order - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ public function cancel() { @@ -243,7 +248,7 @@ public function cancel() * * @param array|null $data * @return null - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ public function cancelLines(array $data) { @@ -255,7 +260,7 @@ public function cancelLines(array $data) * * @param array|null $data * @return null - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ public function cancelAllLines($data = []) { @@ -269,7 +274,7 @@ public function cancelAllLines($data = []) */ public function lines() { - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createBaseResourceCollection($this->client, \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\OrderLine::class, $this->lines); + return ResourceFactory::createBaseResourceCollection($this->client, OrderLine::class, $this->lines); } /** * Create a shipment for some order lines. You can provide an empty array for the @@ -355,30 +360,30 @@ public function refundAll(array $data = []) * Retrieves all refunds associated with this order * * @return RefundCollection - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ public function refunds() { if (!isset($this->_links->refunds->href)) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\RefundCollection($this->client, 0, null); + return new RefundCollection($this->client, 0, null); } - $result = $this->client->performHttpCallToFullUrl(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_GET, $this->_links->refunds->href); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->refunds, \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Refund::class, $result->_links); + $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->refunds->href); + return ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->refunds, Refund::class, $result->_links); } /** * Saves the order's updated billingAddress and/or shippingAddress. * * @return \Mollie\Api\Resources\BaseResource|\Mollie\Api\Resources\Order - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ public function update() { if (!isset($this->_links->self->href)) { return $this; } - $body = \json_encode(array("billingAddress" => $this->billingAddress, "shippingAddress" => $this->shippingAddress, "orderNumber" => $this->orderNumber)); - $result = $this->client->performHttpCallToFullUrl(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_PATCH, $this->_links->self->href, $body); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createFromApiResult($result, new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Order($this->client)); + $body = json_encode(array("billingAddress" => $this->billingAddress, "shippingAddress" => $this->shippingAddress, "orderNumber" => $this->orderNumber)); + $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_PATCH, $this->_links->self->href, $body); + return ResourceFactory::createFromApiResult($result, new Order($this->client)); } /** * Create a new payment for this Order. @@ -386,7 +391,7 @@ public function update() * @param $data * @param array $filters * @return \Mollie\Api\Resources\BaseResource|\Mollie\Api\Resources\Payment - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ public function createPayment($data, $filters = []) { @@ -403,7 +408,7 @@ public function payments() if (!isset($this->_embedded, $this->_embedded->payments)) { return null; } - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createCursorResourceCollection($this->client, $this->_embedded->payments, \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Payment::class); + return ResourceFactory::createCursorResourceCollection($this->client, $this->_embedded->payments, Payment::class); } /** * When accessed by oAuth we want to pass the testmode by default @@ -414,7 +419,7 @@ private function getPresetOptions() { $options = []; if ($this->client->usesOAuth()) { - $options["testmode"] = $this->mode === "test" ? \true : \false; + $options["testmode"] = $this->mode === "test" ? true : false; } return $options; } @@ -426,6 +431,6 @@ private function getPresetOptions() */ private function withPresetOptions(array $options) { - return \array_merge($this->getPresetOptions(), $options); + return array_merge($this->getPresetOptions(), $options); } } diff --git a/vendor/mollie/mollie-api-php/src/Resources/OrderCollection.php b/vendor/mollie/mollie-api-php/src/Resources/OrderCollection.php index 5badebeef..540cd4217 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/OrderCollection.php +++ b/vendor/mollie/mollie-api-php/src/Resources/OrderCollection.php @@ -2,7 +2,7 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; -class OrderCollection extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\CursorCollection +class OrderCollection extends CursorCollection { /** * @return string @@ -16,6 +16,6 @@ public function getCollectionResourceName() */ protected function createResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Order($this->client); + return new Order($this->client); } } diff --git a/vendor/mollie/mollie-api-php/src/Resources/OrderLine.php b/vendor/mollie/mollie-api-php/src/Resources/OrderLine.php index 22db28744..6de57f8b1 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/OrderLine.php +++ b/vendor/mollie/mollie-api-php/src/Resources/OrderLine.php @@ -5,7 +5,10 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient; use _PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderLineStatus; use _PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderLineType; -class OrderLine extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource +use stdClass; +use function json_encode; + +class OrderLine extends BaseResource { /** * Always 'orderline' @@ -61,19 +64,19 @@ class OrderLine extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResour /** * The price of a single item in the order line. * - * @var \stdClass + * @var stdClass */ public $unitPrice; /** * Any discounts applied to the order line. * - * @var \stdClass|null + * @var stdClass|null */ public $discountAmount; /** * The total amount of the line, including VAT and discounts. * - * @var \stdClass + * @var stdClass */ public $totalAmount; /** @@ -88,7 +91,7 @@ class OrderLine extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResour /** * The amount of value-added tax on the line. * - * @var \stdClass + * @var stdClass */ public $vatAmount; /** @@ -117,7 +120,7 @@ class OrderLine extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResour */ public $createdAt; /** - * @var \stdClass + * @var stdClass */ public $_links; /** @@ -127,7 +130,7 @@ class OrderLine extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResour */ public function isCreated() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderLineStatus::STATUS_CREATED; + return $this->status === OrderLineStatus::STATUS_CREATED; } /** * Is this order line paid for? @@ -136,7 +139,7 @@ public function isCreated() */ public function isPaid() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderLineStatus::STATUS_PAID; + return $this->status === OrderLineStatus::STATUS_PAID; } /** * Is this order line authorized? @@ -145,7 +148,7 @@ public function isPaid() */ public function isAuthorized() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderLineStatus::STATUS_AUTHORIZED; + return $this->status === OrderLineStatus::STATUS_AUTHORIZED; } /** * Is this order line canceled? @@ -154,7 +157,7 @@ public function isAuthorized() */ public function isCanceled() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderLineStatus::STATUS_CANCELED; + return $this->status === OrderLineStatus::STATUS_CANCELED; } /** * (Deprecated) Is this order line refunded? @@ -164,7 +167,7 @@ public function isCanceled() */ public function isRefunded() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderLineStatus::STATUS_REFUNDED; + return $this->status === OrderLineStatus::STATUS_REFUNDED; } /** * Is this order line shipping? @@ -173,7 +176,7 @@ public function isRefunded() */ public function isShipping() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderLineStatus::STATUS_SHIPPING; + return $this->status === OrderLineStatus::STATUS_SHIPPING; } /** * Is this order line completed? @@ -182,7 +185,7 @@ public function isShipping() */ public function isCompleted() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderLineStatus::STATUS_COMPLETED; + return $this->status === OrderLineStatus::STATUS_COMPLETED; } /** * Is this order line for a physical product? @@ -191,7 +194,7 @@ public function isCompleted() */ public function isPhysical() { - return $this->type === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderLineType::TYPE_PHYSICAL; + return $this->type === OrderLineType::TYPE_PHYSICAL; } /** * Is this order line for applying a discount? @@ -200,7 +203,7 @@ public function isPhysical() */ public function isDiscount() { - return $this->type === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderLineType::TYPE_DISCOUNT; + return $this->type === OrderLineType::TYPE_DISCOUNT; } /** * Is this order line for a digital product? @@ -209,7 +212,7 @@ public function isDiscount() */ public function isDigital() { - return $this->type === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderLineType::TYPE_DIGITAL; + return $this->type === OrderLineType::TYPE_DIGITAL; } /** * Is this order line for applying a shipping fee? @@ -218,7 +221,7 @@ public function isDigital() */ public function isShippingFee() { - return $this->type === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderLineType::TYPE_SHIPPING_FEE; + return $this->type === OrderLineType::TYPE_SHIPPING_FEE; } /** * Is this order line for store credit? @@ -227,7 +230,7 @@ public function isShippingFee() */ public function isStoreCredit() { - return $this->type === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderLineType::TYPE_STORE_CREDIT; + return $this->type === OrderLineType::TYPE_STORE_CREDIT; } /** * Is this order line for a gift card? @@ -236,7 +239,7 @@ public function isStoreCredit() */ public function isGiftCard() { - return $this->type === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderLineType::TYPE_GIFT_CARD; + return $this->type === OrderLineType::TYPE_GIFT_CARD; } /** * Is this order line for a surcharge? @@ -245,13 +248,13 @@ public function isGiftCard() */ public function isSurcharge() { - return $this->type === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\OrderLineType::TYPE_SURCHARGE; + return $this->type === OrderLineType::TYPE_SURCHARGE; } public function update() { - $body = \json_encode(array("name" => $this->name, 'imageUrl' => $this->imageUrl, 'productUrl' => $this->productUrl, 'quantity' => $this->quantity, 'unitPrice' => $this->unitPrice, 'discountAmount' => $this->discountAmount, 'totalAmount' => $this->totalAmount, 'vatAmount' => $this->vatAmount, 'vatRate' => $this->vatRate)); + $body = json_encode(array("name" => $this->name, 'imageUrl' => $this->imageUrl, 'productUrl' => $this->productUrl, 'quantity' => $this->quantity, 'unitPrice' => $this->unitPrice, 'discountAmount' => $this->discountAmount, 'totalAmount' => $this->totalAmount, 'vatAmount' => $this->vatAmount, 'vatRate' => $this->vatRate)); $url = "orders/{$this->orderId}/lines/{$this->id}"; - $result = $this->client->performHttpCall(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_PATCH, $url, $body); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createFromApiResult($result, new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Order($this->client)); + $result = $this->client->performHttpCall(MollieApiClient::HTTP_PATCH, $url, $body); + return ResourceFactory::createFromApiResult($result, new Order($this->client)); } } diff --git a/vendor/mollie/mollie-api-php/src/Resources/OrderLineCollection.php b/vendor/mollie/mollie-api-php/src/Resources/OrderLineCollection.php index 8491fa63d..c2c583d92 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/OrderLineCollection.php +++ b/vendor/mollie/mollie-api-php/src/Resources/OrderLineCollection.php @@ -2,7 +2,7 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; -class OrderLineCollection extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseCollection +class OrderLineCollection extends BaseCollection { /** * @return string|null diff --git a/vendor/mollie/mollie-api-php/src/Resources/Organization.php b/vendor/mollie/mollie-api-php/src/Resources/Organization.php index 53f930571..52b64fdb2 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/Organization.php +++ b/vendor/mollie/mollie-api-php/src/Resources/Organization.php @@ -2,7 +2,9 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; -class Organization extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource +use stdClass; + +class Organization extends BaseResource { /** * Id of the payment method. @@ -31,7 +33,7 @@ class Organization extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseRes /** * The address of the organization. * - * @var \stdClass + * @var stdClass */ public $address; /** @@ -49,7 +51,7 @@ class Organization extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseRes */ public $vatNumber; /** - * @var \stdClass + * @var stdClass */ public $_links; } diff --git a/vendor/mollie/mollie-api-php/src/Resources/OrganizationCollection.php b/vendor/mollie/mollie-api-php/src/Resources/OrganizationCollection.php index b33b6633a..8b6d9b48e 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/OrganizationCollection.php +++ b/vendor/mollie/mollie-api-php/src/Resources/OrganizationCollection.php @@ -2,7 +2,7 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; -class OrganizationCollection extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\CursorCollection +class OrganizationCollection extends CursorCollection { /** * @return string @@ -16,6 +16,6 @@ public function getCollectionResourceName() */ protected function createResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Organization($this->client); + return new Organization($this->client); } } diff --git a/vendor/mollie/mollie-api-php/src/Resources/Payment.php b/vendor/mollie/mollie-api-php/src/Resources/Payment.php index f99cda126..929a36cfe 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/Payment.php +++ b/vendor/mollie/mollie-api-php/src/Resources/Payment.php @@ -6,7 +6,13 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient; use _PhpScoper5ea00cc67502b\Mollie\Api\Types\PaymentStatus; use _PhpScoper5ea00cc67502b\Mollie\Api\Types\SequenceType; -class Payment extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource +use stdClass; +use function array_merge; +use function count; +use function json_encode; +use function urlencode; + +class Payment extends BaseResource { /** * @var string @@ -28,20 +34,20 @@ class Payment extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource /** * Amount object containing the value and currency * - * @var \stdClass + * @var stdClass */ public $amount; /** * The amount that has been settled containing the value and currency * - * @var \stdClass + * @var stdClass */ public $settlementAmount; /** * The amount of the payment that has been refunded to the consumer, in EURO with * 2 decimals. This field will be null if the payment can not be refunded. * - * @var \stdClass|null + * @var stdClass|null */ public $amountRefunded; /** @@ -52,7 +58,7 @@ class Payment extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource * This is possible to reimburse the costs for a return shipment to your customer * for example. * - * @var \stdClass|null + * @var stdClass|null */ public $amountRemaining; /** @@ -75,7 +81,7 @@ class Payment extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource * * @var string */ - public $status = \_PhpScoper5ea00cc67502b\Mollie\Api\Types\PaymentStatus::STATUS_OPEN; + public $status = PaymentStatus::STATUS_OPEN; /** * UTC datetime the payment was created in ISO-8601 format. * @@ -172,14 +178,14 @@ class Payment extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource * During creation of the payment you can set custom metadata that is stored with * the payment, and given back whenever you retrieve that payment. * - * @var \stdClass|mixed|null + * @var stdClass|mixed|null */ public $metadata; /** * Details of a successfully paid payment are set here. For example, the iDEAL * payment method will set $details->consumerName and $details->consumerAccount. * - * @var \stdClass + * @var stdClass */ public $details; /** @@ -189,11 +195,11 @@ class Payment extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource */ public $restrictPaymentMethodsToCountry; /** - * @var \stdClass + * @var stdClass */ public $_links; /** - * @var \stdClass[] + * @var stdClass[] */ public $_embedded; /** @@ -206,14 +212,14 @@ class Payment extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource * The total amount that is already captured for this payment. Only available * when this payment supports captures. * - * @var \stdClass|null + * @var stdClass|null */ public $amountCaptured; /** * The application fee, if the payment was created with one. Contains amount * (the value and currency) and description. * - * @var \stdClass|null + * @var stdClass|null */ public $applicationFeeAmount; /** @@ -255,7 +261,7 @@ class Payment extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource */ public function isCanceled() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\PaymentStatus::STATUS_CANCELED; + return $this->status === PaymentStatus::STATUS_CANCELED; } /** * Is this payment expired? @@ -264,7 +270,7 @@ public function isCanceled() */ public function isExpired() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\PaymentStatus::STATUS_EXPIRED; + return $this->status === PaymentStatus::STATUS_EXPIRED; } /** * Is this payment still open / ongoing? @@ -273,7 +279,7 @@ public function isExpired() */ public function isOpen() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\PaymentStatus::STATUS_OPEN; + return $this->status === PaymentStatus::STATUS_OPEN; } /** * Is this payment pending? @@ -282,7 +288,7 @@ public function isOpen() */ public function isPending() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\PaymentStatus::STATUS_PENDING; + return $this->status === PaymentStatus::STATUS_PENDING; } /** * Is this payment authorized? @@ -291,7 +297,7 @@ public function isPending() */ public function isAuthorized() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\PaymentStatus::STATUS_AUTHORIZED; + return $this->status === PaymentStatus::STATUS_AUTHORIZED; } /** * Is this payment paid for? @@ -327,7 +333,7 @@ public function hasChargebacks() */ public function isFailed() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\PaymentStatus::STATUS_FAILED; + return $this->status === PaymentStatus::STATUS_FAILED; } /** * Check whether 'sequenceType' is set to 'first'. If a 'first' payment has been @@ -338,7 +344,7 @@ public function isFailed() */ public function hasSequenceTypeFirst() { - return $this->sequenceType === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\SequenceType::SEQUENCETYPE_FIRST; + return $this->sequenceType === SequenceType::SEQUENCETYPE_FIRST; } /** * Check whether 'sequenceType' is set to 'recurring'. This type of payment is @@ -349,7 +355,7 @@ public function hasSequenceTypeFirst() */ public function hasSequenceTypeRecurring() { - return $this->sequenceType === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\SequenceType::SEQUENCETYPE_RECURRING; + return $this->sequenceType === SequenceType::SEQUENCETYPE_RECURRING; } /** * Get the checkout URL where the customer can complete the payment. @@ -412,10 +418,10 @@ public function getAmountRemaining() public function refunds() { if (!isset($this->_links->refunds->href)) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\RefundCollection($this->client, 0, null); + return new RefundCollection($this->client, 0, null); } - $result = $this->client->performHttpCallToFullUrl(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_GET, $this->_links->refunds->href); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->refunds, \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Refund::class, $result->_links); + $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->refunds->href); + return ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->refunds, Refund::class, $result->_links); } /** * @param string $refundId @@ -436,10 +442,10 @@ public function getRefund($refundId, array $parameters = []) public function captures() { if (!isset($this->_links->captures->href)) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\CaptureCollection($this->client, 0, null); + return new CaptureCollection($this->client, 0, null); } - $result = $this->client->performHttpCallToFullUrl(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_GET, $this->_links->captures->href); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->captures, \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Capture::class, $result->_links); + $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->captures->href); + return ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->captures, Capture::class, $result->_links); } /** * @param string $captureId @@ -460,10 +466,10 @@ public function getCapture($captureId, array $parameters = []) public function chargebacks() { if (!isset($this->_links->chargebacks->href)) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ChargebackCollection($this->client, 0, null); + return new ChargebackCollection($this->client, 0, null); } - $result = $this->client->performHttpCallToFullUrl(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_GET, $this->_links->chargebacks->href); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->chargebacks, \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Chargeback::class, $result->_links); + $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->chargebacks->href); + return ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->chargebacks, Chargeback::class, $result->_links); } /** * Retrieves a specific chargeback for this payment. @@ -487,23 +493,23 @@ public function getChargeback($chargebackId, array $parameters = []) */ public function refund($data) { - $resource = "payments/" . \urlencode($this->id) . "/refunds"; + $resource = "payments/" . urlencode($this->id) . "/refunds"; $data = $this->withPresetOptions($data); $body = null; - if (\count($data) > 0) { - $body = \json_encode($data); + if (count($data) > 0) { + $body = json_encode($data); } - $result = $this->client->performHttpCall(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_POST, $resource, $body); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createFromApiResult($result, new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Refund($this->client)); + $result = $this->client->performHttpCall(MollieApiClient::HTTP_POST, $resource, $body); + return ResourceFactory::createFromApiResult($result, new Refund($this->client)); } public function update() { if (!isset($this->_links->self->href)) { return $this; } - $body = \json_encode(["description" => $this->description, "redirectUrl" => $this->redirectUrl, "webhookUrl" => $this->webhookUrl, "metadata" => $this->metadata, "restrictPaymentMethodsToCountry" => $this->restrictPaymentMethodsToCountry]); - $result = $this->client->performHttpCallToFullUrl(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_PATCH, $this->_links->self->href, $body); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createFromApiResult($result, new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Payment($this->client)); + $body = json_encode(["description" => $this->description, "redirectUrl" => $this->redirectUrl, "webhookUrl" => $this->webhookUrl, "metadata" => $this->metadata, "restrictPaymentMethodsToCountry" => $this->restrictPaymentMethodsToCountry]); + $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_PATCH, $this->_links->self->href, $body); + return ResourceFactory::createFromApiResult($result, new Payment($this->client)); } /** * When accessed by oAuth we want to pass the testmode by default @@ -514,7 +520,7 @@ private function getPresetOptions() { $options = []; if ($this->client->usesOAuth()) { - $options["testmode"] = $this->mode === "test" ? \true : \false; + $options["testmode"] = $this->mode === "test" ? true : false; } return $options; } @@ -526,7 +532,7 @@ private function getPresetOptions() */ private function withPresetOptions(array $options) { - return \array_merge($this->getPresetOptions(), $options); + return array_merge($this->getPresetOptions(), $options); } /** * The total amount that is already captured for this payment. Only available diff --git a/vendor/mollie/mollie-api-php/src/Resources/PaymentCollection.php b/vendor/mollie/mollie-api-php/src/Resources/PaymentCollection.php index a151c23de..4bce2070c 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/PaymentCollection.php +++ b/vendor/mollie/mollie-api-php/src/Resources/PaymentCollection.php @@ -2,7 +2,7 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; -class PaymentCollection extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\CursorCollection +class PaymentCollection extends CursorCollection { /** * @return string @@ -16,6 +16,6 @@ public function getCollectionResourceName() */ protected function createResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Payment($this->client); + return new Payment($this->client); } } diff --git a/vendor/mollie/mollie-api-php/src/Resources/Permission.php b/vendor/mollie/mollie-api-php/src/Resources/Permission.php index 4caccba73..9b48432e4 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/Permission.php +++ b/vendor/mollie/mollie-api-php/src/Resources/Permission.php @@ -2,7 +2,9 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; -class Permission extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource +use stdClass; + +class Permission extends BaseResource { /** * @var string @@ -22,7 +24,7 @@ class Permission extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResou */ public $granted; /** - * @var \stdClass + * @var stdClass */ public $_links; } diff --git a/vendor/mollie/mollie-api-php/src/Resources/PermissionCollection.php b/vendor/mollie/mollie-api-php/src/Resources/PermissionCollection.php index b46f97f86..8549c0a91 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/PermissionCollection.php +++ b/vendor/mollie/mollie-api-php/src/Resources/PermissionCollection.php @@ -2,7 +2,7 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; -class PermissionCollection extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseCollection +class PermissionCollection extends BaseCollection { /** * @return string diff --git a/vendor/mollie/mollie-api-php/src/Resources/Profile.php b/vendor/mollie/mollie-api-php/src/Resources/Profile.php index 3d4e665fc..97f0887ee 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/Profile.php +++ b/vendor/mollie/mollie-api-php/src/Resources/Profile.php @@ -5,7 +5,10 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; use _PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient; use _PhpScoper5ea00cc67502b\Mollie\Api\Types\ProfileStatus; -class Profile extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource +use stdClass; +use function json_encode; + +class Profile extends BaseResource { /** * @var string @@ -48,7 +51,7 @@ class Profile extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource */ public $status; /** - * @var \stdClass + * @var stdClass */ public $review; /** @@ -59,7 +62,7 @@ class Profile extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource */ public $createdAt; /** - * @var \stdClass + * @var stdClass */ public $_links; /** @@ -67,21 +70,21 @@ class Profile extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource */ public function isUnverified() { - return $this->status == \_PhpScoper5ea00cc67502b\Mollie\Api\Types\ProfileStatus::STATUS_UNVERIFIED; + return $this->status == ProfileStatus::STATUS_UNVERIFIED; } /** * @return bool */ public function isVerified() { - return $this->status == \_PhpScoper5ea00cc67502b\Mollie\Api\Types\ProfileStatus::STATUS_VERIFIED; + return $this->status == ProfileStatus::STATUS_VERIFIED; } /** * @return bool */ public function isBlocked() { - return $this->status == \_PhpScoper5ea00cc67502b\Mollie\Api\Types\ProfileStatus::STATUS_BLOCKED; + return $this->status == ProfileStatus::STATUS_BLOCKED; } /** * @return Profile @@ -92,9 +95,9 @@ public function update() if (!isset($this->_links->self->href)) { return $this; } - $body = \json_encode(array("name" => $this->name, "website" => $this->website, "email" => $this->email, "phone" => $this->phone, "categoryCode" => $this->categoryCode, "mode" => $this->mode)); - $result = $this->client->performHttpCallToFullUrl(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_PATCH, $this->_links->self->href, $body); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createFromApiResult($result, new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Profile($this->client)); + $body = json_encode(array("name" => $this->name, "website" => $this->website, "email" => $this->email, "phone" => $this->phone, "categoryCode" => $this->categoryCode, "mode" => $this->mode)); + $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_PATCH, $this->_links->self->href, $body); + return ResourceFactory::createFromApiResult($result, new Profile($this->client)); } /** * Retrieves all chargebacks associated with this profile @@ -105,10 +108,10 @@ public function update() public function chargebacks() { if (!isset($this->_links->chargebacks->href)) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ChargebackCollection($this->client, 0, null); + return new ChargebackCollection($this->client, 0, null); } - $result = $this->client->performHttpCallToFullUrl(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_GET, $this->_links->chargebacks->href); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->chargebacks, \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Chargeback::class, $result->_links); + $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->chargebacks->href); + return ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->chargebacks, Chargeback::class, $result->_links); } /** * Retrieves all methods activated on this profile @@ -119,10 +122,10 @@ public function chargebacks() public function methods() { if (!isset($this->_links->methods->href)) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\MethodCollection(0, null); + return new MethodCollection(0, null); } - $result = $this->client->performHttpCallToFullUrl(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_GET, $this->_links->methods->href); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->methods, \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Method::class, $result->_links); + $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->methods->href); + return ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->methods, Method::class, $result->_links); } /** * Enable a payment method for this profile. @@ -157,10 +160,10 @@ public function disableMethod($methodId, array $data = []) public function payments() { if (!isset($this->_links->payments->href)) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\PaymentCollection($this->client, 0, null); + return new PaymentCollection($this->client, 0, null); } - $result = $this->client->performHttpCallToFullUrl(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_GET, $this->_links->payments->href); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->methods, \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Method::class, $result->_links); + $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->payments->href); + return ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->methods, Method::class, $result->_links); } /** * Retrieves all refunds associated with this profile @@ -171,9 +174,9 @@ public function payments() public function refunds() { if (!isset($this->_links->refunds->href)) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\RefundCollection($this->client, 0, null); + return new RefundCollection($this->client, 0, null); } - $result = $this->client->performHttpCallToFullUrl(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_GET, $this->_links->refunds->href); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->refunds, \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Refund::class, $result->_links); + $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->refunds->href); + return ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->refunds, Refund::class, $result->_links); } } diff --git a/vendor/mollie/mollie-api-php/src/Resources/ProfileCollection.php b/vendor/mollie/mollie-api-php/src/Resources/ProfileCollection.php index a8d6a4f78..ea2fef8e7 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/ProfileCollection.php +++ b/vendor/mollie/mollie-api-php/src/Resources/ProfileCollection.php @@ -2,7 +2,7 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; -class ProfileCollection extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\CursorCollection +class ProfileCollection extends CursorCollection { /** * @return string @@ -16,6 +16,6 @@ public function getCollectionResourceName() */ protected function createResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Profile($this->client); + return new Profile($this->client); } } diff --git a/vendor/mollie/mollie-api-php/src/Resources/Refund.php b/vendor/mollie/mollie-api-php/src/Resources/Refund.php index c436b2899..01eb8e6ac 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/Refund.php +++ b/vendor/mollie/mollie-api-php/src/Resources/Refund.php @@ -4,7 +4,10 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient; use _PhpScoper5ea00cc67502b\Mollie\Api\Types\RefundStatus; -class Refund extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource +use Mollie\Api\Exceptions\ApiException; +use stdClass; + +class Refund extends BaseResource { /** * @var string @@ -19,7 +22,7 @@ class Refund extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource /** * The $amount that was refunded. * - * @var \stdClass + * @var stdClass */ public $amount; /** @@ -58,7 +61,7 @@ class Refund extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource /** * The settlement amount * - * @var \stdClass + * @var stdClass */ public $settlementAmount; /** @@ -68,7 +71,7 @@ class Refund extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource */ public $status; /** - * @var \stdClass + * @var stdClass */ public $_links; /** @@ -78,7 +81,7 @@ class Refund extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource */ public function isQueued() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\RefundStatus::STATUS_QUEUED; + return $this->status === RefundStatus::STATUS_QUEUED; } /** * Is this refund pending? @@ -87,7 +90,7 @@ public function isQueued() */ public function isPending() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\RefundStatus::STATUS_PENDING; + return $this->status === RefundStatus::STATUS_PENDING; } /** * Is this refund processing? @@ -96,7 +99,7 @@ public function isPending() */ public function isProcessing() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\RefundStatus::STATUS_PROCESSING; + return $this->status === RefundStatus::STATUS_PROCESSING; } /** * Is this refund transferred to consumer? @@ -105,18 +108,18 @@ public function isProcessing() */ public function isTransferred() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\RefundStatus::STATUS_REFUNDED; + return $this->status === RefundStatus::STATUS_REFUNDED; } /** * Cancel the refund. * Returns null if successful. * * @return null - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ public function cancel() { - $this->client->performHttpCallToFullUrl(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_DELETE, $this->_links->self->href); + $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_DELETE, $this->_links->self->href); return null; } } diff --git a/vendor/mollie/mollie-api-php/src/Resources/RefundCollection.php b/vendor/mollie/mollie-api-php/src/Resources/RefundCollection.php index 7ea005f62..0ffa7a15e 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/RefundCollection.php +++ b/vendor/mollie/mollie-api-php/src/Resources/RefundCollection.php @@ -2,7 +2,7 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; -class RefundCollection extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\CursorCollection +class RefundCollection extends CursorCollection { /** * @return string @@ -16,6 +16,6 @@ public function getCollectionResourceName() */ protected function createResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Refund($this->client); + return new Refund($this->client); } } diff --git a/vendor/mollie/mollie-api-php/src/Resources/ResourceFactory.php b/vendor/mollie/mollie-api-php/src/Resources/ResourceFactory.php index 13bf50400..8a3db0ae6 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/ResourceFactory.php +++ b/vendor/mollie/mollie-api-php/src/Resources/ResourceFactory.php @@ -3,6 +3,8 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; use _PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient; +use function count; + class ResourceFactory { /** @@ -13,7 +15,7 @@ class ResourceFactory * * @return BaseResource */ - public static function createFromApiResult($apiResult, \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource $resource) + public static function createFromApiResult($apiResult, BaseResource $resource) { foreach ($apiResult as $property => $value) { $resource->{$property} = $value; @@ -28,11 +30,11 @@ public static function createFromApiResult($apiResult, \_PhpScoper5ea00cc67502b\ * @param null $resourceCollectionClass * @return mixed */ - public static function createBaseResourceCollection(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient $client, $resourceClass, $data, $_links = null, $resourceCollectionClass = null) + public static function createBaseResourceCollection(MollieApiClient $client, $resourceClass, $data, $_links = null, $resourceCollectionClass = null) { $resourceCollectionClass = $resourceCollectionClass ?: $resourceClass . 'Collection'; $data = $data ?: []; - $result = new $resourceCollectionClass(\count($data), $_links); + $result = new $resourceCollectionClass(count($data), $_links); foreach ($data as $item) { $result[] = static::createFromApiResult($item, new $resourceClass($client)); } @@ -51,7 +53,7 @@ public static function createCursorResourceCollection($client, array $input, $re if (null === $resourceCollectionClass) { $resourceCollectionClass = $resourceClass . 'Collection'; } - $data = new $resourceCollectionClass($client, \count($input), $_links); + $data = new $resourceCollectionClass($client, count($input), $_links); foreach ($input as $item) { $data[] = static::createFromApiResult($item, new $resourceClass($client)); } diff --git a/vendor/mollie/mollie-api-php/src/Resources/Settlement.php b/vendor/mollie/mollie-api-php/src/Resources/Settlement.php index eae9f2b10..e8bff3270 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/Settlement.php +++ b/vendor/mollie/mollie-api-php/src/Resources/Settlement.php @@ -5,7 +5,9 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\Exceptions\ApiException; use _PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient; use _PhpScoper5ea00cc67502b\Mollie\Api\Types\SettlementStatus; -class Settlement extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource +use stdClass; + +class Settlement extends BaseResource { /** * @var string @@ -46,13 +48,13 @@ class Settlement extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResou /** * Total settlement amount in euros. * - * @var \stdClass + * @var stdClass */ public $amount; /** * Revenues and costs nested per year, per month, and per payment method. * - * @var \stdClass + * @var stdClass */ public $periods; /** @@ -62,7 +64,7 @@ class Settlement extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResou */ public $invoiceId; /** - * @var \stdClass + * @var stdClass */ public $_links; /** @@ -72,7 +74,7 @@ class Settlement extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResou */ public function isOpen() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\SettlementStatus::STATUS_OPEN; + return $this->status === SettlementStatus::STATUS_OPEN; } /** * Is this settlement pending? @@ -81,7 +83,7 @@ public function isOpen() */ public function isPending() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\SettlementStatus::STATUS_PENDING; + return $this->status === SettlementStatus::STATUS_PENDING; } /** * Is this settlement paidout? @@ -90,7 +92,7 @@ public function isPending() */ public function isPaidout() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\SettlementStatus::STATUS_PAIDOUT; + return $this->status === SettlementStatus::STATUS_PAIDOUT; } /** * Is this settlement failed? @@ -99,7 +101,7 @@ public function isPaidout() */ public function isFailed() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\SettlementStatus::STATUS_FAILED; + return $this->status === SettlementStatus::STATUS_FAILED; } /** * Retrieves all payments associated with this settlement @@ -110,10 +112,10 @@ public function isFailed() public function payments() { if (!isset($this->_links->payments->href)) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\PaymentCollection($this->client, 0, null); + return new PaymentCollection($this->client, 0, null); } - $result = $this->client->performHttpCallToFullUrl(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_GET, $this->_links->payments->href); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->payments, \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Payment::class, $result->_links); + $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->payments->href); + return ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->payments, Payment::class, $result->_links); } /** * Retrieves all refunds associated with this settlement @@ -124,10 +126,10 @@ public function payments() public function refunds() { if (!isset($this->_links->refunds->href)) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\RefundCollection($this->client, 0, null); + return new RefundCollection($this->client, 0, null); } - $result = $this->client->performHttpCallToFullUrl(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_GET, $this->_links->refunds->href); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->refunds, \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Refund::class, $result->_links); + $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->refunds->href); + return ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->refunds, Refund::class, $result->_links); } /** * Retrieves all chargebacks associated with this settlement @@ -138,10 +140,10 @@ public function refunds() public function chargebacks() { if (!isset($this->_links->chargebacks->href)) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ChargebackCollection($this->client, 0, null); + return new ChargebackCollection($this->client, 0, null); } - $result = $this->client->performHttpCallToFullUrl(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_GET, $this->_links->chargebacks->href); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->chargebacks, \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Chargeback::class, $result->_links); + $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->chargebacks->href); + return ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->chargebacks, Chargeback::class, $result->_links); } /** * Retrieves all captures associated with this settlement @@ -152,9 +154,9 @@ public function chargebacks() public function captures() { if (!isset($this->_links->captures->href)) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\CaptureCollection($this->client, 0, null); + return new CaptureCollection($this->client, 0, null); } - $result = $this->client->performHttpCallToFullUrl(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_GET, $this->_links->captures->href); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->captures, \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Capture::class, $result->_links); + $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->captures->href); + return ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->captures, Capture::class, $result->_links); } } diff --git a/vendor/mollie/mollie-api-php/src/Resources/SettlementCollection.php b/vendor/mollie/mollie-api-php/src/Resources/SettlementCollection.php index db6c91bd9..e1286bb5c 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/SettlementCollection.php +++ b/vendor/mollie/mollie-api-php/src/Resources/SettlementCollection.php @@ -2,7 +2,7 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; -class SettlementCollection extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\CursorCollection +class SettlementCollection extends CursorCollection { /** * @return string @@ -16,6 +16,6 @@ public function getCollectionResourceName() */ protected function createResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Settlement($this->client); + return new Settlement($this->client); } } diff --git a/vendor/mollie/mollie-api-php/src/Resources/Shipment.php b/vendor/mollie/mollie-api-php/src/Resources/Shipment.php index 03094d175..201dffa67 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/Shipment.php +++ b/vendor/mollie/mollie-api-php/src/Resources/Shipment.php @@ -3,7 +3,11 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; use _PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient; -class Shipment extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource +use Mollie\Api\Exceptions\ApiException; +use stdClass; +use function json_encode; + +class Shipment extends BaseResource { /** * @var string @@ -37,12 +41,12 @@ class Shipment extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResourc public $lines; /** * An object containing tracking details for the shipment, if available. - * @var \stdClass|null + * @var stdClass|null */ public $tracking; /** * An object with several URL objects relevant to the customer. Every URL object will contain an href and a type field. - * @var \stdClass + * @var stdClass */ public $_links; /** @@ -82,13 +86,13 @@ public function getTrackingUrl() */ public function lines() { - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createBaseResourceCollection($this->client, \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\OrderLine::class, $this->lines); + return ResourceFactory::createBaseResourceCollection($this->client, OrderLine::class, $this->lines); } /** * Get the Order object for this shipment * * @return Order - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ public function order() { @@ -98,15 +102,15 @@ public function order() * Save changes made to this shipment. * * @return BaseResource|Shipment - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ public function update() { if (!isset($this->_links->self->href)) { return $this; } - $body = \json_encode(["tracking" => $this->tracking]); - $result = $this->client->performHttpCallToFullUrl(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_PATCH, $this->_links->self->href, $body); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createFromApiResult($result, new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Shipment($this->client)); + $body = json_encode(["tracking" => $this->tracking]); + $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_PATCH, $this->_links->self->href, $body); + return ResourceFactory::createFromApiResult($result, new Shipment($this->client)); } } diff --git a/vendor/mollie/mollie-api-php/src/Resources/ShipmentCollection.php b/vendor/mollie/mollie-api-php/src/Resources/ShipmentCollection.php index 9a8a62048..3a15154a6 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/ShipmentCollection.php +++ b/vendor/mollie/mollie-api-php/src/Resources/ShipmentCollection.php @@ -2,7 +2,7 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; -class ShipmentCollection extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseCollection +class ShipmentCollection extends BaseCollection { /** * @return string diff --git a/vendor/mollie/mollie-api-php/src/Resources/Subscription.php b/vendor/mollie/mollie-api-php/src/Resources/Subscription.php index f7f754f10..1bdeb43d2 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/Subscription.php +++ b/vendor/mollie/mollie-api-php/src/Resources/Subscription.php @@ -4,7 +4,11 @@ use _PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient; use _PhpScoper5ea00cc67502b\Mollie\Api\Types\SubscriptionStatus; -class Subscription extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseResource +use Mollie\Api\Exceptions\ApiException; +use stdClass; +use function json_encode; + +class Subscription extends BaseResource { /** * @var string @@ -35,7 +39,7 @@ class Subscription extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseRes */ public $status; /** - * @var \stdClass + * @var stdClass */ public $amount; /** @@ -77,25 +81,25 @@ class Subscription extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\BaseRes /** * Contains an optional 'webhookUrl'. * - * @var \stdClass|null + * @var stdClass|null */ public $webhookUrl; /** - * @var \stdClass + * @var stdClass */ public $_links; /** * @return BaseResource|Subscription - * @throws \Mollie\Api\Exceptions\ApiException + * @throws ApiException */ public function update() { if (!isset($this->_links->self->href)) { return $this; } - $body = \json_encode(["amount" => $this->amount, "times" => $this->times, "startDate" => $this->startDate, "webhookUrl" => $this->webhookUrl, "description" => $this->description, "mandateId" => $this->mandateId, "metadata" => $this->metadata, "interval" => $this->interval]); - $result = $this->client->performHttpCallToFullUrl(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_PATCH, $this->_links->self->href, $body); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createFromApiResult($result, new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Subscription($this->client)); + $body = json_encode(["amount" => $this->amount, "times" => $this->times, "startDate" => $this->startDate, "webhookUrl" => $this->webhookUrl, "description" => $this->description, "mandateId" => $this->mandateId, "metadata" => $this->metadata, "interval" => $this->interval]); + $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_PATCH, $this->_links->self->href, $body); + return ResourceFactory::createFromApiResult($result, new Subscription($this->client)); } /** * Returns whether the Subscription is active or not. @@ -104,7 +108,7 @@ public function update() */ public function isActive() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\SubscriptionStatus::STATUS_ACTIVE; + return $this->status === SubscriptionStatus::STATUS_ACTIVE; } /** * Returns whether the Subscription is pending or not. @@ -113,7 +117,7 @@ public function isActive() */ public function isPending() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\SubscriptionStatus::STATUS_PENDING; + return $this->status === SubscriptionStatus::STATUS_PENDING; } /** * Returns whether the Subscription is canceled or not. @@ -122,7 +126,7 @@ public function isPending() */ public function isCanceled() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\SubscriptionStatus::STATUS_CANCELED; + return $this->status === SubscriptionStatus::STATUS_CANCELED; } /** * Returns whether the Subscription is suspended or not. @@ -131,7 +135,7 @@ public function isCanceled() */ public function isSuspended() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\SubscriptionStatus::STATUS_SUSPENDED; + return $this->status === SubscriptionStatus::STATUS_SUSPENDED; } /** * Returns whether the Subscription is completed or not. @@ -140,7 +144,7 @@ public function isSuspended() */ public function isCompleted() { - return $this->status === \_PhpScoper5ea00cc67502b\Mollie\Api\Types\SubscriptionStatus::STATUS_COMPLETED; + return $this->status === SubscriptionStatus::STATUS_COMPLETED; } /** * Cancels this subscription @@ -154,17 +158,17 @@ public function cancel() } $body = null; if ($this->client->usesOAuth()) { - $body = \json_encode(["testmode" => $this->mode === "test" ? \true : \false]); + $body = json_encode(["testmode" => $this->mode === "test" ? true : false]); } - $result = $this->client->performHttpCallToFullUrl(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_DELETE, $this->_links->self->href, $body); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createFromApiResult($result, new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Subscription($this->client)); + $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_DELETE, $this->_links->self->href, $body); + return ResourceFactory::createFromApiResult($result, new Subscription($this->client)); } public function payments() { if (!isset($this->_links->payments->href)) { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\PaymentCollection($this->client, 0, null); + return new PaymentCollection($this->client, 0, null); } - $result = $this->client->performHttpCallToFullUrl(\_PhpScoper5ea00cc67502b\Mollie\Api\MollieApiClient::HTTP_GET, $this->_links->payments->href); - return \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->payments, \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Payment::class, $result->_links); + $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->payments->href); + return ResourceFactory::createCursorResourceCollection($this->client, $result->_embedded->payments, Payment::class, $result->_links); } } diff --git a/vendor/mollie/mollie-api-php/src/Resources/SubscriptionCollection.php b/vendor/mollie/mollie-api-php/src/Resources/SubscriptionCollection.php index ff0fccdfd..5f83626e0 100644 --- a/vendor/mollie/mollie-api-php/src/Resources/SubscriptionCollection.php +++ b/vendor/mollie/mollie-api-php/src/Resources/SubscriptionCollection.php @@ -2,7 +2,7 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Resources; -class SubscriptionCollection extends \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\CursorCollection +class SubscriptionCollection extends CursorCollection { /** * @return string @@ -16,6 +16,6 @@ public function getCollectionResourceName() */ protected function createResourceObject() { - return new \_PhpScoper5ea00cc67502b\Mollie\Api\Resources\Subscription($this->client); + return new Subscription($this->client); } } diff --git a/vendor/mollie/mollie-api-php/src/Resources/index.php b/vendor/mollie/mollie-api-php/src/Resources/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/mollie/mollie-api-php/src/Resources/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/mollie/mollie-api-php/src/Types/MandateMethod.php b/vendor/mollie/mollie-api-php/src/Types/MandateMethod.php index 792714e6c..3aad78337 100644 --- a/vendor/mollie/mollie-api-php/src/Types/MandateMethod.php +++ b/vendor/mollie/mollie-api-php/src/Types/MandateMethod.php @@ -2,13 +2,15 @@ namespace _PhpScoper5ea00cc67502b\Mollie\Api\Types; +use function in_array; + class MandateMethod { const DIRECTDEBIT = "directdebit"; const CREDITCARD = "creditcard"; public static function getForFirstPaymentMethod($firstPaymentMethod) { - if (\in_array($firstPaymentMethod, [\_PhpScoper5ea00cc67502b\Mollie\Api\Types\PaymentMethod::APPLEPAY, \_PhpScoper5ea00cc67502b\Mollie\Api\Types\PaymentMethod::CREDITCARD])) { + if (in_array($firstPaymentMethod, [PaymentMethod::APPLEPAY, PaymentMethod::CREDITCARD])) { return static::CREDITCARD; } return static::DIRECTDEBIT; diff --git a/vendor/mollie/mollie-api-php/src/Types/index.php b/vendor/mollie/mollie-api-php/src/Types/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/mollie/mollie-api-php/src/Types/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/mollie/mollie-api-php/src/index.php b/vendor/mollie/mollie-api-php/src/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/mollie/mollie-api-php/src/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/paragonie/index.php b/vendor/paragonie/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/paragonie/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/paragonie/random_compat/dist/index.php b/vendor/paragonie/random_compat/dist/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/paragonie/random_compat/dist/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/paragonie/random_compat/index.php b/vendor/paragonie/random_compat/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/paragonie/random_compat/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/paragonie/random_compat/lib/byte_safe_strings.php b/vendor/paragonie/random_compat/lib/byte_safe_strings.php index fd67de500..070b2976e 100644 --- a/vendor/paragonie/random_compat/lib/byte_safe_strings.php +++ b/vendor/paragonie/random_compat/lib/byte_safe_strings.php @@ -2,6 +2,15 @@ namespace _PhpScoper5ea00cc67502b; +use function defined; +use function ini_get; +use function is_callable; +use function is_int; +use function is_string; +use function strlen; +use function substr; +use const MB_OVERLOAD_STRING; + /** * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects @@ -28,8 +37,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -if (!\is_callable('RandomCompat_strlen')) { - if (\defined('MB_OVERLOAD_STRING') && (int) \ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING) { +if (!is_callable('RandomCompat_strlen')) { + if (defined('MB_OVERLOAD_STRING') && (int) ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING) { /** * strlen() implementation that isn't brittle to mbstring.func_overload * @@ -44,7 +53,7 @@ */ function RandomCompat_strlen($binary_string) { - if (!\is_string($binary_string)) { + if (!is_string($binary_string)) { throw new \TypeError('RandomCompat_strlen() expects a string'); } return (int) \mb_strlen($binary_string, '8bit'); @@ -63,15 +72,15 @@ function RandomCompat_strlen($binary_string) */ function RandomCompat_strlen($binary_string) { - if (!\is_string($binary_string)) { + if (!is_string($binary_string)) { throw new \TypeError('RandomCompat_strlen() expects a string'); } - return (int) \strlen($binary_string); + return (int) strlen($binary_string); } } } -if (!\is_callable('RandomCompat_substr')) { - if (\defined('MB_OVERLOAD_STRING') && (int) \ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING) { +if (!is_callable('RandomCompat_substr')) { + if (defined('MB_OVERLOAD_STRING') && (int) ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING) { /** * substr() implementation that isn't brittle to mbstring.func_overload * @@ -88,10 +97,10 @@ function RandomCompat_strlen($binary_string) */ function RandomCompat_substr($binary_string, $start, $length = null) { - if (!\is_string($binary_string)) { + if (!is_string($binary_string)) { throw new \TypeError('RandomCompat_substr(): First argument should be a string'); } - if (!\is_int($start)) { + if (!is_int($start)) { throw new \TypeError('RandomCompat_substr(): Second argument should be an integer'); } if ($length === null) { @@ -100,15 +109,15 @@ function RandomCompat_substr($binary_string, $start, $length = null) * PHP 5.3, so we have to find the length ourselves. */ /** @var int $length */ - $length = \_PhpScoper5ea00cc67502b\RandomCompat_strlen($binary_string) - $start; - } elseif (!\is_int($length)) { + $length = RandomCompat_strlen($binary_string) - $start; + } elseif (!is_int($length)) { throw new \TypeError('RandomCompat_substr(): Third argument should be an integer, or omitted'); } // Consistency with PHP's behavior - if ($start === \_PhpScoper5ea00cc67502b\RandomCompat_strlen($binary_string) && $length === 0) { + if ($start === RandomCompat_strlen($binary_string) && $length === 0) { return ''; } - if ($start > \_PhpScoper5ea00cc67502b\RandomCompat_strlen($binary_string)) { + if ($start > RandomCompat_strlen($binary_string)) { return ''; } return (string) \mb_substr((string) $binary_string, (int) $start, (int) $length, '8bit'); @@ -129,19 +138,19 @@ function RandomCompat_substr($binary_string, $start, $length = null) */ function RandomCompat_substr($binary_string, $start, $length = null) { - if (!\is_string($binary_string)) { + if (!is_string($binary_string)) { throw new \TypeError('RandomCompat_substr(): First argument should be a string'); } - if (!\is_int($start)) { + if (!is_int($start)) { throw new \TypeError('RandomCompat_substr(): Second argument should be an integer'); } if ($length !== null) { - if (!\is_int($length)) { + if (!is_int($length)) { throw new \TypeError('RandomCompat_substr(): Third argument should be an integer, or omitted'); } - return (string) \substr((string) $binary_string, (int) $start, (int) $length); + return (string) substr((string) $binary_string, (int) $start, (int) $length); } - return (string) \substr((string) $binary_string, (int) $start); + return (string) substr((string) $binary_string, (int) $start); } } } diff --git a/vendor/paragonie/random_compat/lib/cast_to_int.php b/vendor/paragonie/random_compat/lib/cast_to_int.php index bbfc035fa..1a3083b89 100644 --- a/vendor/paragonie/random_compat/lib/cast_to_int.php +++ b/vendor/paragonie/random_compat/lib/cast_to_int.php @@ -2,6 +2,12 @@ namespace _PhpScoper5ea00cc67502b; +use function is_callable; +use function is_float; +use function is_int; +use function is_numeric; +use const PHP_INT_MAX; + /** * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects @@ -28,7 +34,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -if (!\is_callable('RandomCompat_intval')) { +if (!is_callable('RandomCompat_intval')) { /** * Cast to an integer if we can, safely. * @@ -46,19 +52,19 @@ * * @throws TypeError */ - function RandomCompat_intval($number, $fail_open = \false) + function RandomCompat_intval($number, $fail_open = false) { - if (\is_int($number) || \is_float($number)) { + if (is_int($number) || is_float($number)) { $number += 0; - } elseif (\is_numeric($number)) { + } elseif (is_numeric($number)) { /** @psalm-suppress InvalidOperand */ $number += 0; } /** @var int|float $number */ - if (\is_float($number) && $number > ~\PHP_INT_MAX && $number < \PHP_INT_MAX) { + if (is_float($number) && $number > ~PHP_INT_MAX && $number < PHP_INT_MAX) { $number = (int) $number; } - if (\is_int($number)) { + if (is_int($number)) { return (int) $number; } elseif (!$fail_open) { throw new \TypeError('Expected an integer.'); diff --git a/vendor/paragonie/random_compat/lib/error_polyfill.php b/vendor/paragonie/random_compat/lib/error_polyfill.php index 79e7006c7..d0118ba8e 100644 --- a/vendor/paragonie/random_compat/lib/error_polyfill.php +++ b/vendor/paragonie/random_compat/lib/error_polyfill.php @@ -2,6 +2,10 @@ namespace _PhpScoper5ea00cc67502b; +use Exception; +use function class_exists; +use function is_subclass_of; + /** * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects @@ -28,19 +32,19 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -if (!\class_exists('Error', \false)) { +if (!class_exists('Error', false)) { // We can't really avoid making this extend Exception in PHP 5. - class Error extends \Exception + class Error extends Exception { } } -if (!\class_exists('TypeError', \false)) { - if (\is_subclass_of('Error', 'Exception')) { +if (!class_exists('TypeError', false)) { + if (is_subclass_of('Error', 'Exception')) { class TypeError extends \Error { } } else { - class TypeError extends \Exception + class TypeError extends Exception { } } diff --git a/vendor/paragonie/random_compat/lib/index.php b/vendor/paragonie/random_compat/lib/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/paragonie/random_compat/lib/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/paragonie/random_compat/lib/random.php b/vendor/paragonie/random_compat/lib/random.php index 82aaf7509..7d9fc7b73 100644 --- a/vendor/paragonie/random_compat/lib/random.php +++ b/vendor/paragonie/random_compat/lib/random.php @@ -2,6 +2,27 @@ namespace _PhpScoper5ea00cc67502b; +use Exception; +use function array_intersect; +use function array_map; +use function class_exists; +use function define; +use function defined; +use function dirname; +use function explode; +use function extension_loaded; +use function in_array; +use function ini_get; +use function is_callable; +use function is_readable; +use function method_exists; +use function preg_split; +use function strtolower; +use const DIRECTORY_SEPARATOR; +use const PATH_SEPARATOR; +use const PHP_VERSION; +use const PHP_VERSION_ID; + /** * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects @@ -31,26 +52,26 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -if (!\defined('PHP_VERSION_ID')) { +if (!defined('PHP_VERSION_ID')) { // This constant was introduced in PHP 5.2.7 - $RandomCompatversion = \array_map('intval', \explode('.', \PHP_VERSION)); - \define('PHP_VERSION_ID', $RandomCompatversion[0] * 10000 + $RandomCompatversion[1] * 100 + $RandomCompatversion[2]); + $RandomCompatversion = array_map('intval', explode('.', PHP_VERSION)); + define('PHP_VERSION_ID', $RandomCompatversion[0] * 10000 + $RandomCompatversion[1] * 100 + $RandomCompatversion[2]); $RandomCompatversion = null; } /** * PHP 7.0.0 and newer have these functions natively. */ -if (\PHP_VERSION_ID >= 70000) { +if (PHP_VERSION_ID >= 70000) { return; } -if (!\defined('RANDOM_COMPAT_READ_BUFFER')) { - \define('RANDOM_COMPAT_READ_BUFFER', 8); +if (!defined('RANDOM_COMPAT_READ_BUFFER')) { + define('RANDOM_COMPAT_READ_BUFFER', 8); } -$RandomCompatDIR = \dirname(__FILE__); -require_once $RandomCompatDIR . \DIRECTORY_SEPARATOR . 'byte_safe_strings.php'; -require_once $RandomCompatDIR . \DIRECTORY_SEPARATOR . 'cast_to_int.php'; -require_once $RandomCompatDIR . \DIRECTORY_SEPARATOR . 'error_polyfill.php'; -if (!\is_callable('random_bytes')) { +$RandomCompatDIR = dirname(__FILE__); +require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'byte_safe_strings.php'; +require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'cast_to_int.php'; +require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'error_polyfill.php'; +if (!is_callable('random_bytes')) { /** * PHP 5.2.0 - 5.6.x way to implement random_bytes() * @@ -65,40 +86,40 @@ * * See RATIONALE.md for our reasoning behind this particular order */ - if (\extension_loaded('libsodium')) { + if (extension_loaded('libsodium')) { // See random_bytes_libsodium.php - if (\PHP_VERSION_ID >= 50300 && \is_callable('_PhpScoper5ea00cc67502b\\Sodium\\randombytes_buf')) { - require_once $RandomCompatDIR . \DIRECTORY_SEPARATOR . 'random_bytes_libsodium.php'; - } elseif (\method_exists('Sodium', 'randombytes_buf')) { - require_once $RandomCompatDIR . \DIRECTORY_SEPARATOR . 'random_bytes_libsodium_legacy.php'; + if (PHP_VERSION_ID >= 50300 && is_callable('_PhpScoper5ea00cc67502b\\Sodium\\randombytes_buf')) { + require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_libsodium.php'; + } elseif (method_exists('Sodium', 'randombytes_buf')) { + require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_libsodium_legacy.php'; } } /** * Reading directly from /dev/urandom: */ - if (\DIRECTORY_SEPARATOR === '/') { + if (DIRECTORY_SEPARATOR === '/') { // DIRECTORY_SEPARATOR === '/' on Unix-like OSes -- this is a fast // way to exclude Windows. - $RandomCompatUrandom = \true; - $RandomCompat_basedir = \ini_get('open_basedir'); + $RandomCompatUrandom = true; + $RandomCompat_basedir = ini_get('open_basedir'); if (!empty($RandomCompat_basedir)) { - $RandomCompat_open_basedir = \explode(\PATH_SEPARATOR, \strtolower($RandomCompat_basedir)); - $RandomCompatUrandom = array() !== \array_intersect(array('/dev', '/dev/', '/dev/urandom'), $RandomCompat_open_basedir); + $RandomCompat_open_basedir = explode(PATH_SEPARATOR, strtolower($RandomCompat_basedir)); + $RandomCompatUrandom = array() !== array_intersect(array('/dev', '/dev/', '/dev/urandom'), $RandomCompat_open_basedir); $RandomCompat_open_basedir = null; } - if (!\is_callable('random_bytes') && $RandomCompatUrandom && @\is_readable('/dev/urandom')) { + if (!is_callable('random_bytes') && $RandomCompatUrandom && @is_readable('/dev/urandom')) { // Error suppression on is_readable() in case of an open_basedir // or safe_mode failure. All we care about is whether or not we // can read it at this point. If the PHP environment is going to // panic over trying to see if the file can be read in the first // place, that is not helpful to us here. // See random_bytes_dev_urandom.php - require_once $RandomCompatDIR . \DIRECTORY_SEPARATOR . 'random_bytes_dev_urandom.php'; + require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_dev_urandom.php'; } // Unset variables after use $RandomCompat_basedir = null; } else { - $RandomCompatUrandom = \false; + $RandomCompatUrandom = false; } /** * mcrypt_create_iv() @@ -118,25 +139,25 @@ * - If we're on Windows, we want to use PHP >= 5.3.7 or else * we get insufficient entropy errors. */ - if (!\is_callable('random_bytes') && (\DIRECTORY_SEPARATOR === '/' || \PHP_VERSION_ID >= 50307) && (\DIRECTORY_SEPARATOR !== '/' || (\PHP_VERSION_ID <= 50609 || \PHP_VERSION_ID >= 50613)) && \extension_loaded('mcrypt')) { + if (!is_callable('random_bytes') && (DIRECTORY_SEPARATOR === '/' || PHP_VERSION_ID >= 50307) && (DIRECTORY_SEPARATOR !== '/' || (PHP_VERSION_ID <= 50609 || PHP_VERSION_ID >= 50613)) && extension_loaded('mcrypt')) { // See random_bytes_mcrypt.php - require_once $RandomCompatDIR . \DIRECTORY_SEPARATOR . 'random_bytes_mcrypt.php'; + require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_mcrypt.php'; } $RandomCompatUrandom = null; /** * This is a Windows-specific fallback, for when the mcrypt extension * isn't loaded. */ - if (!\is_callable('random_bytes') && \extension_loaded('com_dotnet') && \class_exists('_PhpScoper5ea00cc67502b\\COM')) { - $RandomCompat_disabled_classes = \preg_split('#\\s*,\\s*#', \strtolower(\ini_get('disable_classes'))); - if (!\in_array('com', $RandomCompat_disabled_classes)) { + if (!is_callable('random_bytes') && extension_loaded('com_dotnet') && class_exists('_PhpScoper5ea00cc67502b\\COM')) { + $RandomCompat_disabled_classes = preg_split('#\\s*,\\s*#', strtolower(ini_get('disable_classes'))); + if (!in_array('com', $RandomCompat_disabled_classes)) { try { - $RandomCompatCOMtest = new \_PhpScoper5ea00cc67502b\COM('CAPICOM.Utilities.1'); - if (\method_exists($RandomCompatCOMtest, 'GetRandom')) { + $RandomCompatCOMtest = new COM('CAPICOM.Utilities.1'); + if (method_exists($RandomCompatCOMtest, 'GetRandom')) { // See random_bytes_com_dotnet.php - require_once $RandomCompatDIR . \DIRECTORY_SEPARATOR . 'random_bytes_com_dotnet.php'; + require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_com_dotnet.php'; } - } catch (\_PhpScoper5ea00cc67502b\com_exception $e) { + } catch (com_exception $e) { // Don't try to use it. } } @@ -146,7 +167,7 @@ /** * throw new Exception */ - if (!\is_callable('random_bytes')) { + if (!is_callable('random_bytes')) { /** * We don't have any more options, so let's throw an exception right now * and hope the developer won't let it fail silently. @@ -160,12 +181,12 @@ function random_bytes($length) { unset($length); // Suppress "variable not used" warnings. - throw new \Exception('There is no suitable CSPRNG installed on your system'); + throw new Exception('There is no suitable CSPRNG installed on your system'); return ''; } } } -if (!\is_callable('random_int')) { - require_once $RandomCompatDIR . \DIRECTORY_SEPARATOR . 'random_int.php'; +if (!is_callable('random_int')) { + require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_int.php'; } $RandomCompatDIR = null; diff --git a/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php b/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php index e7d50acad..ddc9d71d0 100644 --- a/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php +++ b/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php @@ -2,6 +2,11 @@ namespace _PhpScoper5ea00cc67502b; +use Exception; +use function base64_decode; +use function class_exists; +use function is_callable; + /** * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects @@ -28,7 +33,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -if (!\is_callable('random_bytes')) { +if (!is_callable('random_bytes')) { /** * Windows with PHP < 5.3.0 will not have the function * openssl_random_pseudo_bytes() available, so let's use @@ -44,7 +49,7 @@ function random_bytes($bytes) { try { /** @var int $bytes */ - $bytes = \_PhpScoper5ea00cc67502b\RandomCompat_intval($bytes); + $bytes = RandomCompat_intval($bytes); } catch (\TypeError $ex) { throw new \TypeError('random_bytes(): $bytes must be an integer'); } @@ -53,29 +58,29 @@ function random_bytes($bytes) } /** @var string $buf */ $buf = ''; - if (!\class_exists('_PhpScoper5ea00cc67502b\\COM')) { + if (!class_exists('_PhpScoper5ea00cc67502b\\COM')) { throw new \Error('COM does not exist'); } /** @var COM $util */ - $util = new \_PhpScoper5ea00cc67502b\COM('CAPICOM.Utilities.1'); + $util = new COM('CAPICOM.Utilities.1'); $execCount = 0; /** * Let's not let it loop forever. If we run N times and fail to * get N bytes of random data, then CAPICOM has failed us. */ do { - $buf .= \base64_decode((string) $util->GetRandom($bytes, 0)); - if (\_PhpScoper5ea00cc67502b\RandomCompat_strlen($buf) >= $bytes) { + $buf .= base64_decode((string) $util->GetRandom($bytes, 0)); + if (RandomCompat_strlen($buf) >= $bytes) { /** * Return our random entropy buffer here: */ - return (string) \_PhpScoper5ea00cc67502b\RandomCompat_substr($buf, 0, $bytes); + return (string) RandomCompat_substr($buf, 0, $bytes); } ++$execCount; } while ($execCount < $bytes); /** * If we reach here, PHP has failed us. */ - throw new \Exception('Could not gather sufficient random data'); + throw new Exception('Could not gather sufficient random data'); } } diff --git a/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php b/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php index b57fc1c87..d422e8c8b 100644 --- a/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php +++ b/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php @@ -2,6 +2,11 @@ namespace _PhpScoper5ea00cc67502b; +use Exception; +use function _PhpScoper5ea00cc67502b\Sodium\randombytes_buf; +use function is_callable; +use function is_string; + /** * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects @@ -28,7 +33,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -if (!\is_callable('random_bytes')) { +if (!is_callable('random_bytes')) { /** * If the libsodium PHP extension is loaded, we'll use it above any other * solution. @@ -46,7 +51,7 @@ function random_bytes($bytes) { try { /** @var int $bytes */ - $bytes = \_PhpScoper5ea00cc67502b\RandomCompat_intval($bytes); + $bytes = RandomCompat_intval($bytes); } catch (\TypeError $ex) { throw new \TypeError('random_bytes(): $bytes must be an integer'); } @@ -62,20 +67,20 @@ function random_bytes($bytes) $buf = ''; for ($i = 0; $i < $bytes; $i += 1073741824) { $n = $bytes - $i > 1073741824 ? 1073741824 : $bytes - $i; - $buf .= \_PhpScoper5ea00cc67502b\Sodium\randombytes_buf($n); + $buf .= randombytes_buf($n); } } else { /** @var string|bool $buf */ - $buf = \_PhpScoper5ea00cc67502b\Sodium\randombytes_buf($bytes); + $buf = randombytes_buf($bytes); } - if (\is_string($buf)) { - if (\_PhpScoper5ea00cc67502b\RandomCompat_strlen($buf) === $bytes) { + if (is_string($buf)) { + if (RandomCompat_strlen($buf) === $bytes) { return $buf; } } /** * If we reach here, PHP has failed us. */ - throw new \Exception('Could not gather sufficient random data'); + throw new Exception('Could not gather sufficient random data'); } } diff --git a/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php b/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php index 04e9ac737..b7bbe9ac4 100644 --- a/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php +++ b/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php @@ -2,6 +2,10 @@ namespace _PhpScoper5ea00cc67502b; +use Exception; +use function is_callable; +use function is_string; + /** * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects @@ -28,7 +32,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -if (!\is_callable('random_bytes')) { +if (!is_callable('random_bytes')) { /** * If the libsodium PHP extension is loaded, we'll use it above any other * solution. @@ -46,7 +50,7 @@ function random_bytes($bytes) { try { /** @var int $bytes */ - $bytes = \_PhpScoper5ea00cc67502b\RandomCompat_intval($bytes); + $bytes = RandomCompat_intval($bytes); } catch (\TypeError $ex) { throw new \TypeError('random_bytes(): $bytes must be an integer'); } @@ -64,19 +68,19 @@ function random_bytes($bytes) if ($bytes > 2147483647) { for ($i = 0; $i < $bytes; $i += 1073741824) { $n = $bytes - $i > 1073741824 ? 1073741824 : $bytes - $i; - $buf .= \_PhpScoper5ea00cc67502b\Sodium::randombytes_buf((int) $n); + $buf .= Sodium::randombytes_buf((int) $n); } } else { - $buf .= \_PhpScoper5ea00cc67502b\Sodium::randombytes_buf((int) $bytes); + $buf .= Sodium::randombytes_buf((int) $bytes); } - if (\is_string($buf)) { - if (\_PhpScoper5ea00cc67502b\RandomCompat_strlen($buf) === $bytes) { + if (is_string($buf)) { + if (RandomCompat_strlen($buf) === $bytes) { return $buf; } } /** * If we reach here, PHP has failed us. */ - throw new \Exception('Could not gather sufficient random data'); + throw new Exception('Could not gather sufficient random data'); } } diff --git a/vendor/paragonie/random_compat/lib/random_int.php b/vendor/paragonie/random_compat/lib/random_int.php index 0ac2efc90..518d1e42a 100644 --- a/vendor/paragonie/random_compat/lib/random_int.php +++ b/vendor/paragonie/random_compat/lib/random_int.php @@ -2,7 +2,13 @@ namespace _PhpScoper5ea00cc67502b; -if (!\is_callable('random_int')) { +use Exception; +use function is_callable; +use function is_int; +use function ord; +use const PHP_INT_SIZE; + +if (!is_callable('random_int')) { /** * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects @@ -52,13 +58,13 @@ function random_int($min, $max) */ try { /** @var int $min */ - $min = \_PhpScoper5ea00cc67502b\RandomCompat_intval($min); + $min = RandomCompat_intval($min); } catch (\TypeError $ex) { throw new \TypeError('random_int(): $min must be an integer'); } try { /** @var int $max */ - $max = \_PhpScoper5ea00cc67502b\RandomCompat_intval($max); + $max = RandomCompat_intval($max); } catch (\TypeError $ex) { throw new \TypeError('random_int(): $max must be an integer'); } @@ -98,7 +104,7 @@ function random_int($min, $max) /** * Test for integer overflow: */ - if (!\is_int($range)) { + if (!is_int($range)) { /** * Still safely calculate wider ranges. * Provided by @CodesInChaos, @oittaa @@ -110,7 +116,7 @@ function random_int($min, $max) * @ref https://eval.in/400356 (32-bit) * @ref http://3v4l.org/XX9r5 (64-bit) */ - $bytes = \PHP_INT_SIZE; + $bytes = PHP_INT_SIZE; /** @var int $mask */ $mask = ~0; } else { @@ -142,7 +148,7 @@ function random_int($min, $max) * to a failure probability of 2^-128 for a working RNG */ if ($attempts > 128) { - throw new \Exception('random_int: RNG is broken - too many rejections'); + throw new Exception('random_int: RNG is broken - too many rejections'); } /** * Let's grab the necessary number of random bytes @@ -160,7 +166,7 @@ function random_int($min, $max) */ $val &= 0; for ($i = 0; $i < $bytes; ++$i) { - $val |= \ord($randomByteString[$i]) << $i * 8; + $val |= ord($randomByteString[$i]) << $i * 8; } /** @var int $val */ /** @@ -175,7 +181,7 @@ function random_int($min, $max) * ... or smaller than $min, * then try again. */ - } while (!\is_int($val) || $val > $max || $val < $min); + } while (!is_int($val) || $val > $max || $val < $min); return (int) $val; } } diff --git a/vendor/prestashop/decimal/src/Builder.php b/vendor/prestashop/decimal/src/Builder.php index 23c3949ac..2bb8388e8 100644 --- a/vendor/prestashop/decimal/src/Builder.php +++ b/vendor/prestashop/decimal/src/Builder.php @@ -9,6 +9,16 @@ namespace _PhpScoper5ea00cc67502b\PrestaShop\Decimal; use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number; +use InvalidArgumentException; +use function array_key_exists; +use function ltrim; +use function preg_match; +use function print_r; +use function rtrim; +use function sprintf; +use function str_pad; +use function strlen; + /** * Builds Number instances */ @@ -32,33 +42,33 @@ class Builder public static function parseNumber($number) { if (!self::itLooksLikeANumber($number, $numberParts)) { - throw new \InvalidArgumentException(\sprintf('"%s" cannot be interpreted as a number', \print_r($number, \true))); + throw new InvalidArgumentException(sprintf('"%s" cannot be interpreted as a number', print_r($number, true))); } $integerPart = ''; - if (\array_key_exists('integerPart', $numberParts)) { + if (array_key_exists('integerPart', $numberParts)) { // extract the integer part and remove leading zeroes - $integerPart = \ltrim($numberParts['integerPart'], '0'); + $integerPart = ltrim($numberParts['integerPart'], '0'); } $fractionalPart = ''; - if (\array_key_exists('fractionalPart', $numberParts)) { + if (array_key_exists('fractionalPart', $numberParts)) { // extract the fractional part and remove trailing zeroes - $fractionalPart = \rtrim($numberParts['fractionalPart'], '0'); + $fractionalPart = rtrim($numberParts['fractionalPart'], '0'); } - $fractionalDigits = \strlen($fractionalPart); + $fractionalDigits = strlen($fractionalPart); $coefficient = $integerPart . $fractionalPart; // when coefficient is '0' or a sequence of '0' if ('' === $coefficient) { $coefficient = '0'; } // when the number has been provided in scientific notation - if (\array_key_exists('exponentPart', $numberParts)) { + if (array_key_exists('exponentPart', $numberParts)) { $givenExponent = (int) ($numberParts['exponentSign'] . $numberParts['exponent']); // we simply add or subtract fractional digits from the given exponent (depending if it's positive or negative) $fractionalDigits -= $givenExponent; if ($fractionalDigits < 0) { // if the resulting fractional digits is negative, it means there is no fractional part anymore // we need to add trailing zeroes as needed - $coefficient = \str_pad($coefficient, \strlen($coefficient) - $fractionalDigits, '0'); + $coefficient = str_pad($coefficient, strlen($coefficient) - $fractionalDigits, '0'); // there's no fractional part anymore $fractionalDigits = 0; } @@ -73,6 +83,6 @@ public static function parseNumber($number) */ private static function itLooksLikeANumber($number, &$numberParts) { - return \strlen((string) $number) > 0 && (\preg_match(self::NUMBER_PATTERN, $number, $numberParts) || \preg_match(self::INT_EXPONENTIAL_PATTERN, $number, $numberParts)); + return strlen((string) $number) > 0 && (preg_match(self::NUMBER_PATTERN, $number, $numberParts) || preg_match(self::INT_EXPONENTIAL_PATTERN, $number, $numberParts)); } } diff --git a/vendor/prestashop/decimal/src/Exception/DivisionByZeroException.php b/vendor/prestashop/decimal/src/Exception/DivisionByZeroException.php index 430d0703d..161bcdb0a 100644 --- a/vendor/prestashop/decimal/src/Exception/DivisionByZeroException.php +++ b/vendor/prestashop/decimal/src/Exception/DivisionByZeroException.php @@ -8,9 +8,11 @@ */ namespace _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Exception; +use Exception; + /** * Thrown when attempting to divide by zero */ -class DivisionByZeroException extends \Exception +class DivisionByZeroException extends Exception { } diff --git a/vendor/prestashop/decimal/src/Number.php b/vendor/prestashop/decimal/src/Number.php index 3f6738a39..55603eb20 100644 --- a/vendor/prestashop/decimal/src/Number.php +++ b/vendor/prestashop/decimal/src/Number.php @@ -8,8 +8,25 @@ */ namespace _PhpScoper5ea00cc67502b\PrestaShop\Decimal; +use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Addition; +use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Comparison; +use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Division; +use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\MagnitudeChange; +use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Multiplication; +use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Subtraction; use InvalidArgumentException; use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding; +use function gettype; +use function is_string; +use function ltrim; +use function preg_match; +use function print_r; +use function sprintf; +use function str_pad; +use function strlen; +use function substr; +use const STR_PAD_LEFT; + /** * Decimal number. * @@ -21,7 +38,7 @@ class Number * Indicates if the number is negative * @var bool */ - private $isNegative = \false; + private $isNegative = false; /** * Integer representation of this number * @var string @@ -58,18 +75,18 @@ class Number */ public function __construct($number, $exponent = null) { - if (!\is_string($number)) { - throw new \InvalidArgumentException(\sprintf('Invalid type - expected string, but got (%s) "%s"', \gettype($number), \print_r($number, \true))); + if (!is_string($number)) { + throw new InvalidArgumentException(sprintf('Invalid type - expected string, but got (%s) "%s"', gettype($number), print_r($number, true))); } if (null === $exponent) { - $decimalNumber = \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Builder::parseNumber($number); + $decimalNumber = Builder::parseNumber($number); $number = $decimalNumber->getSign() . $decimalNumber->getCoefficient(); $exponent = $decimalNumber->getExponent(); } $this->initFromScientificNotation($number, $exponent); if ('0' === $this->coefficient) { // make sure the sign is always positive for zero - $this->isNegative = \false; + $this->isNegative = false; } } /** @@ -86,10 +103,10 @@ public function getIntegerPart() if (0 === $this->exponent) { return $this->coefficient; } - if ($this->exponent >= \strlen($this->coefficient)) { + if ($this->exponent >= strlen($this->coefficient)) { return '0'; } - return \substr($this->coefficient, 0, -$this->exponent); + return substr($this->coefficient, 0, -$this->exponent); } /** * Returns the fractional part of the number. @@ -102,10 +119,10 @@ public function getFractionalPart() if (0 === $this->exponent || '0' === $this->coefficient) { return '0'; } - if ($this->exponent > \strlen($this->coefficient)) { - return \str_pad($this->coefficient, $this->exponent, '0', \STR_PAD_LEFT); + if ($this->exponent > strlen($this->coefficient)) { + return str_pad($this->coefficient, $this->exponent, '0', STR_PAD_LEFT); } - return \substr($this->coefficient, -$this->exponent); + return substr($this->coefficient, -$this->exponent); } /** * Returns the number of digits in the fractional part. @@ -185,7 +202,7 @@ public function __toString() * * @return string */ - public function toPrecision($precision, $roundingMode = \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE) + public function toPrecision($precision, $roundingMode = Rounding::ROUND_TRUNCATE) { $currentPrecision = $this->getPrecision(); if ($precision === $currentPrecision) { @@ -193,10 +210,10 @@ public function toPrecision($precision, $roundingMode = \_PhpScoper5ea00cc67502b } $return = $this; if ($precision < $currentPrecision) { - $return = (new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding())->compute($this, $precision, $roundingMode); + $return = (new Rounding())->compute($this, $precision, $roundingMode); } if ($precision > $return->getPrecision()) { - return $return->getSign() . $return->getIntegerPart() . '.' . \str_pad($return->getFractionalPart(), $precision, '0'); + return $return->getSign() . $return->getIntegerPart() . '.' . str_pad($return->getFractionalPart(), $precision, '0'); } return (string) $return; } @@ -218,11 +235,11 @@ public function toPrecision($precision, $roundingMode = \_PhpScoper5ea00cc67502b * * @return string */ - public function round($maxDecimals, $roundingMode = \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE) + public function round($maxDecimals, $roundingMode = Rounding::ROUND_TRUNCATE) { $currentPrecision = $this->getPrecision(); if ($maxDecimals < $currentPrecision) { - return (string) (new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding())->compute($this, $maxDecimals, $roundingMode); + return (string) (new Rounding())->compute($this, $maxDecimals, $roundingMode); } return (string) $this; } @@ -259,7 +276,7 @@ public function toNegative() */ public function plus(self $addend) { - return (new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Addition())->compute($this, $addend); + return (new Addition())->compute($this, $addend); } /** * Returns the computed result of subtracting another number to this one @@ -270,7 +287,7 @@ public function plus(self $addend) */ public function minus(self $subtrahend) { - return (new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Subtraction())->compute($this, $subtrahend); + return (new Subtraction())->compute($this, $subtrahend); } /** * Returns the computed result of multiplying this number with another one @@ -281,7 +298,7 @@ public function minus(self $subtrahend) */ public function times(self $factor) { - return (new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Multiplication())->compute($this, $factor); + return (new Multiplication())->compute($this, $factor); } /** * Returns the computed result of dividing this number by another one, with up to $precision number of decimals. @@ -299,9 +316,9 @@ public function times(self $factor) * * @throws Exception\DivisionByZeroException */ - public function dividedBy(self $divisor, $precision = \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Division::DEFAULT_PRECISION) + public function dividedBy(self $divisor, $precision = Division::DEFAULT_PRECISION) { - return (new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Division())->compute($this, $divisor, $precision); + return (new Division())->compute($this, $divisor, $precision); } /** * Indicates if this number equals zero @@ -321,7 +338,7 @@ public function equalsZero() */ public function isGreaterThan(self $number) { - return 1 === (new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Comparison())->compare($this, $number); + return 1 === (new Comparison())->compare($this, $number); } /** * Indicates if this number is greater than zero @@ -350,7 +367,7 @@ public function isGreaterOrEqualThanZero() */ public function isGreaterOrEqualThan(self $number) { - return 0 <= (new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Comparison())->compare($this, $number); + return 0 <= (new Comparison())->compare($this, $number); } /** * Indicates if this number is lower than zero @@ -379,7 +396,7 @@ public function isLowerOrEqualThanZero() */ public function isLowerThan(self $number) { - return -1 === (new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Comparison())->compare($this, $number); + return -1 === (new Comparison())->compare($this, $number); } /** * Indicates if this number is lower or equal compared to the provided one @@ -390,7 +407,7 @@ public function isLowerThan(self $number) */ public function isLowerOrEqualThan(self $number) { - return 0 >= (new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Comparison())->compare($this, $number); + return 0 >= (new Comparison())->compare($this, $number); } /** * Indicates if this number is positive @@ -441,7 +458,7 @@ public function invert() */ public function toMagnitude($exponent) { - return (new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\MagnitudeChange())->compute($this, $exponent); + return (new MagnitudeChange())->compute($this, $exponent); } /** * Initializes the number using a coefficient and exponent @@ -452,15 +469,15 @@ public function toMagnitude($exponent) private function initFromScientificNotation($coefficient, $exponent) { if ($exponent < 0) { - throw new \InvalidArgumentException(\sprintf('Invalid value for exponent. Expected a positive integer or 0, but got "%s"', $coefficient)); + throw new InvalidArgumentException(sprintf('Invalid value for exponent. Expected a positive integer or 0, but got "%s"', $coefficient)); } - if (!\preg_match("/^(?[-+])?(?\\d+)\$/", $coefficient, $parts)) { - throw new \InvalidArgumentException(\sprintf('"%s" cannot be interpreted as a number', $coefficient)); + if (!preg_match("/^(?[-+])?(?\\d+)\$/", $coefficient, $parts)) { + throw new InvalidArgumentException(sprintf('"%s" cannot be interpreted as a number', $coefficient)); } $this->isNegative = '-' === $parts['sign']; $this->exponent = (int) $exponent; // trim leading zeroes - $this->coefficient = \ltrim($parts['integerPart'], '0'); + $this->coefficient = ltrim($parts['integerPart'], '0'); // when coefficient is '0' or a sequence of '0' if ('' === $this->coefficient) { $this->exponent = 0; @@ -478,7 +495,7 @@ private function removeTrailingZeroesIfNeeded() $coefficient = $this->getCoefficient(); // trim trailing zeroes from the fractional part // for example 1000e-1 => 100.0 - if (0 < $exponent && '0' === \substr($coefficient, -1)) { + if (0 < $exponent && '0' === substr($coefficient, -1)) { $fractionalPart = $this->getFractionalPart(); $trailingZeroesToRemove = 0; for ($i = $exponent - 1; $i >= 0; $i--) { @@ -488,7 +505,7 @@ private function removeTrailingZeroesIfNeeded() $trailingZeroesToRemove++; } if ($trailingZeroesToRemove > 0) { - $this->coefficient = \substr($coefficient, 0, -$trailingZeroesToRemove); + $this->coefficient = substr($coefficient, 0, -$trailingZeroesToRemove); $this->exponent = $exponent - $trailingZeroesToRemove; } } diff --git a/vendor/prestashop/decimal/src/Operation/Addition.php b/vendor/prestashop/decimal/src/Operation/Addition.php index 1982d2c61..719941271 100644 --- a/vendor/prestashop/decimal/src/Operation/Addition.php +++ b/vendor/prestashop/decimal/src/Operation/Addition.php @@ -9,6 +9,15 @@ namespace _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation; use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number as DecimalNumber; +use function function_exists; +use function max; +use function str_pad; +use function strlen; +use function strrev; +use const PHP_INT_MAX; +use const STR_PAD_LEFT; +use const STR_PAD_RIGHT; + /** * Computes the addition of two decimal numbers */ @@ -25,7 +34,7 @@ class Addition */ public function __construct() { - $this->maxSafeIntStringSize = \strlen((string) \PHP_INT_MAX) - 1; + $this->maxSafeIntStringSize = strlen((string) PHP_INT_MAX) - 1; } /** * Performs the addition @@ -35,9 +44,9 @@ public function __construct() * * @return DecimalNumber Result of the addition */ - public function compute(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $a, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $b) + public function compute(DecimalNumber $a, DecimalNumber $b) { - if (\function_exists('_PhpScoper5ea00cc67502b\\bcadd')) { + if (function_exists('_PhpScoper5ea00cc67502b\\bcadd')) { return $this->computeUsingBcMath($a, $b); } return $this->computeWithoutBcMath($a, $b); @@ -50,11 +59,11 @@ public function compute(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $a, \ * * @return DecimalNumber Result of the addition */ - public function computeUsingBcMath(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $a, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $b) + public function computeUsingBcMath(DecimalNumber $a, DecimalNumber $b) { $precision1 = $a->getPrecision(); $precision2 = $b->getPrecision(); - return new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number((string) bcadd($a, $b, \max($precision1, $precision2))); + return new DecimalNumber((string) bcadd($a, $b, max($precision1, $precision2))); } /** * Performs the addition without BC Math @@ -64,7 +73,7 @@ public function computeUsingBcMath(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\N * * @return DecimalNumber Result of the addition */ - public function computeWithoutBcMath(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $a, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $b) + public function computeWithoutBcMath(DecimalNumber $a, DecimalNumber $b) { if ($a->isNegative()) { if ($b->isNegative()) { @@ -101,14 +110,14 @@ public function computeWithoutBcMath(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal return $a; } // pad coefficients with leading/trailing zeroes - list($coeff1, $coeff2) = $this->normalizeCoefficients($a, $b); + [$coeff1, $coeff2] = $this->normalizeCoefficients($a, $b); // compute the coefficient sum $sum = $this->addStrings($coeff1, $coeff2); // both signs are equal, so we can use either $sign = $a->getSign(); // keep the bigger exponent - $exponent = \max($a->getExponent(), $b->getExponent()); - return new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($sign . $sum, $exponent); + $exponent = max($a->getExponent(), $b->getExponent()); + return new DecimalNumber($sign . $sum, $exponent); } /** * Normalizes coefficients by adding leading or trailing zeroes as needed so that both are the same length @@ -118,7 +127,7 @@ public function computeWithoutBcMath(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal * * @return array An array containing the normalized coefficients */ - private function normalizeCoefficients(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $a, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $b) + private function normalizeCoefficients(DecimalNumber $a, DecimalNumber $b) { $exp1 = $a->getExponent(); $exp2 = $b->getExponent(); @@ -126,17 +135,17 @@ private function normalizeCoefficients(\_PhpScoper5ea00cc67502b\PrestaShop\Decim $coeff2 = $b->getCoefficient(); // add trailing zeroes if needed if ($exp1 > $exp2) { - $coeff2 = \str_pad($coeff2, \strlen($coeff2) + $exp1 - $exp2, '0', \STR_PAD_RIGHT); + $coeff2 = str_pad($coeff2, strlen($coeff2) + $exp1 - $exp2, '0', STR_PAD_RIGHT); } elseif ($exp1 < $exp2) { - $coeff1 = \str_pad($coeff1, \strlen($coeff1) + $exp2 - $exp1, '0', \STR_PAD_RIGHT); + $coeff1 = str_pad($coeff1, strlen($coeff1) + $exp2 - $exp1, '0', STR_PAD_RIGHT); } - $len1 = \strlen($coeff1); - $len2 = \strlen($coeff2); + $len1 = strlen($coeff1); + $len2 = strlen($coeff2); // add leading zeroes if needed if ($len1 > $len2) { - $coeff2 = \str_pad($coeff2, $len1, '0', \STR_PAD_LEFT); + $coeff2 = str_pad($coeff2, $len1, '0', STR_PAD_LEFT); } elseif ($len1 < $len2) { - $coeff1 = \str_pad($coeff1, $len2, '0', \STR_PAD_LEFT); + $coeff1 = str_pad($coeff1, $len2, '0', STR_PAD_LEFT); } return [$coeff1, $coeff2]; } @@ -151,17 +160,17 @@ private function normalizeCoefficients(\_PhpScoper5ea00cc67502b\PrestaShop\Decim * * @return string */ - private function addStrings($number1, $number2, $fractional = \false) + private function addStrings($number1, $number2, $fractional = false) { // optimization - numbers can be treated as integers as long as they don't overflow the max int size - if ('0' !== $number1[0] && '0' !== $number2[0] && \strlen($number1) <= $this->maxSafeIntStringSize && \strlen($number2) <= $this->maxSafeIntStringSize) { + if ('0' !== $number1[0] && '0' !== $number2[0] && strlen($number1) <= $this->maxSafeIntStringSize && strlen($number2) <= $this->maxSafeIntStringSize) { return (string) ((int) $number1 + (int) $number2); } // find out which of the strings is longest - $maxLength = \max(\strlen($number1), \strlen($number2)); + $maxLength = max(strlen($number1), strlen($number2)); // add leading or trailing zeroes as needed - $number1 = \str_pad($number1, $maxLength, '0', $fractional ? \STR_PAD_RIGHT : \STR_PAD_LEFT); - $number2 = \str_pad($number2, $maxLength, '0', $fractional ? \STR_PAD_RIGHT : \STR_PAD_LEFT); + $number1 = str_pad($number1, $maxLength, '0', $fractional ? STR_PAD_RIGHT : STR_PAD_LEFT); + $number2 = str_pad($number2, $maxLength, '0', $fractional ? STR_PAD_RIGHT : STR_PAD_LEFT); $result = ''; $carryOver = 0; for ($i = $maxLength - 1; 0 <= $i; $i--) { @@ -172,6 +181,6 @@ private function addStrings($number1, $number2, $fractional = \false) if ($carryOver > 0) { $result .= '1'; } - return \strrev($result); + return strrev($result); } } diff --git a/vendor/prestashop/decimal/src/Operation/Comparison.php b/vendor/prestashop/decimal/src/Operation/Comparison.php index 9189e00cd..6a3eaeb50 100644 --- a/vendor/prestashop/decimal/src/Operation/Comparison.php +++ b/vendor/prestashop/decimal/src/Operation/Comparison.php @@ -9,6 +9,11 @@ namespace _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation; use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number as DecimalNumber; +use function function_exists; +use function max; +use function strcmp; +use function strlen; + /** * Compares two decimal numbers */ @@ -22,9 +27,9 @@ class Comparison * * @return int Returns 1 if $a > $b, -1 if $a < $b, and 0 if they are equal. */ - public function compare(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $a, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $b) + public function compare(DecimalNumber $a, DecimalNumber $b) { - if (\function_exists('_PhpScoper5ea00cc67502b\\bccomp')) { + if (function_exists('_PhpScoper5ea00cc67502b\\bccomp')) { return $this->compareUsingBcMath($a, $b); } return $this->compareWithoutBcMath($a, $b); @@ -37,9 +42,9 @@ public function compare(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $a, \ * * @return int Returns 1 if $a > $b, -1 if $a < $b, and 0 if they are equal. */ - public function compareUsingBcMath(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $a, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $b) + public function compareUsingBcMath(DecimalNumber $a, DecimalNumber $b) { - return bccomp((string) $a, (string) $b, \max($a->getExponent(), $b->getExponent())); + return bccomp((string) $a, (string) $b, max($a->getExponent(), $b->getExponent())); } /** * Compares two decimal numbers without using BC Math @@ -49,7 +54,7 @@ public function compareUsingBcMath(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\N * * @return int Returns 1 if $a > $b, -1 if $a < $b, and 0 if they are equal. */ - public function compareWithoutBcMath(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $a, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $b) + public function compareWithoutBcMath(DecimalNumber $a, DecimalNumber $b) { $signCompare = $this->compareSigns($a->getSign(), $b->getSign()); if ($signCompare !== 0) { @@ -71,10 +76,10 @@ public function compareWithoutBcMath(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal * * @return int Returns 1 if $a > $b, -1 if $a < $b, and 0 if they are equal. */ - private function positiveCompare(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $a, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $b) + private function positiveCompare(DecimalNumber $a, DecimalNumber $b) { // compare integer length - $intLengthCompare = $this->compareNumeric(\strlen($a->getIntegerPart()), \strlen($b->getIntegerPart())); + $intLengthCompare = $this->compareNumeric(strlen($a->getIntegerPart()), strlen($b->getIntegerPart())); if ($intLengthCompare !== 0) { return $intLengthCompare; } @@ -133,7 +138,7 @@ private function compareNumeric($a, $b) */ private function compareBinary($a, $b) { - $comparison = \strcmp($a, $b); + $comparison = strcmp($a, $b); if ($comparison > 0) { return 1; } diff --git a/vendor/prestashop/decimal/src/Operation/Division.php b/vendor/prestashop/decimal/src/Operation/Division.php index c96763503..9c33e1b75 100644 --- a/vendor/prestashop/decimal/src/Operation/Division.php +++ b/vendor/prestashop/decimal/src/Operation/Division.php @@ -10,6 +10,10 @@ use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Exception\DivisionByZeroException; use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number as DecimalNumber; +use function function_exists; +use function max; +use function strlen; + /** * Computes the division between two decimal numbers. */ @@ -32,9 +36,9 @@ class Division * @return DecimalNumber Result of the division * @throws DivisionByZeroException */ - public function compute(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $a, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $b, $precision = self::DEFAULT_PRECISION) + public function compute(DecimalNumber $a, DecimalNumber $b, $precision = self::DEFAULT_PRECISION) { - if (\function_exists('_PhpScoper5ea00cc67502b\\bcdiv')) { + if (function_exists('_PhpScoper5ea00cc67502b\\bcdiv')) { return $this->computeUsingBcMath($a, $b, $precision); } return $this->computeWithoutBcMath($a, $b, $precision); @@ -49,12 +53,12 @@ public function compute(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $a, \ * @return DecimalNumber Result of the division * @throws DivisionByZeroException */ - public function computeUsingBcMath(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $a, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $b, $precision = self::DEFAULT_PRECISION) + public function computeUsingBcMath(DecimalNumber $a, DecimalNumber $b, $precision = self::DEFAULT_PRECISION) { if ((string) $b === '0') { - throw new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Exception\DivisionByZeroException(); + throw new DivisionByZeroException(); } - return new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number((string) bcdiv($a, $b, $precision)); + return new DecimalNumber((string) bcdiv($a, $b, $precision)); } /** * Performs the division without BC Math @@ -66,11 +70,11 @@ public function computeUsingBcMath(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\N * @return DecimalNumber Result of the division * @throws DivisionByZeroException */ - public function computeWithoutBcMath(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $a, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $b, $precision = self::DEFAULT_PRECISION) + public function computeWithoutBcMath(DecimalNumber $a, DecimalNumber $b, $precision = self::DEFAULT_PRECISION) { $bString = (string) $b; if ('0' === $bString) { - throw new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Exception\DivisionByZeroException(); + throw new DivisionByZeroException(); } $aString = (string) $a; // 0 as dividend always yields 0 @@ -87,17 +91,17 @@ public function computeWithoutBcMath(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal } // if dividend and divisor are equal, the result is always 1 if ($a->equals($b)) { - return new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('1'); + return new DecimalNumber('1'); } $aPrecision = $a->getPrecision(); $bPrecision = $b->getPrecision(); - $maxPrecision = \max($aPrecision, $bPrecision); + $maxPrecision = max($aPrecision, $bPrecision); if ($maxPrecision > 0) { // make $a and $b integers by multiplying both by 10^(maximum number of decimals) $a = $a->toMagnitude($maxPrecision); $b = $b->toMagnitude($maxPrecision); } - $result = $this->integerDivision($a, $b, \max($precision, $aPrecision)); + $result = $this->integerDivision($a, $b, max($precision, $aPrecision)); return $result; } /** @@ -109,11 +113,11 @@ public function computeWithoutBcMath(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal * * @return DecimalNumber */ - private function integerDivision(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $a, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $b, $precision) + private function integerDivision(DecimalNumber $a, DecimalNumber $b, $precision) { $dividend = $a->getCoefficient(); - $divisor = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($b->getCoefficient()); - $dividendLength = \strlen($dividend); + $divisor = new DecimalNumber($b->getCoefficient()); + $dividendLength = strlen($dividend); $result = ''; $exponent = 0; $currentSequence = ''; @@ -126,7 +130,7 @@ private function integerDivision(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Num } } else { // subtract divisor as many times as we can - $remainder = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($currentSequence); + $remainder = new DecimalNumber($currentSequence); $multiple = 0; do { $multiple++; @@ -146,6 +150,6 @@ private function integerDivision(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Num } } $sign = ($a->isNegative() xor $b->isNegative()) ? '-' : ''; - return new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($sign . $result, $exponent); + return new DecimalNumber($sign . $result, $exponent); } } diff --git a/vendor/prestashop/decimal/src/Operation/MagnitudeChange.php b/vendor/prestashop/decimal/src/Operation/MagnitudeChange.php index 685acf973..1366fda88 100644 --- a/vendor/prestashop/decimal/src/Operation/MagnitudeChange.php +++ b/vendor/prestashop/decimal/src/Operation/MagnitudeChange.php @@ -9,6 +9,10 @@ namespace _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation; use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number as DecimalNumber; +use function abs; +use function str_pad; +use function strlen; + /** * Computes relative magnitude changes on a decimal number */ @@ -32,7 +36,7 @@ class MagnitudeChange * * @return DecimalNumber */ - public function compute(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $number, $exponent) + public function compute(DecimalNumber $number, $exponent) { $exponent = (int) $exponent; if ($exponent === 0) { @@ -40,10 +44,10 @@ public function compute(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $numb } $resultingExponent = $exponent - $number->getExponent(); if ($resultingExponent <= 0) { - return new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number->getSign() . $number->getCoefficient(), \abs($resultingExponent)); + return new DecimalNumber($number->getSign() . $number->getCoefficient(), abs($resultingExponent)); } // add zeroes - $targetLength = \strlen($number->getCoefficient()) + $resultingExponent; - return new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number->getSign() . \str_pad($number->getCoefficient(), $targetLength, '0')); + $targetLength = strlen($number->getCoefficient()) + $resultingExponent; + return new DecimalNumber($number->getSign() . str_pad($number->getCoefficient(), $targetLength, '0')); } } diff --git a/vendor/prestashop/decimal/src/Operation/Multiplication.php b/vendor/prestashop/decimal/src/Operation/Multiplication.php index 1848f4e24..b3f431c7a 100644 --- a/vendor/prestashop/decimal/src/Operation/Multiplication.php +++ b/vendor/prestashop/decimal/src/Operation/Multiplication.php @@ -9,6 +9,13 @@ namespace _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation; use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number as DecimalNumber; +use function floor; +use function function_exists; +use function ltrim; +use function str_pad; +use function strlen; +use function strrev; + /** * Computes the multiplication between two decimal numbers */ @@ -22,9 +29,9 @@ class Multiplication * * @return DecimalNumber Result of the multiplication */ - public function compute(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $a, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $b) + public function compute(DecimalNumber $a, DecimalNumber $b) { - if (\function_exists('_PhpScoper5ea00cc67502b\\bcmul')) { + if (function_exists('_PhpScoper5ea00cc67502b\\bcmul')) { return $this->computeUsingBcMath($a, $b); } return $this->computeWithoutBcMath($a, $b); @@ -37,11 +44,11 @@ public function compute(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $a, \ * * @return DecimalNumber Result of the multiplication */ - public function computeUsingBcMath(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $a, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $b) + public function computeUsingBcMath(DecimalNumber $a, DecimalNumber $b) { $precision1 = $a->getPrecision(); $precision2 = $b->getPrecision(); - return new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number((string) bcmul($a, $b, $precision1 + $precision2)); + return new DecimalNumber((string) bcmul($a, $b, $precision1 + $precision2)); } /** * Performs the multiplication without BC Math @@ -51,13 +58,13 @@ public function computeUsingBcMath(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\N * * @return DecimalNumber Result of the multiplication */ - public function computeWithoutBcMath(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $a, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $b) + public function computeWithoutBcMath(DecimalNumber $a, DecimalNumber $b) { $aAsString = (string) $a; $bAsString = (string) $b; // optimization: if either one is zero, the result is zero if ('0' === $aAsString || '0' === $bAsString) { - return new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('0'); + return new DecimalNumber('0'); } // optimization: if either one is one, the result is the other one if ('1' === $aAsString) { @@ -66,12 +73,12 @@ public function computeWithoutBcMath(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal if ('1' === $bAsString) { return $a; } - $result = $this->multiplyStrings(\ltrim($a->getCoefficient(), '0'), \ltrim($b->getCoefficient(), '0')); + $result = $this->multiplyStrings(ltrim($a->getCoefficient(), '0'), ltrim($b->getCoefficient(), '0')); $sign = ($a->isNegative() xor $b->isNegative()) ? '-' : ''; // a multiplication has at most as many decimal figures as the sum // of the number of decimal figures the factors have $exponent = $a->getExponent() + $b->getExponent(); - return new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($sign . $result, $exponent); + return new DecimalNumber($sign . $result, $exponent); } /** * Multiplies two integer numbers as strings. @@ -85,15 +92,15 @@ public function computeWithoutBcMath(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal */ private function multiplyStrings($topNumber, $bottomNumber) { - $topNumberLength = \strlen($topNumber); - $bottomNumberLength = \strlen($bottomNumber); + $topNumberLength = strlen($topNumber); + $bottomNumberLength = strlen($bottomNumber); if ($topNumberLength < $bottomNumberLength) { // multiplication is commutative, and this algorithm // performs better if the bottom number is shorter. return $this->multiplyStrings($bottomNumber, $topNumber); } $stepNumber = 0; - $result = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('0'); + $result = new DecimalNumber('0'); for ($i = $bottomNumberLength - 1; $i >= 0; $i--) { $carryOver = 0; $partialResult = ''; @@ -104,12 +111,12 @@ private function multiplyStrings($topNumber, $bottomNumber) } if ($bottomNumber[$i] === '1') { // multiplying by one is the same as copying the top number - $partialResult = \strrev($topNumber); + $partialResult = strrev($topNumber); } else { // digit-by-digit multiplication using carry-over for ($j = $topNumberLength - 1; $j >= 0; $j--) { $multiplicationResult = $bottomNumber[$i] * $topNumber[$j] + $carryOver; - $carryOver = \floor($multiplicationResult / 10); + $carryOver = floor($multiplicationResult / 10); $partialResult .= $multiplicationResult % 10; } if ($carryOver > 0) { @@ -117,10 +124,10 @@ private function multiplyStrings($topNumber, $bottomNumber) } } // pad the partial result with as many zeros as performed steps - $padding = \str_pad('', $stepNumber, '0'); + $padding = str_pad('', $stepNumber, '0'); $partialResult = $padding . $partialResult; // add to the result - $result = $result->plus(new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number(\strrev($partialResult))); + $result = $result->plus(new DecimalNumber(strrev($partialResult))); $stepNumber++; } return (string) $result; diff --git a/vendor/prestashop/decimal/src/Operation/Rounding.php b/vendor/prestashop/decimal/src/Operation/Rounding.php index c0dd1404a..1932a5d2c 100644 --- a/vendor/prestashop/decimal/src/Operation/Rounding.php +++ b/vendor/prestashop/decimal/src/Operation/Rounding.php @@ -9,6 +9,14 @@ namespace _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation; use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number as DecimalNumber; +use InvalidArgumentException; +use function is_numeric; +use function print_r; +use function sprintf; +use function str_pad; +use function substr; +use const STR_PAD_LEFT; + /** * Allows transforming a decimal number's precision */ @@ -29,7 +37,7 @@ class Rounding * * @return DecimalNumber */ - public function compute(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $number, $precision, $roundingMode) + public function compute(DecimalNumber $number, $precision, $roundingMode) { switch ($roundingMode) { case self::ROUND_HALF_UP: @@ -51,7 +59,7 @@ public function compute(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $numb return $this->roundHalfEven($number, $precision); break; } - throw new \InvalidArgumentException(\sprintf("Invalid rounding mode: %s", \print_r($roundingMode, \true))); + throw new InvalidArgumentException(sprintf("Invalid rounding mode: %s", print_r($roundingMode, true))); } /** * Truncates a number to a target number of decimal digits. @@ -61,16 +69,16 @@ public function compute(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $numb * * @return DecimalNumber */ - public function truncate(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $number, $precision) + public function truncate(DecimalNumber $number, $precision) { $precision = $this->sanitizePrecision($precision); if ($number->getPrecision() <= $precision) { return $number; } if (0 === $precision) { - return new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number->getSign() . $number->getIntegerPart()); + return new DecimalNumber($number->getSign() . $number->getIntegerPart()); } - return new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number->getSign() . $number->getIntegerPart() . '.' . \substr($number->getFractionalPart(), 0, $precision)); + return new DecimalNumber($number->getSign() . $number->getIntegerPart() . '.' . substr($number->getFractionalPart(), 0, $precision)); } /** * Rounds a number up if its precision is greater than the target one. @@ -96,7 +104,7 @@ public function truncate(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $num * * @return DecimalNumber */ - public function ceil(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $number, $precision) + public function ceil(DecimalNumber $number, $precision) { $precision = $this->sanitizePrecision($precision); if ($number->getPrecision() <= $precision) { @@ -119,11 +127,11 @@ public function ceil(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $number, if ($precision > 0) { // we know that D > 0, because we have already checked that the number's precision // is greater than the target precision - $numberToAdd = '0.' . \str_pad('1', $precision, '0', \STR_PAD_LEFT); + $numberToAdd = '0.' . str_pad('1', $precision, '0', STR_PAD_LEFT); } else { $numberToAdd = '1'; } - return $this->truncate($number, $precision)->plus(new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($numberToAdd)); + return $this->truncate($number, $precision)->plus(new DecimalNumber($numberToAdd)); } /** * Rounds a number down if its precision is greater than the target one. @@ -149,7 +157,7 @@ public function ceil(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $number, * * @return DecimalNumber */ - public function floor(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $number, $precision) + public function floor(DecimalNumber $number, $precision) { $precision = $this->sanitizePrecision($precision); if ($number->getPrecision() <= $precision) { @@ -172,11 +180,11 @@ public function floor(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $number if ($precision > 0) { // we know that D > 0, because we have already checked that the number's precision // is greater than the target precision - $numberToSubtract = '0.' . \str_pad('1', $precision, '0', \STR_PAD_LEFT); + $numberToSubtract = '0.' . str_pad('1', $precision, '0', STR_PAD_LEFT); } else { $numberToSubtract = '1'; } - return $this->truncate($number, $precision)->minus(new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($numberToSubtract)); + return $this->truncate($number, $precision)->minus(new DecimalNumber($numberToSubtract)); } /** * Rounds the number according to the digit D located at precision P. @@ -202,7 +210,7 @@ public function floor(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $number * * @return DecimalNumber */ - public function roundHalfUp(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $number, $precision) + public function roundHalfUp(DecimalNumber $number, $precision) { return $this->roundHalf($number, $precision, 5); } @@ -230,7 +238,7 @@ public function roundHalfUp(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $ * * @return DecimalNumber */ - public function roundHalfDown(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $number, $precision) + public function roundHalfDown(DecimalNumber $number, $precision) { return $this->roundHalf($number, $precision, 6); } @@ -276,7 +284,7 @@ public function roundHalfDown(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number * * @return DecimalNumber */ - public function roundHalfEven(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $number, $precision) + public function roundHalfEven(DecimalNumber $number, $precision) { $precision = $this->sanitizePrecision($precision); if ($number->getPrecision() <= $precision) { @@ -302,7 +310,7 @@ public function roundHalfEven(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number } // retrieve the digit to the left of it if ($precision === 0) { - $referenceDigit = (int) \substr($number->getIntegerPart(), -1); + $referenceDigit = (int) substr($number->getIntegerPart(), -1); } else { $referenceDigit = (int) $fractionalPart[$precision - 1]; } @@ -327,7 +335,7 @@ public function roundHalfEven(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number * * @return DecimalNumber */ - private function roundHalf(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $number, $precision, $halfwayValue) + private function roundHalf(DecimalNumber $number, $precision, $halfwayValue) { $precision = $this->sanitizePrecision($precision); if ($number->getPrecision() <= $precision) { @@ -361,12 +369,12 @@ private function roundHalf(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $n * * @return int Precision * - * @throws \InvalidArgumentException if precision is not a positive integer + * @throws InvalidArgumentException if precision is not a positive integer */ private function sanitizePrecision($precision) { - if (!\is_numeric($precision) || $precision < 0) { - throw new \InvalidArgumentException(\sprintf('Invalid precision: %s', \print_r($precision, \true))); + if (!is_numeric($precision) || $precision < 0) { + throw new InvalidArgumentException(sprintf('Invalid precision: %s', print_r($precision, true))); } return (int) $precision; } diff --git a/vendor/prestashop/decimal/src/Operation/Subtraction.php b/vendor/prestashop/decimal/src/Operation/Subtraction.php index 054ea3a32..057573e7e 100644 --- a/vendor/prestashop/decimal/src/Operation/Subtraction.php +++ b/vendor/prestashop/decimal/src/Operation/Subtraction.php @@ -9,6 +9,15 @@ namespace _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation; use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number as DecimalNumber; +use function function_exists; +use function max; +use function str_pad; +use function strlen; +use function strrev; +use const PHP_INT_MAX; +use const STR_PAD_LEFT; +use const STR_PAD_RIGHT; + /** * Computes the subtraction of two decimal numbers */ @@ -25,7 +34,7 @@ class Subtraction */ public function __construct() { - $this->maxSafeIntStringSize = \strlen((string) \PHP_INT_MAX) - 1; + $this->maxSafeIntStringSize = strlen((string) PHP_INT_MAX) - 1; } /** * Performs the subtraction @@ -35,9 +44,9 @@ public function __construct() * * @return DecimalNumber Result of the subtraction */ - public function compute(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $a, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $b) + public function compute(DecimalNumber $a, DecimalNumber $b) { - if (\function_exists('_PhpScoper5ea00cc67502b\\bcsub')) { + if (function_exists('_PhpScoper5ea00cc67502b\\bcsub')) { return $this->computeUsingBcMath($a, $b); } return $this->computeWithoutBcMath($a, $b); @@ -50,11 +59,11 @@ public function compute(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $a, \ * * @return DecimalNumber Result of the subtraction */ - public function computeUsingBcMath(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $a, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $b) + public function computeUsingBcMath(DecimalNumber $a, DecimalNumber $b) { $precision1 = $a->getPrecision(); $precision2 = $b->getPrecision(); - return new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number((string) bcsub($a, $b, \max($precision1, $precision2))); + return new DecimalNumber((string) bcsub($a, $b, max($precision1, $precision2))); } /** * Performs the subtraction without using BC Math @@ -64,7 +73,7 @@ public function computeUsingBcMath(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\N * * @return DecimalNumber Result of the subtraction */ - public function computeWithoutBcMath(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $a, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $b) + public function computeWithoutBcMath(DecimalNumber $a, DecimalNumber $b) { if ($a->isNegative()) { if ($b->isNegative()) { @@ -99,7 +108,7 @@ public function computeWithoutBcMath(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal return $a; } // pad coefficients with leading/trailing zeroes - list($coeff1, $coeff2) = $this->normalizeCoefficients($a, $b); + [$coeff1, $coeff2] = $this->normalizeCoefficients($a, $b); // compute the coefficient subtraction if ($a->isGreaterThan($b)) { $sub = $this->subtractStrings($coeff1, $coeff2); @@ -109,8 +118,8 @@ public function computeWithoutBcMath(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal $sign = '-'; } // keep the bigger exponent - $exponent = \max($a->getExponent(), $b->getExponent()); - return new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($sign . $sub, $exponent); + $exponent = max($a->getExponent(), $b->getExponent()); + return new DecimalNumber($sign . $sub, $exponent); } /** * Normalizes coefficients by adding leading or trailing zeroes as needed so that both are the same length @@ -120,7 +129,7 @@ public function computeWithoutBcMath(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal * * @return array An array containing the normalized coefficients */ - private function normalizeCoefficients(\_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $a, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number $b) + private function normalizeCoefficients(DecimalNumber $a, DecimalNumber $b) { $exp1 = $a->getExponent(); $exp2 = $b->getExponent(); @@ -128,17 +137,17 @@ private function normalizeCoefficients(\_PhpScoper5ea00cc67502b\PrestaShop\Decim $coeff2 = $b->getCoefficient(); // add trailing zeroes if needed if ($exp1 > $exp2) { - $coeff2 = \str_pad($coeff2, \strlen($coeff2) + $exp1 - $exp2, '0', \STR_PAD_RIGHT); + $coeff2 = str_pad($coeff2, strlen($coeff2) + $exp1 - $exp2, '0', STR_PAD_RIGHT); } elseif ($exp1 < $exp2) { - $coeff1 = \str_pad($coeff1, \strlen($coeff1) + $exp2 - $exp1, '0', \STR_PAD_RIGHT); + $coeff1 = str_pad($coeff1, strlen($coeff1) + $exp2 - $exp1, '0', STR_PAD_RIGHT); } - $len1 = \strlen($coeff1); - $len2 = \strlen($coeff2); + $len1 = strlen($coeff1); + $len2 = strlen($coeff2); // add leading zeroes if needed if ($len1 > $len2) { - $coeff2 = \str_pad($coeff2, $len1, '0', \STR_PAD_LEFT); + $coeff2 = str_pad($coeff2, $len1, '0', STR_PAD_LEFT); } elseif ($len1 < $len2) { - $coeff1 = \str_pad($coeff1, $len2, '0', \STR_PAD_LEFT); + $coeff1 = str_pad($coeff1, $len2, '0', STR_PAD_LEFT); } return [$coeff1, $coeff2]; } @@ -154,13 +163,13 @@ private function normalizeCoefficients(\_PhpScoper5ea00cc67502b\PrestaShop\Decim * * @return string */ - private function subtractStrings($number1, $number2, $fractional = \false) + private function subtractStrings($number1, $number2, $fractional = false) { // find out which of the strings is longest - $maxLength = \max(\strlen($number1), \strlen($number2)); + $maxLength = max(strlen($number1), strlen($number2)); // add leading or trailing zeroes as needed - $number1 = \str_pad($number1, $maxLength, '0', $fractional ? \STR_PAD_RIGHT : \STR_PAD_LEFT); - $number2 = \str_pad($number2, $maxLength, '0', $fractional ? \STR_PAD_RIGHT : \STR_PAD_LEFT); + $number1 = str_pad($number1, $maxLength, '0', $fractional ? STR_PAD_RIGHT : STR_PAD_LEFT); + $number2 = str_pad($number2, $maxLength, '0', $fractional ? STR_PAD_RIGHT : STR_PAD_LEFT); $result = ''; $carryOver = 0; for ($i = $maxLength - 1; 0 <= $i; $i--) { @@ -174,6 +183,6 @@ private function subtractStrings($number1, $number2, $fractional = \false) $carryOver = 1; } } - return \strrev($result); + return strrev($result); } } diff --git a/vendor/prestashop/decimal/tests/NumberTest.php b/vendor/prestashop/decimal/tests/NumberTest.php index 9b452f80c..cf98c5715 100644 --- a/vendor/prestashop/decimal/tests/NumberTest.php +++ b/vendor/prestashop/decimal/tests/NumberTest.php @@ -8,9 +8,13 @@ */ namespace _PhpScoper5ea00cc67502b\PrestaShop\Decimal\tests\Unit\Core\Decimal; +use _PhpScoper5ea00cc67502b\PHPUnit_Framework_TestCase; use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number; use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding; -class NumberTest extends \_PhpScoper5ea00cc67502b\PHPUnit_Framework_TestCase +use InvalidArgumentException; +use function sprintf; + +class NumberTest extends PHPUnit_Framework_TestCase { /** * Given a valid number in a string @@ -27,7 +31,7 @@ class NumberTest extends \_PhpScoper5ea00cc67502b\PHPUnit_Framework_TestCase */ public function testItInterpretsNumbers($number, $expectedSign, $expectedInteger, $expectedFraction, $expectedStr) { - $decimalNumber = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number); + $decimalNumber = new Number($number); $this->assertSame($expectedSign, $decimalNumber->getSign(), 'The sign is not as expected'); $this->assertSame($expectedInteger, $decimalNumber->getIntegerPart(), 'The integer part is not as expected'); $this->assertSame($expectedFraction, $decimalNumber->getFractionalPart(), 'The fraction part is not as expected'); @@ -46,7 +50,7 @@ public function testItInterpretsNumbers($number, $expectedSign, $expectedInteger */ public function testItInterpretsExponents($coefficient, $exponent, $expectedStr) { - $decimalNumber = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($coefficient, $exponent); + $decimalNumber = new Number($coefficient, $exponent); $this->assertSame($expectedStr, (string) $decimalNumber); } /** @@ -57,11 +61,11 @@ public function testItInterpretsExponents($coefficient, $exponent, $expectedStr) * @param mixed $number * * @dataProvider provideInvalidNumbers - * @expectedException \InvalidArgumentException + * @expectedException InvalidArgumentException */ public function testItThrowsExceptionWhenGivenInvalidNumber($number) { - new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number); + new Number($number); } /** * Given an invalid coefficient or exponent @@ -72,11 +76,11 @@ public function testItThrowsExceptionWhenGivenInvalidNumber($number) * @param mixed $exponent * * @dataProvider provideInvalidCoefficients - * @expectedException \InvalidArgumentException + * @expectedException InvalidArgumentException */ public function testItThrowsExceptionWhenGivenInvalidCoefficientOrExponent($coefficient, $exponent) { - new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($coefficient, $exponent); + new Number($coefficient, $exponent); } /** * Given a Number constructed with a valid number @@ -90,7 +94,7 @@ public function testItThrowsExceptionWhenGivenInvalidCoefficientOrExponent($coef */ public function testItDropsNonSignificantDigits($number, $expected) { - $decimalNumber = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number); + $decimalNumber = new Number($number); $this->assertSame($expected, (string) $decimalNumber); } /** @@ -107,7 +111,7 @@ public function testItDropsNonSignificantDigits($number, $expected) */ public function testPrecision($number, $precision, $mode, $expected) { - $decimalNumber = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number); + $decimalNumber = new Number($number); $this->assertSame($expected, (string) $decimalNumber->toPrecision($precision, $mode)); } /** @@ -124,7 +128,7 @@ public function testPrecision($number, $precision, $mode, $expected) */ public function testRounding($number, $precision, $mode, $expected) { - $decimalNumber = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number); + $decimalNumber = new Number($number); $this->assertSame($expected, (string) $decimalNumber->round($precision, $mode), "Failed to assert that round {$number} to {$precision} decimals = {$expected}"); } /** @@ -140,7 +144,7 @@ public function testRounding($number, $precision, $mode, $expected) */ public function testItExtendsPrecisionAsNeeded($number, $precision, $expected) { - $decimalNumber = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number); + $decimalNumber = new Number($number); $this->assertSame($expected, (string) $decimalNumber->toPrecision($precision), "Failed to assert that fixing {$number} to {$precision} decimals = {$expected}"); } /** @@ -156,7 +160,7 @@ public function testItExtendsPrecisionAsNeeded($number, $precision, $expected) */ public function testItIsAbleToTellIfEqual($number1, $number2, $expected) { - $this->assertSame($expected, $number1->equals($number2), \sprintf('Failed to assert equality between "%s" and "%s"', $number1, $number2)); + $this->assertSame($expected, $number1->equals($number2), sprintf('Failed to assert equality between "%s" and "%s"', $number1, $number2)); } /** * Given two numbers @@ -172,8 +176,8 @@ public function testItIsAbleToTellIfEqual($number1, $number2, $expected) public function testIsAbleToTellIfGreaterThan($number1, $number2, $expected) { $shouldBeGreater = 1 === $expected; - $number1 = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number1); - $number2 = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number2); + $number1 = new Number($number1); + $number2 = new Number($number2); $this->assertSame($number1->isGreaterThan($number2), $shouldBeGreater); } /** @@ -190,8 +194,8 @@ public function testIsAbleToTellIfGreaterThan($number1, $number2, $expected) public function testIsAbleToTellIfLowerThan($number1, $number2, $expected) { $shouldBeLower = -1 === $expected; - $number1 = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number1); - $number2 = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number2); + $number1 = new Number($number1); + $number2 = new Number($number2); $this->assertSame($number1->isLowerThan($number2), $shouldBeLower); } /** @@ -206,7 +210,7 @@ public function testIsAbleToTellIfLowerThan($number1, $number2, $expected) */ public function testItTransformsPositiveToNegative($number, $expected) { - $number = (new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number))->toNegative(); + $number = (new Number($number))->toNegative(); $this->assertSame((string) $number, $expected); } /** @@ -221,7 +225,7 @@ public function testItTransformsPositiveToNegative($number, $expected) */ public function testItTransformsNegativeToPositive($number, $expected) { - $number = (new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number))->toPositive(); + $number = (new Number($number))->toPositive(); $this->assertSame((string) $number, $expected); } public function provideValidNumbers() @@ -263,11 +267,11 @@ public function provideValidExponents() } public function provideInvalidNumbers() { - return ['bool false' => [\false], 'bool true' => [\true], 'empty string' => [''], 'NaN' => ['asd'], 'NaN with dot' => ['asd.foo'], 'NaN with comma' => ['asd,foo'], 'array' => [array()], 'null' => [null], '1.' => ['1.']]; + return ['bool false' => [false], 'bool true' => [true], 'empty string' => [''], 'NaN' => ['asd'], 'NaN with dot' => ['asd.foo'], 'NaN with comma' => ['asd,foo'], 'array' => [array()], 'null' => [null], '1.' => ['1.']]; } public function provideInvalidCoefficients() { - return ['bool false' => [\false, 0], 'bool true' => [\true, 0], 'empty string' => ['', 0], 'NaN' => ['asd', 0], 'NaN with dot' => ['asd.foo', 0], 'NaN with comma' => ['asd,foo', 0], 'array' => [array(), 0], 'null' => [null, 0], 'negative coefficient' => ['123', -5]]; + return ['bool false' => [false, 0], 'bool true' => [true, 0], 'empty string' => ['', 0], 'NaN' => ['asd', 0], 'NaN with dot' => ['asd.foo', 0], 'NaN with comma' => ['asd,foo', 0], 'array' => [array(), 0], 'null' => [null, 0], 'negative coefficient' => ['123', -5]]; } public function provideNumbersWithNonSignificantCharacters() { @@ -280,94 +284,94 @@ public function provideExtendedPrecisionTestCases() public function provideRoundingTestCases() { return [ - 'truncate 0' => ['1.23456789', 0, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1'], - 'truncate 1' => ['1.23456789', 1, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1.2'], - 'truncate 2' => ['1.23456789', 2, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1.23'], - 'truncate 3' => ['1.23456789', 3, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1.234'], - 'truncate 4' => ['1.23456789', 4, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1.2345'], - 'truncate 5' => ['1.23456789', 5, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1.23456'], - 'truncate 6' => ['1.23456789', 6, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1.234567'], - 'truncate 7' => ['1.23456789', 7, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1.2345678'], - 'truncate 8' => ['1.23456789', 8, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1.23456789'], + 'truncate 0' => ['1.23456789', 0, Rounding::ROUND_TRUNCATE, '1'], + 'truncate 1' => ['1.23456789', 1, Rounding::ROUND_TRUNCATE, '1.2'], + 'truncate 2' => ['1.23456789', 2, Rounding::ROUND_TRUNCATE, '1.23'], + 'truncate 3' => ['1.23456789', 3, Rounding::ROUND_TRUNCATE, '1.234'], + 'truncate 4' => ['1.23456789', 4, Rounding::ROUND_TRUNCATE, '1.2345'], + 'truncate 5' => ['1.23456789', 5, Rounding::ROUND_TRUNCATE, '1.23456'], + 'truncate 6' => ['1.23456789', 6, Rounding::ROUND_TRUNCATE, '1.234567'], + 'truncate 7' => ['1.23456789', 7, Rounding::ROUND_TRUNCATE, '1.2345678'], + 'truncate 8' => ['1.23456789', 8, Rounding::ROUND_TRUNCATE, '1.23456789'], // does not add trailing zeroes - 'truncate 9' => ['1.23456789', 9, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1.23456789'], - 'truncate 10' => ['1.23456789', 10, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1.23456789'], - 'truncate zeroes 1' => ['1.00000001', 3, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1'], - 'truncate zeroes 2' => ['1.00000001', 9, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1.00000001'], - 'ceil 0' => ['1.23456789', 0, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_CEIL, '2'], - 'ceil 1' => ['1.23456789', 1, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_CEIL, '1.3'], - 'ceil 2' => ['1.23456789', 2, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_CEIL, '1.24'], - 'ceil 3' => ['1.23456789', 3, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_CEIL, '1.235'], - 'ceil 4' => ['1.23456789', 4, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_CEIL, '1.2346'], - 'ceil 5' => ['1.23456789', 5, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_CEIL, '1.23457'], - 'ceil 6' => ['1.23456789', 6, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_CEIL, '1.234568'], - 'ceil 7' => ['1.23456789', 7, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_CEIL, '1.2345679'], - 'ceil 8' => ['1.23456789', 8, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_CEIL, '1.23456789'], + 'truncate 9' => ['1.23456789', 9, Rounding::ROUND_TRUNCATE, '1.23456789'], + 'truncate 10' => ['1.23456789', 10, Rounding::ROUND_TRUNCATE, '1.23456789'], + 'truncate zeroes 1' => ['1.00000001', 3, Rounding::ROUND_TRUNCATE, '1'], + 'truncate zeroes 2' => ['1.00000001', 9, Rounding::ROUND_TRUNCATE, '1.00000001'], + 'ceil 0' => ['1.23456789', 0, Rounding::ROUND_CEIL, '2'], + 'ceil 1' => ['1.23456789', 1, Rounding::ROUND_CEIL, '1.3'], + 'ceil 2' => ['1.23456789', 2, Rounding::ROUND_CEIL, '1.24'], + 'ceil 3' => ['1.23456789', 3, Rounding::ROUND_CEIL, '1.235'], + 'ceil 4' => ['1.23456789', 4, Rounding::ROUND_CEIL, '1.2346'], + 'ceil 5' => ['1.23456789', 5, Rounding::ROUND_CEIL, '1.23457'], + 'ceil 6' => ['1.23456789', 6, Rounding::ROUND_CEIL, '1.234568'], + 'ceil 7' => ['1.23456789', 7, Rounding::ROUND_CEIL, '1.2345679'], + 'ceil 8' => ['1.23456789', 8, Rounding::ROUND_CEIL, '1.23456789'], // does not add trailing zeroes - 'ceil 9' => ['1.23456789', 9, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_CEIL, '1.23456789'], - 'ceil 10' => ['1.23456789', 10, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_CEIL, '1.23456789'], - 'round half up 0' => ['1.23456789', 0, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_HALF_UP, '1'], - 'round half up 1' => ['1.23456789', 1, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_HALF_UP, '1.2'], - 'round half up 2' => ['1.23456789', 2, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_HALF_UP, '1.23'], - 'round half up 3' => ['1.23456789', 3, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_HALF_UP, '1.235'], - 'round half up 4' => ['1.23456789', 4, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_HALF_UP, '1.2346'], - 'round half up 5' => ['1.23456789', 5, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_HALF_UP, '1.23457'], - 'round half up 6' => ['1.23456789', 6, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_HALF_UP, '1.234568'], - 'round half up 7' => ['1.23456789', 7, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_HALF_UP, '1.2345679'], - 'round half up 8' => ['1.23456789', 8, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_HALF_UP, '1.23456789'], + 'ceil 9' => ['1.23456789', 9, Rounding::ROUND_CEIL, '1.23456789'], + 'ceil 10' => ['1.23456789', 10, Rounding::ROUND_CEIL, '1.23456789'], + 'round half up 0' => ['1.23456789', 0, Rounding::ROUND_HALF_UP, '1'], + 'round half up 1' => ['1.23456789', 1, Rounding::ROUND_HALF_UP, '1.2'], + 'round half up 2' => ['1.23456789', 2, Rounding::ROUND_HALF_UP, '1.23'], + 'round half up 3' => ['1.23456789', 3, Rounding::ROUND_HALF_UP, '1.235'], + 'round half up 4' => ['1.23456789', 4, Rounding::ROUND_HALF_UP, '1.2346'], + 'round half up 5' => ['1.23456789', 5, Rounding::ROUND_HALF_UP, '1.23457'], + 'round half up 6' => ['1.23456789', 6, Rounding::ROUND_HALF_UP, '1.234568'], + 'round half up 7' => ['1.23456789', 7, Rounding::ROUND_HALF_UP, '1.2345679'], + 'round half up 8' => ['1.23456789', 8, Rounding::ROUND_HALF_UP, '1.23456789'], // does not add trailing zeroes - 'round half up 9' => ['1.23456789', 9, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_HALF_UP, '1.23456789'], - 'round half up 10' => ['1.23456789', 10, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_HALF_UP, '1.23456789'], + 'round half up 9' => ['1.23456789', 9, Rounding::ROUND_HALF_UP, '1.23456789'], + 'round half up 10' => ['1.23456789', 10, Rounding::ROUND_HALF_UP, '1.23456789'], ]; } public function providePrecisionTestCases() { return [ - 'truncate 0' => ['1.23456789', 0, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1'], - 'truncate 1' => ['1.23456789', 1, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1.2'], - 'truncate 2' => ['1.23456789', 2, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1.23'], - 'truncate 3' => ['1.23456789', 3, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1.234'], - 'truncate 4' => ['1.23456789', 4, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1.2345'], - 'truncate 5' => ['1.23456789', 5, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1.23456'], - 'truncate 6' => ['1.23456789', 6, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1.234567'], - 'truncate 7' => ['1.23456789', 7, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1.2345678'], - 'truncate 8' => ['1.23456789', 8, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1.23456789'], + 'truncate 0' => ['1.23456789', 0, Rounding::ROUND_TRUNCATE, '1'], + 'truncate 1' => ['1.23456789', 1, Rounding::ROUND_TRUNCATE, '1.2'], + 'truncate 2' => ['1.23456789', 2, Rounding::ROUND_TRUNCATE, '1.23'], + 'truncate 3' => ['1.23456789', 3, Rounding::ROUND_TRUNCATE, '1.234'], + 'truncate 4' => ['1.23456789', 4, Rounding::ROUND_TRUNCATE, '1.2345'], + 'truncate 5' => ['1.23456789', 5, Rounding::ROUND_TRUNCATE, '1.23456'], + 'truncate 6' => ['1.23456789', 6, Rounding::ROUND_TRUNCATE, '1.234567'], + 'truncate 7' => ['1.23456789', 7, Rounding::ROUND_TRUNCATE, '1.2345678'], + 'truncate 8' => ['1.23456789', 8, Rounding::ROUND_TRUNCATE, '1.23456789'], // adds trailing zeroes - 'truncate 9' => ['1.23456789', 9, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1.234567890'], - 'truncate 10' => ['1.23456789', 10, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1.2345678900'], + 'truncate 9' => ['1.23456789', 9, Rounding::ROUND_TRUNCATE, '1.234567890'], + 'truncate 10' => ['1.23456789', 10, Rounding::ROUND_TRUNCATE, '1.2345678900'], // keeps trailing zeroes - 'truncate zeroes 1' => ['1.00000001', 3, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1.000'], - 'truncate zeroes 2' => ['1.00000001', 8, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, '1.00000001'], - 'ceil 0' => ['1.23456789', 0, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_CEIL, '2'], - 'ceil 1' => ['1.23456789', 1, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_CEIL, '1.3'], - 'ceil 2' => ['1.23456789', 2, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_CEIL, '1.24'], - 'ceil 3' => ['1.23456789', 3, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_CEIL, '1.235'], - 'ceil 4' => ['1.23456789', 4, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_CEIL, '1.2346'], - 'ceil 5' => ['1.23456789', 5, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_CEIL, '1.23457'], - 'ceil 6' => ['1.23456789', 6, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_CEIL, '1.234568'], - 'ceil 7' => ['1.23456789', 7, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_CEIL, '1.2345679'], - 'ceil 8' => ['1.23456789', 8, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_CEIL, '1.23456789'], - 'ceil zeroes' => ['1.00000001', 7, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_CEIL, '1.0000001'], + 'truncate zeroes 1' => ['1.00000001', 3, Rounding::ROUND_TRUNCATE, '1.000'], + 'truncate zeroes 2' => ['1.00000001', 8, Rounding::ROUND_TRUNCATE, '1.00000001'], + 'ceil 0' => ['1.23456789', 0, Rounding::ROUND_CEIL, '2'], + 'ceil 1' => ['1.23456789', 1, Rounding::ROUND_CEIL, '1.3'], + 'ceil 2' => ['1.23456789', 2, Rounding::ROUND_CEIL, '1.24'], + 'ceil 3' => ['1.23456789', 3, Rounding::ROUND_CEIL, '1.235'], + 'ceil 4' => ['1.23456789', 4, Rounding::ROUND_CEIL, '1.2346'], + 'ceil 5' => ['1.23456789', 5, Rounding::ROUND_CEIL, '1.23457'], + 'ceil 6' => ['1.23456789', 6, Rounding::ROUND_CEIL, '1.234568'], + 'ceil 7' => ['1.23456789', 7, Rounding::ROUND_CEIL, '1.2345679'], + 'ceil 8' => ['1.23456789', 8, Rounding::ROUND_CEIL, '1.23456789'], + 'ceil zeroes' => ['1.00000001', 7, Rounding::ROUND_CEIL, '1.0000001'], // adds trailing zeroes - 'ceil 9' => ['1.23456789', 9, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_CEIL, '1.234567890'], - 'ceil 10' => ['1.23456789', 10, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_CEIL, '1.2345678900'], - 'round half up 0' => ['1.23456789', 0, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_HALF_UP, '1'], - 'round half up 1' => ['1.23456789', 1, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_HALF_UP, '1.2'], - 'round half up 2' => ['1.23456789', 2, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_HALF_UP, '1.23'], - 'round half up 3' => ['1.23456789', 3, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_HALF_UP, '1.235'], - 'round half up 4' => ['1.23456789', 4, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_HALF_UP, '1.2346'], - 'round half up 5' => ['1.23456789', 5, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_HALF_UP, '1.23457'], - 'round half up 6' => ['1.23456789', 6, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_HALF_UP, '1.234568'], - 'round half up 7' => ['1.23456789', 7, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_HALF_UP, '1.2345679'], - 'round half up 8' => ['1.23456789', 8, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_HALF_UP, '1.23456789'], + 'ceil 9' => ['1.23456789', 9, Rounding::ROUND_CEIL, '1.234567890'], + 'ceil 10' => ['1.23456789', 10, Rounding::ROUND_CEIL, '1.2345678900'], + 'round half up 0' => ['1.23456789', 0, Rounding::ROUND_HALF_UP, '1'], + 'round half up 1' => ['1.23456789', 1, Rounding::ROUND_HALF_UP, '1.2'], + 'round half up 2' => ['1.23456789', 2, Rounding::ROUND_HALF_UP, '1.23'], + 'round half up 3' => ['1.23456789', 3, Rounding::ROUND_HALF_UP, '1.235'], + 'round half up 4' => ['1.23456789', 4, Rounding::ROUND_HALF_UP, '1.2346'], + 'round half up 5' => ['1.23456789', 5, Rounding::ROUND_HALF_UP, '1.23457'], + 'round half up 6' => ['1.23456789', 6, Rounding::ROUND_HALF_UP, '1.234568'], + 'round half up 7' => ['1.23456789', 7, Rounding::ROUND_HALF_UP, '1.2345679'], + 'round half up 8' => ['1.23456789', 8, Rounding::ROUND_HALF_UP, '1.23456789'], // adds trailing zeroes - 'round half up 9' => ['1.23456789', 9, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_HALF_UP, '1.234567890'], - 'round half up 10' => ['1.23456789', 10, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_HALF_UP, '1.2345678900'], + 'round half up 9' => ['1.23456789', 9, Rounding::ROUND_HALF_UP, '1.234567890'], + 'round half up 10' => ['1.23456789', 10, Rounding::ROUND_HALF_UP, '1.2345678900'], ]; } public function provideEqualityTestCases() { - return [[new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('0'), new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('0', 5), \true], [new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('0.1234'), new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('1234', 4), \true], [new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('1234.01'), new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('123401', 2), \true], [new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('-0'), new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('0'), \true], [new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('-1234.01'), new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('-123401', 2), \true], [new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('-1234.01'), new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('123401', 2), \false], [new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('1234.01'), new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('-123401', 2), \false], [new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('1234.01'), new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('-1234.01'), \false]]; + return [[new Number('0'), new Number('0', 5), true], [new Number('0.1234'), new Number('1234', 4), true], [new Number('1234.01'), new Number('123401', 2), true], [new Number('-0'), new Number('0'), true], [new Number('-1234.01'), new Number('-123401', 2), true], [new Number('-1234.01'), new Number('123401', 2), false], [new Number('1234.01'), new Number('-123401', 2), false], [new Number('1234.01'), new Number('-1234.01'), false]]; } public function provideComparisonTestCases() { diff --git a/vendor/prestashop/decimal/tests/Operation/AdditionTest.php b/vendor/prestashop/decimal/tests/Operation/AdditionTest.php index 13b9bc02a..bd6f2f410 100644 --- a/vendor/prestashop/decimal/tests/Operation/AdditionTest.php +++ b/vendor/prestashop/decimal/tests/Operation/AdditionTest.php @@ -8,9 +8,10 @@ */ namespace _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Test\Operation; +use _PhpScoper5ea00cc67502b\PHPUnit_Framework_TestCase; use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number; use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Addition; -class AdditionTest extends \_PhpScoper5ea00cc67502b\PHPUnit_Framework_TestCase +class AdditionTest extends PHPUnit_Framework_TestCase { /** * Given two decimal numbers @@ -25,9 +26,9 @@ class AdditionTest extends \_PhpScoper5ea00cc67502b\PHPUnit_Framework_TestCase */ public function testItAddsNumbers($number1, $number2, $expectedResult) { - $n1 = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number1); - $n2 = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number2); - $operation = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Addition(); + $n1 = new Number($number1); + $n2 = new Number($number2); + $operation = new Addition(); $result1 = $operation->computeUsingBcMath($n1, $n2); $result2 = $operation->computeWithoutBcMath($n1, $n2); $this->assertSame($expectedResult, (string) $result1, "Failed asserting {$number1} + {$number2} = {$expectedResult} (BC Math)"); diff --git a/vendor/prestashop/decimal/tests/Operation/ComparisonTest.php b/vendor/prestashop/decimal/tests/Operation/ComparisonTest.php index 31dd3eac0..14d3561e2 100644 --- a/vendor/prestashop/decimal/tests/Operation/ComparisonTest.php +++ b/vendor/prestashop/decimal/tests/Operation/ComparisonTest.php @@ -11,7 +11,9 @@ use _PhpScoper5ea00cc67502b\PHPUnit_Framework_TestCase; use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number; use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Comparison; -class ComparisonTest extends \_PhpScoper5ea00cc67502b\PHPUnit_Framework_TestCase +use function sprintf; + +class ComparisonTest extends PHPUnit_Framework_TestCase { /** * @var Number @@ -19,7 +21,7 @@ class ComparisonTest extends \_PhpScoper5ea00cc67502b\PHPUnit_Framework_TestCase private static $zero; public static function setUpBeforeClass() { - static::$zero = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('0'); + static::$zero = new Number('0'); } /** * Given two numbers @@ -37,9 +39,9 @@ public static function setUpBeforeClass() */ public function testItComparesNumbers($a, $b, $expected) { - $comparison = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Comparison(); - $result1 = $comparison->compareUsingBcMath(new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($a), new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($b)); - $result2 = $comparison->compareWithoutBcMath(new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($a), new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($b)); + $comparison = new Comparison(); + $result1 = $comparison->compareUsingBcMath(new Number($a), new Number($b)); + $result2 = $comparison->compareWithoutBcMath(new Number($a), new Number($b)); $this->assertSame($expected, $result1, "Failed assertion (BC Math)"); $this->assertSame($expected, $result2, "Failed assertion"); } @@ -84,14 +86,14 @@ public function provideCompareTestCases() */ public function testItDetectsEqualsZero($number, $expected) { - $n = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number); - $this->assertSame($expected, $n->equalsZero(), \sprintf("Failed to assert that %s %s equal to zero", $number, $this->getIsVerb($expected))); + $n = new Number($number); + $this->assertSame($expected, $n->equalsZero(), sprintf("Failed to assert that %s %s equal to zero", $number, $this->getIsVerb($expected))); // double check - $this->assertSame($expected, $n->equals(static::$zero), \sprintf("Failed to assert that %s %s equal to Number zero", $number, $this->getIsVerb($expected))); + $this->assertSame($expected, $n->equals(static::$zero), sprintf("Failed to assert that %s %s equal to Number zero", $number, $this->getIsVerb($expected))); } public function provideEqualsZeroTests() { - return [['0', \true], ['000000', \true], ['0.0000', \true], ['-0.0000', \true], ['0.0001', \false], ['-0.0001', \false], ['10', \false], ['10.0', \false], ['10.000001', \false], ['10.100001', \false], ['-10', \false], ['-10.0', \false], ['-10.000001', \false], ['-10.100001', \false]]; + return [['0', true], ['000000', true], ['0.0000', true], ['-0.0000', true], ['0.0001', false], ['-0.0001', false], ['10', false], ['10.0', false], ['10.000001', false], ['10.100001', false], ['-10', false], ['-10.0', false], ['-10.000001', false], ['-10.100001', false]]; } /** * Given a number @@ -104,14 +106,14 @@ public function provideEqualsZeroTests() */ public function testItDetectsGreaterThanZero($number, $expected) { - $n = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number); - $this->assertSame($expected, $n->isGreaterThanZero(), \sprintf("Failed to assert that %s %s greater than zero", $number, $this->getIsVerb($expected))); + $n = new Number($number); + $this->assertSame($expected, $n->isGreaterThanZero(), sprintf("Failed to assert that %s %s greater than zero", $number, $this->getIsVerb($expected))); // double check - $this->assertSame($expected, $n->isGreaterThan(static::$zero), \sprintf("Failed to assert that %s %s grater to Number zero", $number, $this->getIsVerb($expected))); + $this->assertSame($expected, $n->isGreaterThan(static::$zero), sprintf("Failed to assert that %s %s grater to Number zero", $number, $this->getIsVerb($expected))); } public function provideGreaterThanZeroTests() { - return [['0', \false], ['000000', \false], ['0.0000', \false], ['-0.0000', \false], ['0.0001', \true], ['-0.0001', \false], ['10', \true], ['10.0', \true], ['10.000001', \true], ['10.100001', \true], ['-10', \false], ['-10.0', \false], ['-10.000001', \false], ['-10.100001', \false]]; + return [['0', false], ['000000', false], ['0.0000', false], ['-0.0000', false], ['0.0001', true], ['-0.0001', false], ['10', true], ['10.0', true], ['10.000001', true], ['10.100001', true], ['-10', false], ['-10.0', false], ['-10.000001', false], ['-10.100001', false]]; } /** * Given a number @@ -124,14 +126,14 @@ public function provideGreaterThanZeroTests() */ public function testItDetectsGreaterOrEqualThanZero($number, $expected) { - $n = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number); - $this->assertSame($expected, $n->isGreaterOrEqualThanZero(), \sprintf("Failed to assert that %s %s greater or equal than zero", $number, $this->getIsVerb($expected))); + $n = new Number($number); + $this->assertSame($expected, $n->isGreaterOrEqualThanZero(), sprintf("Failed to assert that %s %s greater or equal than zero", $number, $this->getIsVerb($expected))); // double check - $this->assertSame($expected, $n->isGreaterOrEqualThan(static::$zero), \sprintf("Failed to assert that %s %s greater or equal to Number zero", $number, $this->getIsVerb($expected))); + $this->assertSame($expected, $n->isGreaterOrEqualThan(static::$zero), sprintf("Failed to assert that %s %s greater or equal to Number zero", $number, $this->getIsVerb($expected))); } public function provideGreaterOrEqualThanZeroTests() { - return [['0', \true], ['000000', \true], ['0.0000', \true], ['-0.0000', \true], ['0.0001', \true], ['-0.0001', \false], ['10', \true], ['10.0', \true], ['10.000001', \true], ['10.100001', \true], ['-10', \false], ['-10.0', \false], ['-10.000001', \false], ['-10.100001', \false]]; + return [['0', true], ['000000', true], ['0.0000', true], ['-0.0000', true], ['0.0001', true], ['-0.0001', false], ['10', true], ['10.0', true], ['10.000001', true], ['10.100001', true], ['-10', false], ['-10.0', false], ['-10.000001', false], ['-10.100001', false]]; } /** * Given a number @@ -144,14 +146,14 @@ public function provideGreaterOrEqualThanZeroTests() */ public function testItDetectsLowerThanZero($number, $expected) { - $n = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number); - $this->assertSame($expected, $n->isLowerThanZero(), \sprintf("Failed to assert that %s %s lower than zero", $number, $this->getIsVerb($expected))); + $n = new Number($number); + $this->assertSame($expected, $n->isLowerThanZero(), sprintf("Failed to assert that %s %s lower than zero", $number, $this->getIsVerb($expected))); // double check - $this->assertSame($expected, $n->isLowerThan(static::$zero), \sprintf("Failed to assert that %s %s lower to Number zero", $number, $this->getIsVerb($expected))); + $this->assertSame($expected, $n->isLowerThan(static::$zero), sprintf("Failed to assert that %s %s lower to Number zero", $number, $this->getIsVerb($expected))); } public function provideLowerThanZeroTests() { - return [['0', \false], ['000000', \false], ['0.0000', \false], ['-0.0000', \false], ['0.0001', \false], ['-0.0001', \true], ['10', \false], ['10.0', \false], ['10.000001', \false], ['10.100001', \false], ['-10', \true], ['-10.0', \true], ['-10.000001', \true], ['-10.100001', \true]]; + return [['0', false], ['000000', false], ['0.0000', false], ['-0.0000', false], ['0.0001', false], ['-0.0001', true], ['10', false], ['10.0', false], ['10.000001', false], ['10.100001', false], ['-10', true], ['-10.0', true], ['-10.000001', true], ['-10.100001', true]]; } /** * Given a number @@ -164,14 +166,14 @@ public function provideLowerThanZeroTests() */ public function testItDetectsLowerOrEqualThanZero($number, $expected) { - $n = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number); - $this->assertSame($expected, $n->isLowerOrEqualThanZero(), \sprintf("Failed to assert that %s %s lower or equal than zero", $number, $this->getIsVerb($expected))); + $n = new Number($number); + $this->assertSame($expected, $n->isLowerOrEqualThanZero(), sprintf("Failed to assert that %s %s lower or equal than zero", $number, $this->getIsVerb($expected))); // double check - $this->assertSame($expected, $n->isLowerOrEqualThan(static::$zero), \sprintf("Failed to assert that %s %s lower or equal to Number zero", $number, $this->getIsVerb($expected))); + $this->assertSame($expected, $n->isLowerOrEqualThan(static::$zero), sprintf("Failed to assert that %s %s lower or equal to Number zero", $number, $this->getIsVerb($expected))); } public function provideLowerOrEqualThanZeroTests() { - return [['0', \true], ['000000', \true], ['0.0000', \true], ['-0.0000', \true], ['0.0001', \false], ['-0.0001', \true], ['10', \false], ['10.0', \false], ['10.000001', \false], ['10.100001', \false], ['-10', \true], ['-10.0', \true], ['-10.000001', \true], ['-10.100001', \true]]; + return [['0', true], ['000000', true], ['0.0000', true], ['-0.0000', true], ['0.0001', false], ['-0.0001', true], ['10', false], ['10.0', false], ['10.000001', false], ['10.100001', false], ['-10', true], ['-10.0', true], ['-10.000001', true], ['-10.100001', true]]; } /** * @param bool $assertion diff --git a/vendor/prestashop/decimal/tests/Operation/DivisionTest.php b/vendor/prestashop/decimal/tests/Operation/DivisionTest.php index 2fc85e5aa..3919b6995 100644 --- a/vendor/prestashop/decimal/tests/Operation/DivisionTest.php +++ b/vendor/prestashop/decimal/tests/Operation/DivisionTest.php @@ -8,9 +8,10 @@ */ namespace _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Test\Operation; +use _PhpScoper5ea00cc67502b\PHPUnit_Framework_TestCase; use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number; use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Division; -class DivisionTest extends \_PhpScoper5ea00cc67502b\PHPUnit_Framework_TestCase +class DivisionTest extends PHPUnit_Framework_TestCase { /** * Given two decimal numbers @@ -25,9 +26,9 @@ class DivisionTest extends \_PhpScoper5ea00cc67502b\PHPUnit_Framework_TestCase */ public function testItDividesNumbers($number1, $number2, $expectedResult) { - $n1 = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number1); - $n2 = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number2); - $operation = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Division(); + $n1 = new Number($number1); + $n2 = new Number($number2); + $operation = new Division(); $result1 = $operation->computeUsingBcMath($n1, $n2, 20); $result2 = $operation->computeWithoutBcMath($n1, $n2, 20); $this->assertSame($expectedResult, (string) $result1, "Failed asserting {$number1} / {$number2} = {$expectedResult} (BC Math)"); @@ -42,7 +43,7 @@ public function testItDividesNumbers($number1, $number2, $expectedResult) */ public function testDivisionByZeroUsingBcMathThrowsException() { - (new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Division())->computeUsingBcMath(new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('1'), new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('0')); + (new Division())->computeUsingBcMath(new Number('1'), new Number('0')); } /** * Given a decimal number which is not zero @@ -53,7 +54,7 @@ public function testDivisionByZeroUsingBcMathThrowsException() */ public function testDivisionByZeroWithoutBcMathThrowsException() { - (new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Division())->computeWithoutBcMath(new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('1'), new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('0')); + (new Division())->computeWithoutBcMath(new Number('1'), new Number('0')); } public function provideNumbersToDivide() { diff --git a/vendor/prestashop/decimal/tests/Operation/MagnitudeChangeTest.php b/vendor/prestashop/decimal/tests/Operation/MagnitudeChangeTest.php index 1c6b7e165..3ffcecf01 100644 --- a/vendor/prestashop/decimal/tests/Operation/MagnitudeChangeTest.php +++ b/vendor/prestashop/decimal/tests/Operation/MagnitudeChangeTest.php @@ -8,9 +8,10 @@ */ namespace _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Test\Operation; +use _PhpScoper5ea00cc67502b\PHPUnit_Framework_TestCase; use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number; use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\MagnitudeChange; -class MagnitudeChangeTest extends \_PhpScoper5ea00cc67502b\PHPUnit_Framework_TestCase +class MagnitudeChangeTest extends PHPUnit_Framework_TestCase { /** * Given a decimal number @@ -26,8 +27,8 @@ class MagnitudeChangeTest extends \_PhpScoper5ea00cc67502b\PHPUnit_Framework_Tes */ public function testItChangesMagnitude($number, $exponent, $expected) { - $n = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number); - $result = (new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\MagnitudeChange())->compute($n, $exponent); + $n = new Number($number); + $result = (new MagnitudeChange())->compute($n, $exponent); $this->assertSame($expected, (string) $result); } public function provideTestCases() diff --git a/vendor/prestashop/decimal/tests/Operation/MultiplicationTest.php b/vendor/prestashop/decimal/tests/Operation/MultiplicationTest.php index d910cd6bf..d16202778 100644 --- a/vendor/prestashop/decimal/tests/Operation/MultiplicationTest.php +++ b/vendor/prestashop/decimal/tests/Operation/MultiplicationTest.php @@ -8,9 +8,10 @@ */ namespace _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Test\Operation; +use _PhpScoper5ea00cc67502b\PHPUnit_Framework_TestCase; use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number; use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Multiplication; -class MultiplicationTest extends \_PhpScoper5ea00cc67502b\PHPUnit_Framework_TestCase +class MultiplicationTest extends PHPUnit_Framework_TestCase { /** * Given two decimal numbers @@ -25,9 +26,9 @@ class MultiplicationTest extends \_PhpScoper5ea00cc67502b\PHPUnit_Framework_Test */ public function testItMultipliesNumbers($number1, $number2, $expectedResult) { - $n1 = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number1); - $n2 = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number2); - $operation = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Multiplication(); + $n1 = new Number($number1); + $n2 = new Number($number2); + $operation = new Multiplication(); $result1 = $operation->computeUsingBcMath($n1, $n2); $result2 = $operation->computeWithoutBcMath($n1, $n2); $this->assertSame($expectedResult, (string) $result1, "Failed asserting {$number1} * {$number2} = {$expectedResult} (BC Math)"); diff --git a/vendor/prestashop/decimal/tests/Operation/RoundingTest.php b/vendor/prestashop/decimal/tests/Operation/RoundingTest.php index db37a3003..5179fedf6 100644 --- a/vendor/prestashop/decimal/tests/Operation/RoundingTest.php +++ b/vendor/prestashop/decimal/tests/Operation/RoundingTest.php @@ -8,21 +8,24 @@ */ namespace _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Test\Operation; +use _PhpScoper5ea00cc67502b\PHPUnit_Framework_TestCase; use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding; use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number; -class RoundingTest extends \_PhpScoper5ea00cc67502b\PHPUnit_Framework_TestCase +use InvalidArgumentException; + +class RoundingTest extends PHPUnit_Framework_TestCase { /** * Given decimal number * When rounding it using an undefined rounding mode * An InvalidArgumentException should be thrown * - * @expectedException \InvalidArgumentException + * @expectedException InvalidArgumentException */ public function testItThrowsExceptionIfRoundingModeIsInvalid() { - $decimalNumber = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('1.2345'); - $rounding = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding(); + $decimalNumber = new Number('1.2345'); + $rounding = new Rounding(); $rounding->compute($decimalNumber, 2, 'foobar'); } /** @@ -32,15 +35,15 @@ public function testItThrowsExceptionIfRoundingModeIsInvalid() * * @param mixed $precision * - * @expectedException \InvalidArgumentException + * @expectedException InvalidArgumentException * * @dataProvider provideInvalidPrecision */ public function testItThrowsExceptionIfPrecisionIsInvalid($precision) { - $decimalNumber = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number('1.2345'); - $rounding = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding(); - $rounding->compute($decimalNumber, $precision, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_FLOOR); + $decimalNumber = new Number('1.2345'); + $rounding = new Rounding(); + $rounding->compute($decimalNumber, $precision, Rounding::ROUND_FLOOR); } /** * Given a decimal number @@ -55,7 +58,7 @@ public function testItThrowsExceptionIfPrecisionIsInvalid($precision) */ public function testItTruncatesNumbers($number, $precision, $expected) { - $this->roundNumber($number, $precision, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_TRUNCATE, $expected); + $this->roundNumber($number, $precision, Rounding::ROUND_TRUNCATE, $expected); } /** * Given a decimal number @@ -71,7 +74,7 @@ public function testItTruncatesNumbers($number, $precision, $expected) */ public function testItPerformsCeilRounding($number, $precision, $expected) { - $this->roundNumber($number, $precision, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_CEIL, $expected); + $this->roundNumber($number, $precision, Rounding::ROUND_CEIL, $expected); } /** * Given a decimal number @@ -87,7 +90,7 @@ public function testItPerformsCeilRounding($number, $precision, $expected) */ public function testItPerformsFloorRounding($number, $precision, $expected) { - $this->roundNumber($number, $precision, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_FLOOR, $expected); + $this->roundNumber($number, $precision, Rounding::ROUND_FLOOR, $expected); } /** * Given a decimal number @@ -106,7 +109,7 @@ public function testItPerformsFloorRounding($number, $precision, $expected) */ public function testItPerformsHalfUpRounding($number, $precision, $expected) { - $this->roundNumber($number, $precision, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_HALF_UP, $expected); + $this->roundNumber($number, $precision, Rounding::ROUND_HALF_UP, $expected); } /** * Given a decimal number @@ -125,7 +128,7 @@ public function testItPerformsHalfUpRounding($number, $precision, $expected) */ public function testItPerformsHalfDownRounding($number, $precision, $expected) { - $this->roundNumber($number, $precision, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_HALF_DOWN, $expected); + $this->roundNumber($number, $precision, Rounding::ROUND_HALF_DOWN, $expected); } /** * Given a decimal number @@ -148,7 +151,7 @@ public function testItPerformsHalfDownRounding($number, $precision, $expected) */ public function testItPerformsHalfEvenRounding($number, $precision, $expected) { - $this->roundNumber($number, $precision, \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding::ROUND_HALF_EVEN, $expected); + $this->roundNumber($number, $precision, Rounding::ROUND_HALF_EVEN, $expected); } /** * Test rounding a number to a target precision using a specific rounding mode. @@ -169,8 +172,8 @@ public function testItPerformsHalfEvenRounding($number, $precision, $expected) */ public function roundNumber($number, $precision, $mode, $expected) { - $decimalNumber = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number); - $rounding = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Rounding(); + $decimalNumber = new Number($number); + $rounding = new Rounding(); $result = $rounding->compute($decimalNumber, $precision, $mode); $this->assertSame($expected, (string) $result); } @@ -378,6 +381,6 @@ public function provideHalfEvenTestCases() } public function provideInvalidPrecision() { - return [[-1], ['foo'], [\true], [array()]]; + return [[-1], ['foo'], [true], [array()]]; } } diff --git a/vendor/prestashop/decimal/tests/Operation/SubtractionTest.php b/vendor/prestashop/decimal/tests/Operation/SubtractionTest.php index 0b0e78aa3..539dbec9a 100644 --- a/vendor/prestashop/decimal/tests/Operation/SubtractionTest.php +++ b/vendor/prestashop/decimal/tests/Operation/SubtractionTest.php @@ -8,9 +8,10 @@ */ namespace _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Test\Operation; +use _PhpScoper5ea00cc67502b\PHPUnit_Framework_TestCase; use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number; use _PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Subtraction; -class SubtractionTest extends \_PhpScoper5ea00cc67502b\PHPUnit_Framework_TestCase +class SubtractionTest extends PHPUnit_Framework_TestCase { /** * Given two decimal numbers @@ -25,9 +26,9 @@ class SubtractionTest extends \_PhpScoper5ea00cc67502b\PHPUnit_Framework_TestCas */ public function testItSubtractsNumbers($number1, $number2, $expectedResult) { - $n1 = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number1); - $n2 = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Number($number2); - $operation = new \_PhpScoper5ea00cc67502b\PrestaShop\Decimal\Operation\Subtraction(); + $n1 = new Number($number1); + $n2 = new Number($number2); + $operation = new Subtraction(); $result1 = $operation->computeUsingBcMath($n1, $n2); $result2 = $operation->computeWithoutBcMath($n1, $n2); $this->assertSame($expectedResult, (string) $result1, "Failed asserting {$number1} - {$number2} = {$expectedResult} (BC Math)"); diff --git a/vendor/psr/cache/index.php b/vendor/psr/cache/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/psr/cache/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/psr/cache/src/CacheItemInterface.php b/vendor/psr/cache/src/CacheItemInterface.php index 3a14a61ed..112150c91 100644 --- a/vendor/psr/cache/src/CacheItemInterface.php +++ b/vendor/psr/cache/src/CacheItemInterface.php @@ -2,6 +2,9 @@ namespace _PhpScoper5ea00cc67502b\Psr\Cache; +use DateInterval; +use DateTimeInterface; + /** * CacheItemInterface defines an interface for interacting with objects inside a cache. * @@ -73,7 +76,7 @@ public function set($value); /** * Sets the expiration time for this cache item. * - * @param \DateTimeInterface|null $expiration + * @param DateTimeInterface|null $expiration * The point in time after which the item MUST be considered expired. * If null is passed explicitly, a default value MAY be used. If none is set, * the value should be stored permanently or for as long as the @@ -86,7 +89,7 @@ public function expiresAt($expiration); /** * Sets the expiration time for this cache item. * - * @param int|\DateInterval|null $time + * @param int|DateInterval|null $time * The period of time from the present after which the item MUST be considered * expired. An integer parameter is understood to be the time in seconds until * expiration. If null is passed explicitly, a default value MAY be used. diff --git a/vendor/psr/cache/src/CacheItemPoolInterface.php b/vendor/psr/cache/src/CacheItemPoolInterface.php index 17fd8e798..4c49d4ded 100644 --- a/vendor/psr/cache/src/CacheItemPoolInterface.php +++ b/vendor/psr/cache/src/CacheItemPoolInterface.php @@ -2,6 +2,8 @@ namespace _PhpScoper5ea00cc67502b\Psr\Cache; +use Traversable; + /** * CacheItemPoolInterface generates CacheItemInterface objects. * @@ -36,15 +38,15 @@ public function getItem($key); * @param string[] $keys * An indexed array of keys of items to retrieve. * - * @throws InvalidArgumentException - * If any of the keys in $keys are not a legal value a \Psr\Cache\InvalidArgumentException - * MUST be thrown. - * - * @return array|\Traversable + * @return array|Traversable * A traversable collection of Cache Items keyed by the cache keys of * each item. A Cache item will be returned for each key, even if that * key is not found. However, if no keys are specified then an empty * traversable MUST be returned instead. + *@throws InvalidArgumentException + * If any of the keys in $keys are not a legal value a \Psr\Cache\InvalidArgumentException + * MUST be thrown. + * */ public function getItems(array $keys = array()); /** @@ -108,7 +110,7 @@ public function deleteItems(array $keys); * @return bool * True if the item was successfully persisted. False if there was an error. */ - public function save(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item); + public function save(CacheItemInterface $item); /** * Sets a cache item to be persisted later. * @@ -118,7 +120,7 @@ public function save(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item * @return bool * False if the item could not be queued or if a commit was attempted and failed. True otherwise. */ - public function saveDeferred(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item); + public function saveDeferred(CacheItemInterface $item); /** * Persists any deferred cache items. * diff --git a/vendor/psr/cache/src/InvalidArgumentException.php b/vendor/psr/cache/src/InvalidArgumentException.php index cddb9acd9..6da9ae0cb 100644 --- a/vendor/psr/cache/src/InvalidArgumentException.php +++ b/vendor/psr/cache/src/InvalidArgumentException.php @@ -8,6 +8,6 @@ * Any time an invalid argument is passed into a method it must throw an * exception class which implements Psr\Cache\InvalidArgumentException. */ -interface InvalidArgumentException extends \_PhpScoper5ea00cc67502b\Psr\Cache\CacheException +interface InvalidArgumentException extends CacheException { } diff --git a/vendor/psr/cache/src/index.php b/vendor/psr/cache/src/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/psr/cache/src/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/psr/container/index.php b/vendor/psr/container/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/psr/container/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/psr/container/src/NotFoundExceptionInterface.php b/vendor/psr/container/src/NotFoundExceptionInterface.php index f205339db..7ec53b989 100644 --- a/vendor/psr/container/src/NotFoundExceptionInterface.php +++ b/vendor/psr/container/src/NotFoundExceptionInterface.php @@ -8,6 +8,6 @@ /** * No entry was found in the container. */ -interface NotFoundExceptionInterface extends \_PhpScoper5ea00cc67502b\Psr\Container\ContainerExceptionInterface +interface NotFoundExceptionInterface extends ContainerExceptionInterface { } diff --git a/vendor/psr/container/src/index.php b/vendor/psr/container/src/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/psr/container/src/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/psr/http-message/index.php b/vendor/psr/http-message/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/psr/http-message/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/psr/http-message/src/MessageInterface.php b/vendor/psr/http-message/src/MessageInterface.php index f3aecc897..63a2a7882 100644 --- a/vendor/psr/http-message/src/MessageInterface.php +++ b/vendor/psr/http-message/src/MessageInterface.php @@ -2,6 +2,8 @@ namespace _PhpScoper5ea00cc67502b\Psr\Http\Message; +use InvalidArgumentException; + /** * HTTP messages consist of requests from a client to a server and responses * from a server to a client. This interface defines the methods common to @@ -121,7 +123,7 @@ public function getHeaderLine($name); * @param string $name Case-insensitive header field name. * @param string|string[] $value Header value(s). * @return static - * @throws \InvalidArgumentException for invalid header names or values. + * @throws InvalidArgumentException for invalid header names or values. */ public function withHeader($name, $value); /** @@ -138,7 +140,7 @@ public function withHeader($name, $value); * @param string $name Case-insensitive header field name to add. * @param string|string[] $value Header value(s). * @return static - * @throws \InvalidArgumentException for invalid header names or values. + * @throws InvalidArgumentException for invalid header names or values. */ public function withAddedHeader($name, $value); /** @@ -171,7 +173,7 @@ public function getBody(); * * @param StreamInterface $body Body. * @return static - * @throws \InvalidArgumentException When the body is not valid. + * @throws InvalidArgumentException When the body is not valid. */ - public function withBody(\_PhpScoper5ea00cc67502b\Psr\Http\Message\StreamInterface $body); + public function withBody(StreamInterface $body); } diff --git a/vendor/psr/http-message/src/RequestInterface.php b/vendor/psr/http-message/src/RequestInterface.php index b33ba6140..c8a7992b5 100644 --- a/vendor/psr/http-message/src/RequestInterface.php +++ b/vendor/psr/http-message/src/RequestInterface.php @@ -2,6 +2,8 @@ namespace _PhpScoper5ea00cc67502b\Psr\Http\Message; +use InvalidArgumentException; + /** * Representation of an outgoing, client-side request. * @@ -21,7 +23,7 @@ * be implemented such that they retain the internal state of the current * message and return an instance that contains the changed state. */ -interface RequestInterface extends \_PhpScoper5ea00cc67502b\Psr\Http\Message\MessageInterface +interface RequestInterface extends MessageInterface { /** * Retrieves the message's request target. @@ -77,7 +79,7 @@ public function getMethod(); * * @param string $method Case-sensitive method. * @return static - * @throws \InvalidArgumentException for invalid HTTP methods. + * @throws InvalidArgumentException for invalid HTTP methods. */ public function withMethod($method); /** @@ -120,5 +122,5 @@ public function getUri(); * @param bool $preserveHost Preserve the original state of the Host header. * @return static */ - public function withUri(\_PhpScoper5ea00cc67502b\Psr\Http\Message\UriInterface $uri, $preserveHost = \false); + public function withUri(UriInterface $uri, $preserveHost = false); } diff --git a/vendor/psr/http-message/src/ResponseInterface.php b/vendor/psr/http-message/src/ResponseInterface.php index eefb65b7f..ab388cdb7 100644 --- a/vendor/psr/http-message/src/ResponseInterface.php +++ b/vendor/psr/http-message/src/ResponseInterface.php @@ -2,6 +2,8 @@ namespace _PhpScoper5ea00cc67502b\Psr\Http\Message; +use InvalidArgumentException; + /** * Representation of an outgoing, server-side response. * @@ -17,7 +19,7 @@ * be implemented such that they retain the internal state of the current * message and return an instance that contains the changed state. */ -interface ResponseInterface extends \_PhpScoper5ea00cc67502b\Psr\Http\Message\MessageInterface +interface ResponseInterface extends MessageInterface { /** * Gets the response status code. @@ -46,7 +48,7 @@ public function getStatusCode(); * provided status code; if none is provided, implementations MAY * use the defaults as suggested in the HTTP specification. * @return static - * @throws \InvalidArgumentException For invalid status code arguments. + * @throws InvalidArgumentException For invalid status code arguments. */ public function withStatus($code, $reasonPhrase = ''); /** diff --git a/vendor/psr/http-message/src/ServerRequestInterface.php b/vendor/psr/http-message/src/ServerRequestInterface.php index 2343dff0f..549c6d68c 100644 --- a/vendor/psr/http-message/src/ServerRequestInterface.php +++ b/vendor/psr/http-message/src/ServerRequestInterface.php @@ -2,6 +2,8 @@ namespace _PhpScoper5ea00cc67502b\Psr\Http\Message; +use InvalidArgumentException; + /** * Representation of an incoming, server-side HTTP request. * @@ -40,7 +42,7 @@ * be implemented such that they retain the internal state of the current * message and return an instance that contains the changed state. */ -interface ServerRequestInterface extends \_PhpScoper5ea00cc67502b\Psr\Http\Message\RequestInterface +interface ServerRequestInterface extends RequestInterface { /** * Retrieve server parameters. @@ -139,7 +141,7 @@ public function getUploadedFiles(); * * @param array $uploadedFiles An array tree of UploadedFileInterface instances. * @return static - * @throws \InvalidArgumentException if an invalid structure is provided. + * @throws InvalidArgumentException if an invalid structure is provided. */ public function withUploadedFiles(array $uploadedFiles); /** @@ -183,7 +185,7 @@ public function getParsedBody(); * @param null|array|object $data The deserialized body data. This will * typically be in an array or object. * @return static - * @throws \InvalidArgumentException if an unsupported argument type is + * @throws InvalidArgumentException if an unsupported argument type is * provided. */ public function withParsedBody($data); diff --git a/vendor/psr/http-message/src/StreamInterface.php b/vendor/psr/http-message/src/StreamInterface.php index 28a5034d9..964b4b2a1 100644 --- a/vendor/psr/http-message/src/StreamInterface.php +++ b/vendor/psr/http-message/src/StreamInterface.php @@ -2,6 +2,9 @@ namespace _PhpScoper5ea00cc67502b\Psr\Http\Message; +use RuntimeException; +use const SEEK_SET; + /** * Describes a data stream. * @@ -50,7 +53,7 @@ public function getSize(); * Returns the current position of the file read/write pointer * * @return int Position of the file pointer - * @throws \RuntimeException on error. + * @throws RuntimeException on error. */ public function tell(); /** @@ -75,9 +78,9 @@ public function isSeekable(); * PHP $whence values for `fseek()`. SEEK_SET: Set position equal to * offset bytes SEEK_CUR: Set position to current location plus offset * SEEK_END: Set position to end-of-stream plus offset. - * @throws \RuntimeException on failure. + * @throws RuntimeException on failure. */ - public function seek($offset, $whence = \SEEK_SET); + public function seek($offset, $whence = SEEK_SET); /** * Seek to the beginning of the stream. * @@ -86,7 +89,7 @@ public function seek($offset, $whence = \SEEK_SET); * * @see seek() * @link http://www.php.net/manual/en/function.fseek.php - * @throws \RuntimeException on failure. + * @throws RuntimeException on failure. */ public function rewind(); /** @@ -100,7 +103,7 @@ public function isWritable(); * * @param string $string The string that is to be written. * @return int Returns the number of bytes written to the stream. - * @throws \RuntimeException on failure. + * @throws RuntimeException on failure. */ public function write($string); /** @@ -117,14 +120,14 @@ public function isReadable(); * call returns fewer bytes. * @return string Returns the data read from the stream, or an empty string * if no bytes are available. - * @throws \RuntimeException if an error occurs. + * @throws RuntimeException if an error occurs. */ public function read($length); /** * Returns the remaining contents in a string * * @return string - * @throws \RuntimeException if unable to read or an error occurs while + * @throws RuntimeException if unable to read or an error occurs while * reading. */ public function getContents(); diff --git a/vendor/psr/http-message/src/UploadedFileInterface.php b/vendor/psr/http-message/src/UploadedFileInterface.php index 45c2f61b3..00f60fd5b 100644 --- a/vendor/psr/http-message/src/UploadedFileInterface.php +++ b/vendor/psr/http-message/src/UploadedFileInterface.php @@ -2,6 +2,9 @@ namespace _PhpScoper5ea00cc67502b\Psr\Http\Message; +use InvalidArgumentException; +use RuntimeException; + /** * Value object representing a file uploaded through an HTTP request. * @@ -25,7 +28,7 @@ interface UploadedFileInterface * an exception. * * @return StreamInterface Stream representation of the uploaded file. - * @throws \RuntimeException in cases when no stream is available or can be + * @throws RuntimeException in cases when no stream is available or can be * created. */ public function getStream(); @@ -57,8 +60,8 @@ public function getStream(); * @see http://php.net/is_uploaded_file * @see http://php.net/move_uploaded_file * @param string $targetPath Path to which to move the uploaded file. - * @throws \InvalidArgumentException if the $targetPath specified is invalid. - * @throws \RuntimeException on any error during the move operation, or on + * @throws InvalidArgumentException if the $targetPath specified is invalid. + * @throws RuntimeException on any error during the move operation, or on * the second or subsequent call to the method. */ public function moveTo($targetPath); diff --git a/vendor/psr/http-message/src/UriInterface.php b/vendor/psr/http-message/src/UriInterface.php index 477376ef4..a89f8ce5d 100644 --- a/vendor/psr/http-message/src/UriInterface.php +++ b/vendor/psr/http-message/src/UriInterface.php @@ -2,6 +2,8 @@ namespace _PhpScoper5ea00cc67502b\Psr\Http\Message; +use InvalidArgumentException; + /** * Value object representing a URI. * @@ -179,7 +181,7 @@ public function getFragment(); * * @param string $scheme The scheme to use with the new instance. * @return static A new instance with the specified scheme. - * @throws \InvalidArgumentException for invalid or unsupported schemes. + * @throws InvalidArgumentException for invalid or unsupported schemes. */ public function withScheme($scheme); /** @@ -207,7 +209,7 @@ public function withUserInfo($user, $password = null); * * @param string $host The hostname to use with the new instance. * @return static A new instance with the specified host. - * @throws \InvalidArgumentException for invalid hostnames. + * @throws InvalidArgumentException for invalid hostnames. */ public function withHost($host); /** @@ -225,7 +227,7 @@ public function withHost($host); * @param null|int $port The port to use with the new instance; a null value * removes the port information. * @return static A new instance with the specified port. - * @throws \InvalidArgumentException for invalid ports. + * @throws InvalidArgumentException for invalid ports. */ public function withPort($port); /** @@ -248,7 +250,7 @@ public function withPort($port); * * @param string $path The path to use with the new instance. * @return static A new instance with the specified path. - * @throws \InvalidArgumentException for invalid paths. + * @throws InvalidArgumentException for invalid paths. */ public function withPath($path); /** @@ -264,7 +266,7 @@ public function withPath($path); * * @param string $query The query string to use with the new instance. * @return static A new instance with the specified query string. - * @throws \InvalidArgumentException for invalid query strings. + * @throws InvalidArgumentException for invalid query strings. */ public function withQuery($query); /** diff --git a/vendor/psr/http-message/src/index.php b/vendor/psr/http-message/src/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/psr/http-message/src/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/psr/index.php b/vendor/psr/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/psr/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/psr/log/Psr/Log/AbstractLogger.php b/vendor/psr/log/Psr/Log/AbstractLogger.php index 7337524ac..ded33a1b8 100644 --- a/vendor/psr/log/Psr/Log/AbstractLogger.php +++ b/vendor/psr/log/Psr/Log/AbstractLogger.php @@ -9,7 +9,7 @@ * reduce boilerplate code that a simple Logger that does the same thing with * messages regardless of the error level has to implement. */ -abstract class AbstractLogger implements \_PhpScoper5ea00cc67502b\Psr\Log\LoggerInterface +abstract class AbstractLogger implements LoggerInterface { /** * System is unusable. @@ -21,7 +21,7 @@ abstract class AbstractLogger implements \_PhpScoper5ea00cc67502b\Psr\Log\Logger */ public function emergency($message, array $context = array()) { - $this->log(\_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::EMERGENCY, $message, $context); + $this->log(LogLevel::EMERGENCY, $message, $context); } /** * Action must be taken immediately. @@ -36,7 +36,7 @@ public function emergency($message, array $context = array()) */ public function alert($message, array $context = array()) { - $this->log(\_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::ALERT, $message, $context); + $this->log(LogLevel::ALERT, $message, $context); } /** * Critical conditions. @@ -50,7 +50,7 @@ public function alert($message, array $context = array()) */ public function critical($message, array $context = array()) { - $this->log(\_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::CRITICAL, $message, $context); + $this->log(LogLevel::CRITICAL, $message, $context); } /** * Runtime errors that do not require immediate action but should typically @@ -63,7 +63,7 @@ public function critical($message, array $context = array()) */ public function error($message, array $context = array()) { - $this->log(\_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::ERROR, $message, $context); + $this->log(LogLevel::ERROR, $message, $context); } /** * Exceptional occurrences that are not errors. @@ -78,7 +78,7 @@ public function error($message, array $context = array()) */ public function warning($message, array $context = array()) { - $this->log(\_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::WARNING, $message, $context); + $this->log(LogLevel::WARNING, $message, $context); } /** * Normal but significant events. @@ -90,7 +90,7 @@ public function warning($message, array $context = array()) */ public function notice($message, array $context = array()) { - $this->log(\_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::NOTICE, $message, $context); + $this->log(LogLevel::NOTICE, $message, $context); } /** * Interesting events. @@ -104,7 +104,7 @@ public function notice($message, array $context = array()) */ public function info($message, array $context = array()) { - $this->log(\_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::INFO, $message, $context); + $this->log(LogLevel::INFO, $message, $context); } /** * Detailed debug information. @@ -116,6 +116,6 @@ public function info($message, array $context = array()) */ public function debug($message, array $context = array()) { - $this->log(\_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::DEBUG, $message, $context); + $this->log(LogLevel::DEBUG, $message, $context); } } diff --git a/vendor/psr/log/Psr/Log/LoggerAwareInterface.php b/vendor/psr/log/Psr/Log/LoggerAwareInterface.php index b9d495fe7..e46e33ec7 100644 --- a/vendor/psr/log/Psr/Log/LoggerAwareInterface.php +++ b/vendor/psr/log/Psr/Log/LoggerAwareInterface.php @@ -1,4 +1,37 @@ + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ namespace _PhpScoper5ea00cc67502b\Psr\Log; @@ -14,5 +47,5 @@ interface LoggerAwareInterface * * @return void */ - public function setLogger(\_PhpScoper5ea00cc67502b\Psr\Log\LoggerInterface $logger); + public function setLogger(LoggerInterface $logger); } diff --git a/vendor/psr/log/Psr/Log/LoggerAwareTrait.php b/vendor/psr/log/Psr/Log/LoggerAwareTrait.php index 9edadca01..9bbcacbd3 100644 --- a/vendor/psr/log/Psr/Log/LoggerAwareTrait.php +++ b/vendor/psr/log/Psr/Log/LoggerAwareTrait.php @@ -1,4 +1,37 @@ + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ namespace _PhpScoper5ea00cc67502b\Psr\Log; @@ -18,7 +51,7 @@ trait LoggerAwareTrait * * @param LoggerInterface $logger */ - public function setLogger(\_PhpScoper5ea00cc67502b\Psr\Log\LoggerInterface $logger) + public function setLogger(LoggerInterface $logger) { $this->logger = $logger; } diff --git a/vendor/psr/log/Psr/Log/LoggerTrait.php b/vendor/psr/log/Psr/Log/LoggerTrait.php index 90f7a7a50..b9204df95 100644 --- a/vendor/psr/log/Psr/Log/LoggerTrait.php +++ b/vendor/psr/log/Psr/Log/LoggerTrait.php @@ -22,7 +22,7 @@ trait LoggerTrait */ public function emergency($message, array $context = array()) { - $this->log(\_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::EMERGENCY, $message, $context); + $this->log(LogLevel::EMERGENCY, $message, $context); } /** * Action must be taken immediately. @@ -37,7 +37,7 @@ public function emergency($message, array $context = array()) */ public function alert($message, array $context = array()) { - $this->log(\_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::ALERT, $message, $context); + $this->log(LogLevel::ALERT, $message, $context); } /** * Critical conditions. @@ -51,7 +51,7 @@ public function alert($message, array $context = array()) */ public function critical($message, array $context = array()) { - $this->log(\_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::CRITICAL, $message, $context); + $this->log(LogLevel::CRITICAL, $message, $context); } /** * Runtime errors that do not require immediate action but should typically @@ -64,7 +64,7 @@ public function critical($message, array $context = array()) */ public function error($message, array $context = array()) { - $this->log(\_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::ERROR, $message, $context); + $this->log(LogLevel::ERROR, $message, $context); } /** * Exceptional occurrences that are not errors. @@ -79,7 +79,7 @@ public function error($message, array $context = array()) */ public function warning($message, array $context = array()) { - $this->log(\_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::WARNING, $message, $context); + $this->log(LogLevel::WARNING, $message, $context); } /** * Normal but significant events. @@ -91,7 +91,7 @@ public function warning($message, array $context = array()) */ public function notice($message, array $context = array()) { - $this->log(\_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::NOTICE, $message, $context); + $this->log(LogLevel::NOTICE, $message, $context); } /** * Interesting events. @@ -105,7 +105,7 @@ public function notice($message, array $context = array()) */ public function info($message, array $context = array()) { - $this->log(\_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::INFO, $message, $context); + $this->log(LogLevel::INFO, $message, $context); } /** * Detailed debug information. @@ -117,7 +117,7 @@ public function info($message, array $context = array()) */ public function debug($message, array $context = array()) { - $this->log(\_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::DEBUG, $message, $context); + $this->log(LogLevel::DEBUG, $message, $context); } /** * Logs with an arbitrary level. diff --git a/vendor/psr/log/Psr/Log/NullLogger.php b/vendor/psr/log/Psr/Log/NullLogger.php index 5dc395cd4..1c0b2ad1e 100644 --- a/vendor/psr/log/Psr/Log/NullLogger.php +++ b/vendor/psr/log/Psr/Log/NullLogger.php @@ -10,7 +10,7 @@ * is a good way to avoid littering your code with `if ($this->logger) { }` * blocks. */ -class NullLogger extends \_PhpScoper5ea00cc67502b\Psr\Log\AbstractLogger +class NullLogger extends AbstractLogger { /** * Logs with an arbitrary level. diff --git a/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php b/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php index 3499a61b8..5f7217fe9 100644 --- a/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php +++ b/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php @@ -5,13 +5,20 @@ use _PhpScoper5ea00cc67502b\Psr\Log\LoggerInterface; use _PhpScoper5ea00cc67502b\Psr\Log\LogLevel; use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; +use DateTime; +use LogicException; +use Psr\Log\InvalidArgumentException; +use function fclose; +use function fopen; +use function method_exists; + /** * Provides a base test class for ensuring compliance with the LoggerInterface. * * Implementors can extend the class and implement abstract methods to run this * as part of their test suite. */ -abstract class LoggerInterfaceTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +abstract class LoggerInterfaceTest extends TestCase { /** * @return LoggerInterface @@ -44,10 +51,10 @@ public function testLogsAtAllLevels($level, $message) } public function provideLevelsAndMessages() { - return array(\_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::EMERGENCY => array(\_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::EMERGENCY, 'message of level emergency with context: {user}'), \_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::ALERT => array(\_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::ALERT, 'message of level alert with context: {user}'), \_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::CRITICAL => array(\_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::CRITICAL, 'message of level critical with context: {user}'), \_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::ERROR => array(\_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::ERROR, 'message of level error with context: {user}'), \_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::WARNING => array(\_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::WARNING, 'message of level warning with context: {user}'), \_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::NOTICE => array(\_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::NOTICE, 'message of level notice with context: {user}'), \_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::INFO => array(\_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::INFO, 'message of level info with context: {user}'), \_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::DEBUG => array(\_PhpScoper5ea00cc67502b\Psr\Log\LogLevel::DEBUG, 'message of level debug with context: {user}')); + return array(LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'), LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'), LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'), LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'), LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'), LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'), LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'), LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}')); } /** - * @expectedException \Psr\Log\InvalidArgumentException + * @expectedException InvalidArgumentException */ public function testThrowsOnInvalidLevel() { @@ -63,7 +70,7 @@ public function testContextReplacement() } public function testObjectCastToString() { - if (\method_exists($this, 'createPartialMock')) { + if (method_exists($this, 'createPartialMock')) { $dummy = $this->createPartialMock('_PhpScoper5ea00cc67502b\\Psr\\Log\\Test\\DummyTest', array('__toString')); } else { $dummy = $this->getMock('_PhpScoper5ea00cc67502b\\Psr\\Log\\Test\\DummyTest', array('__toString')); @@ -75,9 +82,9 @@ public function testObjectCastToString() } public function testContextCanContainAnything() { - $closed = \fopen('php://memory', 'r'); - \fclose($closed); - $context = array('bool' => \true, 'null' => null, 'string' => 'Foo', 'int' => 0, 'float' => 0.5, 'nested' => array('with object' => new \_PhpScoper5ea00cc67502b\Psr\Log\Test\DummyTest()), 'object' => new \DateTime(), 'resource' => \fopen('php://memory', 'r'), 'closed' => $closed); + $closed = fopen('php://memory', 'r'); + fclose($closed); + $context = array('bool' => true, 'null' => null, 'string' => 'Foo', 'int' => 0, 'float' => 0.5, 'nested' => array('with object' => new DummyTest()), 'object' => new DateTime(), 'resource' => fopen('php://memory', 'r'), 'closed' => $closed); $this->getLogger()->warning('Crazy context data', $context); $expected = array('warning Crazy context data'); $this->assertEquals($expected, $this->getLogs()); @@ -86,7 +93,7 @@ public function testContextExceptionKeyCanBeExceptionOrOtherValues() { $logger = $this->getLogger(); $logger->warning('Random message', array('exception' => 'oops')); - $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail'))); + $logger->critical('Uncaught Exception!', array('exception' => new LogicException('Fail'))); $expected = array('warning Random message', 'critical Uncaught Exception!'); $this->assertEquals($expected, $this->getLogs()); } diff --git a/vendor/psr/log/Psr/Log/Test/TestLogger.php b/vendor/psr/log/Psr/Log/Test/TestLogger.php index 839007c19..d066b5d6a 100644 --- a/vendor/psr/log/Psr/Log/Test/TestLogger.php +++ b/vendor/psr/log/Psr/Log/Test/TestLogger.php @@ -3,6 +3,16 @@ namespace _PhpScoper5ea00cc67502b\Psr\Log\Test; use _PhpScoper5ea00cc67502b\Psr\Log\AbstractLogger; +use BadMethodCallException; +use function call_user_func; +use function call_user_func_array; +use function get_class; +use function is_string; +use function method_exists; +use function preg_match; +use function strpos; +use function strtolower; + /** * Used for testing purposes. * @@ -53,7 +63,7 @@ * @method bool hasInfoThatPasses($message) * @method bool hasDebugThatPasses($message) */ -class TestLogger extends \_PhpScoper5ea00cc67502b\Psr\Log\AbstractLogger +class TestLogger extends AbstractLogger { /** * @var array @@ -75,54 +85,54 @@ public function hasRecords($level) } public function hasRecord($record, $level) { - if (\is_string($record)) { + if (is_string($record)) { $record = ['message' => $record]; } return $this->hasRecordThatPasses(function ($rec) use($record) { if ($rec['message'] !== $record['message']) { - return \false; + return false; } if (isset($record['context']) && $rec['context'] !== $record['context']) { - return \false; + return false; } - return \true; + return true; }, $level); } public function hasRecordThatContains($message, $level) { return $this->hasRecordThatPasses(function ($rec) use($message) { - return \strpos($rec['message'], $message) !== \false; + return strpos($rec['message'], $message) !== false; }, $level); } public function hasRecordThatMatches($regex, $level) { return $this->hasRecordThatPasses(function ($rec) use($regex) { - return \preg_match($regex, $rec['message']) > 0; + return preg_match($regex, $rec['message']) > 0; }, $level); } public function hasRecordThatPasses(callable $predicate, $level) { if (!isset($this->recordsByLevel[$level])) { - return \false; + return false; } foreach ($this->recordsByLevel[$level] as $i => $rec) { - if (\call_user_func($predicate, $rec, $i)) { - return \true; + if (call_user_func($predicate, $rec, $i)) { + return true; } } - return \false; + return false; } public function __call($method, $args) { - if (\preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { + if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3]; - $level = \strtolower($matches[2]); - if (\method_exists($this, $genericMethod)) { + $level = strtolower($matches[2]); + if (method_exists($this, $genericMethod)) { $args[] = $level; - return \call_user_func_array([$this, $genericMethod], $args); + return call_user_func_array([$this, $genericMethod], $args); } } - throw new \BadMethodCallException('Call to undefined method ' . \get_class($this) . '::' . $method . '()'); + throw new BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()'); } public function reset() { diff --git a/vendor/psr/log/Psr/Log/Test/index.php b/vendor/psr/log/Psr/Log/Test/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/psr/log/Psr/Log/Test/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/psr/log/Psr/Log/index.php b/vendor/psr/log/Psr/Log/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/psr/log/Psr/Log/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/psr/log/Psr/index.php b/vendor/psr/log/Psr/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/psr/log/Psr/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/psr/log/index.php b/vendor/psr/log/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/psr/log/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/psr/simple-cache/index.php b/vendor/psr/simple-cache/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/psr/simple-cache/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/psr/simple-cache/src/CacheInterface.php b/vendor/psr/simple-cache/src/CacheInterface.php index c9a6ea8a3..94f03b276 100644 --- a/vendor/psr/simple-cache/src/CacheInterface.php +++ b/vendor/psr/simple-cache/src/CacheInterface.php @@ -2,6 +2,8 @@ namespace _PhpScoper5ea00cc67502b\Psr\SimpleCache; +use DateInterval; + interface CacheInterface { /** @@ -21,7 +23,7 @@ public function get($key, $default = null); * * @param string $key The key of the item to store. * @param mixed $value The value of the item to store, must be serializable. - * @param null|int|\DateInterval $ttl Optional. The TTL value of this item. If no value is sent and + * @param null|int|DateInterval $ttl Optional. The TTL value of this item. If no value is sent and * the driver supports TTL then the library may set a default value * for it or let the driver take care of that. * @@ -65,7 +67,7 @@ public function getMultiple($keys, $default = null); * Persists a set of key => value pairs in the cache, with an optional TTL. * * @param iterable $values A list of key => value pairs for a multiple-set operation. - * @param null|int|\DateInterval $ttl Optional. The TTL value of this item. If no value is sent and + * @param null|int|DateInterval $ttl Optional. The TTL value of this item. If no value is sent and * the driver supports TTL then the library may set a default value * for it or let the driver take care of that. * diff --git a/vendor/psr/simple-cache/src/InvalidArgumentException.php b/vendor/psr/simple-cache/src/InvalidArgumentException.php index c84eaa0a1..57f5cfe65 100644 --- a/vendor/psr/simple-cache/src/InvalidArgumentException.php +++ b/vendor/psr/simple-cache/src/InvalidArgumentException.php @@ -8,6 +8,6 @@ * When an invalid argument is passed it must throw an exception which implements * this interface */ -interface InvalidArgumentException extends \_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheException +interface InvalidArgumentException extends CacheException { } diff --git a/vendor/psr/simple-cache/src/index.php b/vendor/psr/simple-cache/src/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/psr/simple-cache/src/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/ralouphie/getallheaders/index.php b/vendor/ralouphie/getallheaders/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/ralouphie/getallheaders/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/ralouphie/getallheaders/src/getallheaders.php b/vendor/ralouphie/getallheaders/src/getallheaders.php index bd1d7e482..d86abfaeb 100644 --- a/vendor/ralouphie/getallheaders/src/getallheaders.php +++ b/vendor/ralouphie/getallheaders/src/getallheaders.php @@ -2,7 +2,14 @@ namespace _PhpScoper5ea00cc67502b; -if (!\function_exists('_PhpScoper5ea00cc67502b\\getallheaders')) { +use function base64_encode; +use function function_exists; +use function str_replace; +use function strtolower; +use function substr; +use function ucwords; + +if (!function_exists('_PhpScoper5ea00cc67502b\\getallheaders')) { /** * Get all HTTP header key/values as an associative array for the current request. * @@ -13,10 +20,10 @@ function getallheaders() $headers = array(); $copy_server = array('CONTENT_TYPE' => 'Content-Type', 'CONTENT_LENGTH' => 'Content-Length', 'CONTENT_MD5' => 'Content-Md5'); foreach ($_SERVER as $key => $value) { - if (\substr($key, 0, 5) === 'HTTP_') { - $key = \substr($key, 5); + if (substr($key, 0, 5) === 'HTTP_') { + $key = substr($key, 5); if (!isset($copy_server[$key]) || !isset($_SERVER[$key])) { - $key = \str_replace(' ', '-', \ucwords(\strtolower(\str_replace('_', ' ', $key)))); + $key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', $key)))); $headers[$key] = $value; } } elseif (isset($copy_server[$key])) { @@ -28,7 +35,7 @@ function getallheaders() $headers['Authorization'] = $_SERVER['REDIRECT_HTTP_AUTHORIZATION']; } elseif (isset($_SERVER['PHP_AUTH_USER'])) { $basic_pass = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : ''; - $headers['Authorization'] = 'Basic ' . \base64_encode($_SERVER['PHP_AUTH_USER'] . ':' . $basic_pass); + $headers['Authorization'] = 'Basic ' . base64_encode($_SERVER['PHP_AUTH_USER'] . ':' . $basic_pass); } elseif (isset($_SERVER['PHP_AUTH_DIGEST'])) { $headers['Authorization'] = $_SERVER['PHP_AUTH_DIGEST']; } diff --git a/vendor/ralouphie/getallheaders/src/index.php b/vendor/ralouphie/getallheaders/src/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/ralouphie/getallheaders/src/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/ralouphie/index.php b/vendor/ralouphie/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/ralouphie/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/cache/Adapter/AbstractAdapter.php b/vendor/symfony/cache/Adapter/AbstractAdapter.php index 7d7200fec..2edbe50e8 100644 --- a/vendor/symfony/cache/Adapter/AbstractAdapter.php +++ b/vendor/symfony/cache/Adapter/AbstractAdapter.php @@ -18,10 +18,33 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\AbstractTrait; +use BadMethodCallException; +use Closure; +use Exception; +use function array_combine; +use function array_keys; +use function array_values; +use function count; +use function filter_var; +use function get_class; +use function gettype; +use function ini_get; +use function is_array; +use function is_object; +use function is_string; +use function key; +use function sprintf; +use function strlen; +use function strpos; +use function substr; +use function time; +use const FILTER_VALIDATE_BOOLEAN; +use const PHP_SAPI; + /** * @author Nicolas Grekas */ -abstract class AbstractAdapter implements \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AdapterInterface, \_PhpScoper5ea00cc67502b\Psr\Log\LoggerAwareInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface +abstract class AbstractAdapter implements AdapterInterface, LoggerAwareInterface, ResettableInterface { /** * @internal @@ -38,24 +61,24 @@ abstract class AbstractAdapter implements \_PhpScoper5ea00cc67502b\Symfony\Compo */ protected function __construct($namespace = '', $defaultLifetime = 0) { - $this->namespace = '' === $namespace ? '' : \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::validateKey($namespace) . static::NS_SEPARATOR; - if (null !== $this->maxIdLength && \strlen($namespace) > $this->maxIdLength - 24) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Namespace must be %d chars max, %d given ("%s").', $this->maxIdLength - 24, \strlen($namespace), $namespace)); + $this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace) . static::NS_SEPARATOR; + if (null !== $this->maxIdLength && strlen($namespace) > $this->maxIdLength - 24) { + throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s").', $this->maxIdLength - 24, strlen($namespace), $namespace)); } - $this->createCacheItem = \Closure::bind(static function ($key, $value, $isHit) use($defaultLifetime) { - $item = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem(); + $this->createCacheItem = Closure::bind(static function ($key, $value, $isHit) use($defaultLifetime) { + $item = new CacheItem(); $item->key = $key; $item->value = $value; $item->isHit = $isHit; $item->defaultLifetime = $defaultLifetime; return $item; - }, null, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::class); + }, null, CacheItem::class); $getId = function ($key) { return $this->getId((string) $key); }; - $this->mergeByLifetime = \Closure::bind(static function ($deferred, $namespace, &$expiredIds) use($getId) { + $this->mergeByLifetime = Closure::bind(static function ($deferred, $namespace, &$expiredIds) use($getId) { $byLifetime = []; - $now = \time(); + $now = time(); $expiredIds = []; foreach ($deferred as $key => $item) { if (null === $item->expiry) { @@ -67,7 +90,7 @@ protected function __construct($namespace = '', $defaultLifetime = 0) } } return $byLifetime; - }, null, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::class); + }, null, CacheItem::class); } /** * @param string $namespace @@ -77,48 +100,48 @@ protected function __construct($namespace = '', $defaultLifetime = 0) * * @return AdapterInterface */ - public static function createSystemCache($namespace, $defaultLifetime, $version, $directory, \_PhpScoper5ea00cc67502b\Psr\Log\LoggerInterface $logger = null) + public static function createSystemCache($namespace, $defaultLifetime, $version, $directory, LoggerInterface $logger = null) { if (null === self::$apcuSupported) { - self::$apcuSupported = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ApcuAdapter::isSupported(); + self::$apcuSupported = ApcuAdapter::isSupported(); } if (!self::$apcuSupported && null === self::$phpFilesSupported) { - self::$phpFilesSupported = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\PhpFilesAdapter::isSupported(); + self::$phpFilesSupported = PhpFilesAdapter::isSupported(); } if (self::$phpFilesSupported) { - $opcache = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\PhpFilesAdapter($namespace, $defaultLifetime, $directory); + $opcache = new PhpFilesAdapter($namespace, $defaultLifetime, $directory); if (null !== $logger) { $opcache->setLogger($logger); } return $opcache; } - $fs = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\FilesystemAdapter($namespace, $defaultLifetime, $directory); + $fs = new FilesystemAdapter($namespace, $defaultLifetime, $directory); if (null !== $logger) { $fs->setLogger($logger); } if (!self::$apcuSupported) { return $fs; } - $apcu = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ApcuAdapter($namespace, (int) $defaultLifetime / 5, $version); - if ('cli' === \PHP_SAPI && !\filter_var(\ini_get('apc.enable_cli'), \FILTER_VALIDATE_BOOLEAN)) { - $apcu->setLogger(new \_PhpScoper5ea00cc67502b\Psr\Log\NullLogger()); + $apcu = new ApcuAdapter($namespace, (int) $defaultLifetime / 5, $version); + if ('cli' === PHP_SAPI && !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) { + $apcu->setLogger(new NullLogger()); } elseif (null !== $logger) { $apcu->setLogger($logger); } - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ChainAdapter([$apcu, $fs]); + return new ChainAdapter([$apcu, $fs]); } public static function createConnection($dsn, array $options = []) { - if (!\is_string($dsn)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('The "%s()" method expect argument #1 to be string, "%s" given.', __METHOD__, \gettype($dsn))); + if (!is_string($dsn)) { + throw new InvalidArgumentException(sprintf('The "%s()" method expect argument #1 to be string, "%s" given.', __METHOD__, gettype($dsn))); } - if (0 === \strpos($dsn, 'redis://')) { - return \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\RedisAdapter::createConnection($dsn, $options); + if (0 === strpos($dsn, 'redis://')) { + return RedisAdapter::createConnection($dsn, $options); } - if (0 === \strpos($dsn, 'memcached://')) { - return \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\MemcachedAdapter::createConnection($dsn, $options); + if (0 === strpos($dsn, 'memcached://')) { + return MemcachedAdapter::createConnection($dsn, $options); } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Unsupported DSN: "%s".', $dsn)); + throw new InvalidArgumentException(sprintf('Unsupported DSN: "%s".', $dsn)); } /** * {@inheritdoc} @@ -130,14 +153,14 @@ public function getItem($key) } $id = $this->getId($key); $f = $this->createCacheItem; - $isHit = \false; + $isHit = false; $value = null; try { foreach ($this->doFetch([$id]) as $value) { - $isHit = \true; + $isHit = true; } - } catch (\Exception $e) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::log($this->logger, 'Failed to fetch key "{key}"', ['key' => $key, 'exception' => $e]); + } catch (Exception $e) { + CacheItem::log($this->logger, 'Failed to fetch key "{key}"', ['key' => $key, 'exception' => $e]); } return $f($key, $value, $isHit); } @@ -155,20 +178,20 @@ public function getItems(array $keys = []) } try { $items = $this->doFetch($ids); - } catch (\Exception $e) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::log($this->logger, 'Failed to fetch requested items', ['keys' => $keys, 'exception' => $e]); + } catch (Exception $e) { + CacheItem::log($this->logger, 'Failed to fetch requested items', ['keys' => $keys, 'exception' => $e]); $items = []; } - $ids = \array_combine($ids, $keys); + $ids = array_combine($ids, $keys); return $this->generateItems($items, $ids); } /** * {@inheritdoc} */ - public function save(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item) + public function save(CacheItemInterface $item) { - if (!$item instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem) { - return \false; + if (!$item instanceof CacheItem) { + return false; } $this->deferred[$item->getKey()] = $item; return $this->commit(); @@ -176,20 +199,20 @@ public function save(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item /** * {@inheritdoc} */ - public function saveDeferred(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item) + public function saveDeferred(CacheItemInterface $item) { - if (!$item instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem) { - return \false; + if (!$item instanceof CacheItem) { + return false; } $this->deferred[$item->getKey()] = $item; - return \true; + return true; } /** * {@inheritdoc} */ public function commit() { - $ok = \true; + $ok = true; $byLifetime = $this->mergeByLifetime; $byLifetime = $byLifetime($this->deferred, $this->namespace, $expiredIds); $retry = $this->deferred = []; @@ -199,17 +222,17 @@ public function commit() foreach ($byLifetime as $lifetime => $values) { try { $e = $this->doSave($values, $lifetime); - } catch (\Exception $e) { + } catch (Exception $e) { } - if (\true === $e || [] === $e) { + if (true === $e || [] === $e) { continue; } - if (\is_array($e) || 1 === \count($values)) { - foreach (\is_array($e) ? $e : \array_keys($values) as $id) { - $ok = \false; + if (is_array($e) || 1 === count($values)) { + foreach (is_array($e) ? $e : array_keys($values) as $id) { + $ok = false; $v = $values[$id]; - $type = \is_object($v) ? \get_class($v) : \gettype($v); - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', ['key' => \substr($id, \strlen($this->namespace)), 'type' => $type, 'exception' => $e instanceof \Exception ? $e : null]); + $type = is_object($v) ? get_class($v) : gettype($v); + CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', ['key' => substr($id, strlen($this->namespace)), 'type' => $type, 'exception' => $e instanceof Exception ? $e : null]); } } else { foreach ($values as $id => $v) { @@ -223,25 +246,25 @@ public function commit() try { $v = $byLifetime[$lifetime][$id]; $e = $this->doSave([$id => $v], $lifetime); - } catch (\Exception $e) { + } catch (Exception $e) { } - if (\true === $e || [] === $e) { + if (true === $e || [] === $e) { continue; } - $ok = \false; - $type = \is_object($v) ? \get_class($v) : \gettype($v); - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', ['key' => \substr($id, \strlen($this->namespace)), 'type' => $type, 'exception' => $e instanceof \Exception ? $e : null]); + $ok = false; + $type = is_object($v) ? get_class($v) : gettype($v); + CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', ['key' => substr($id, strlen($this->namespace)), 'type' => $type, 'exception' => $e instanceof Exception ? $e : null]); } } return $ok; } public function __sleep() { - throw new \BadMethodCallException('Cannot serialize ' . __CLASS__); + throw new BadMethodCallException('Cannot serialize ' . __CLASS__); } public function __wakeup() { - throw new \BadMethodCallException('Cannot unserialize ' . __CLASS__); + throw new BadMethodCallException('Cannot unserialize ' . __CLASS__); } public function __destruct() { @@ -255,17 +278,17 @@ private function generateItems($items, &$keys) try { foreach ($items as $id => $value) { if (!isset($keys[$id])) { - $id = \key($keys); + $id = key($keys); } $key = $keys[$id]; unset($keys[$id]); - (yield $key => $f($key, $value, \true)); + (yield $key => $f($key, $value, true)); } - } catch (\Exception $e) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::log($this->logger, 'Failed to fetch requested items', ['keys' => \array_values($keys), 'exception' => $e]); + } catch (Exception $e) { + CacheItem::log($this->logger, 'Failed to fetch requested items', ['keys' => array_values($keys), 'exception' => $e]); } foreach ($keys as $key) { - (yield $key => $f($key, null, \false)); + (yield $key => $f($key, null, false)); } } } diff --git a/vendor/symfony/cache/Adapter/AdapterInterface.php b/vendor/symfony/cache/Adapter/AdapterInterface.php index 5870450f0..d301b9d61 100644 --- a/vendor/symfony/cache/Adapter/AdapterInterface.php +++ b/vendor/symfony/cache/Adapter/AdapterInterface.php @@ -12,12 +12,14 @@ use _PhpScoper5ea00cc67502b\Psr\Cache\CacheItemPoolInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem; +use Traversable; + /** * Interface for adapters managing instances of Symfony's CacheItem. * * @author Kévin Dunglas */ -interface AdapterInterface extends \_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemPoolInterface +interface AdapterInterface extends CacheItemPoolInterface { /** * {@inheritdoc} @@ -28,7 +30,7 @@ public function getItem($key); /** * {@inheritdoc} * - * @return \Traversable|CacheItem[] + * @return Traversable|CacheItem[] */ public function getItems(array $keys = []); } diff --git a/vendor/symfony/cache/Adapter/ApcuAdapter.php b/vendor/symfony/cache/Adapter/ApcuAdapter.php index 7b19c74f7..97d8a1e6a 100644 --- a/vendor/symfony/cache/Adapter/ApcuAdapter.php +++ b/vendor/symfony/cache/Adapter/ApcuAdapter.php @@ -11,7 +11,7 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\ApcuTrait; -class ApcuAdapter extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AbstractAdapter +class ApcuAdapter extends AbstractAdapter { use ApcuTrait; /** diff --git a/vendor/symfony/cache/Adapter/ArrayAdapter.php b/vendor/symfony/cache/Adapter/ArrayAdapter.php index 5c7ba26fb..50b1e7075 100644 --- a/vendor/symfony/cache/Adapter/ArrayAdapter.php +++ b/vendor/symfony/cache/Adapter/ArrayAdapter.php @@ -15,10 +15,20 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\ArrayTrait; +use Closure; +use Exception; +use function get_class; +use function gettype; +use function is_object; +use function serialize; +use function time; +use function unserialize; +use const PHP_INT_MAX; + /** * @author Nicolas Grekas */ -class ArrayAdapter implements \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AdapterInterface, \_PhpScoper5ea00cc67502b\Psr\Log\LoggerAwareInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface +class ArrayAdapter implements AdapterInterface, LoggerAwareInterface, ResettableInterface { use ArrayTrait; private $createCacheItem; @@ -26,17 +36,17 @@ class ArrayAdapter implements \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\A * @param int $defaultLifetime * @param bool $storeSerialized Disabling serialization can lead to cache corruptions when storing mutable values but increases performance otherwise */ - public function __construct($defaultLifetime = 0, $storeSerialized = \true) + public function __construct($defaultLifetime = 0, $storeSerialized = true) { $this->storeSerialized = $storeSerialized; - $this->createCacheItem = \Closure::bind(static function ($key, $value, $isHit) use($defaultLifetime) { - $item = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem(); + $this->createCacheItem = Closure::bind(static function ($key, $value, $isHit) use($defaultLifetime) { + $item = new CacheItem(); $item->key = $key; $item->value = $value; $item->isHit = $isHit; $item->defaultLifetime = $defaultLifetime; return $item; - }, null, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::class); + }, null, CacheItem::class); } /** * {@inheritdoc} @@ -50,15 +60,15 @@ public function getItem($key) } elseif (!$this->storeSerialized) { $value = $this->values[$key]; } elseif ('b:0;' === ($value = $this->values[$key])) { - $value = \false; - } elseif (\false === ($value = \unserialize($value))) { + $value = false; + } elseif (false === ($value = unserialize($value))) { $this->values[$key] = $value = null; - $isHit = \false; + $isHit = false; } - } catch (\Exception $e) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::log($this->logger, 'Failed to unserialize key "{key}"', ['key' => $key, 'exception' => $e]); + } catch (Exception $e) { + CacheItem::log($this->logger, 'Failed to unserialize key "{key}"', ['key' => $key, 'exception' => $e]); $this->values[$key] = $value = null; - $isHit = \false; + $isHit = false; } $f = $this->createCacheItem; return $f($key, $value, $isHit); @@ -69,9 +79,9 @@ public function getItem($key) public function getItems(array $keys = []) { foreach ($keys as $key) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::validateKey($key); + CacheItem::validateKey($key); } - return $this->generateItems($keys, \time(), $this->createCacheItem); + return $this->generateItems($keys, time(), $this->createCacheItem); } /** * {@inheritdoc} @@ -81,44 +91,44 @@ public function deleteItems(array $keys) foreach ($keys as $key) { $this->deleteItem($key); } - return \true; + return true; } /** * {@inheritdoc} */ - public function save(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item) + public function save(CacheItemInterface $item) { - if (!$item instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem) { - return \false; + if (!$item instanceof CacheItem) { + return false; } $item = (array) $item; $key = $item["\0*\0key"]; $value = $item["\0*\0value"]; $expiry = $item["\0*\0expiry"]; - if (null !== $expiry && $expiry <= \time()) { + if (null !== $expiry && $expiry <= time()) { $this->deleteItem($key); - return \true; + return true; } if ($this->storeSerialized) { try { - $value = \serialize($value); - } catch (\Exception $e) { - $type = \is_object($value) ? \get_class($value) : \gettype($value); - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', ['key' => $key, 'type' => $type, 'exception' => $e]); - return \false; + $value = serialize($value); + } catch (Exception $e) { + $type = is_object($value) ? get_class($value) : gettype($value); + CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', ['key' => $key, 'type' => $type, 'exception' => $e]); + return false; } } if (null === $expiry && 0 < $item["\0*\0defaultLifetime"]) { - $expiry = \time() + $item["\0*\0defaultLifetime"]; + $expiry = time() + $item["\0*\0defaultLifetime"]; } $this->values[$key] = $value; - $this->expiries[$key] = null !== $expiry ? $expiry : \PHP_INT_MAX; - return \true; + $this->expiries[$key] = null !== $expiry ? $expiry : PHP_INT_MAX; + return true; } /** * {@inheritdoc} */ - public function saveDeferred(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item) + public function saveDeferred(CacheItemInterface $item) { return $this->save($item); } @@ -127,6 +137,6 @@ public function saveDeferred(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterfa */ public function commit() { - return \true; + return true; } } diff --git a/vendor/symfony/cache/Adapter/ChainAdapter.php b/vendor/symfony/cache/Adapter/ChainAdapter.php index 38b747426..6bb12ea89 100644 --- a/vendor/symfony/cache/Adapter/ChainAdapter.php +++ b/vendor/symfony/cache/Adapter/ChainAdapter.php @@ -16,6 +16,11 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface; +use Closure; +use function count; +use function get_class; +use function sprintf; + /** * Chains several adapters together. * @@ -24,7 +29,7 @@ * * @author Kévin Dunglas */ -class ChainAdapter implements \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AdapterInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface +class ChainAdapter implements AdapterInterface, PruneableInterface, ResettableInterface { private $adapters = []; private $adapterCount; @@ -36,20 +41,20 @@ class ChainAdapter implements \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\A public function __construct(array $adapters, $defaultLifetime = 0) { if (!$adapters) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException('At least one adapter must be specified.'); + throw new InvalidArgumentException('At least one adapter must be specified.'); } foreach ($adapters as $adapter) { - if (!$adapter instanceof \_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemPoolInterface) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('The class "%s" does not implement the "%s" interface.', \get_class($adapter), \_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemPoolInterface::class)); + if (!$adapter instanceof CacheItemPoolInterface) { + throw new InvalidArgumentException(sprintf('The class "%s" does not implement the "%s" interface.', get_class($adapter), CacheItemPoolInterface::class)); } - if ($adapter instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AdapterInterface) { + if ($adapter instanceof AdapterInterface) { $this->adapters[] = $adapter; } else { - $this->adapters[] = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ProxyAdapter($adapter); + $this->adapters[] = new ProxyAdapter($adapter); } } - $this->adapterCount = \count($this->adapters); - $this->syncItem = \Closure::bind(static function ($sourceItem, $item) use($defaultLifetime) { + $this->adapterCount = count($this->adapters); + $this->syncItem = Closure::bind(static function ($sourceItem, $item) use($defaultLifetime) { $item->value = $sourceItem->value; $item->expiry = $sourceItem->expiry; $item->isHit = $sourceItem->isHit; @@ -60,7 +65,7 @@ public function __construct(array $adapters, $defaultLifetime = 0) $item->defaultLifetime = $defaultLifetime; } return $item; - }, null, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::class); + }, null, CacheItem::class); } /** * {@inheritdoc} @@ -121,17 +126,17 @@ public function hasItem($key) { foreach ($this->adapters as $adapter) { if ($adapter->hasItem($key)) { - return \true; + return true; } } - return \false; + return false; } /** * {@inheritdoc} */ public function clear() { - $cleared = \true; + $cleared = true; $i = $this->adapterCount; while ($i--) { $cleared = $this->adapters[$i]->clear() && $cleared; @@ -143,7 +148,7 @@ public function clear() */ public function deleteItem($key) { - $deleted = \true; + $deleted = true; $i = $this->adapterCount; while ($i--) { $deleted = $this->adapters[$i]->deleteItem($key) && $deleted; @@ -155,7 +160,7 @@ public function deleteItem($key) */ public function deleteItems(array $keys) { - $deleted = \true; + $deleted = true; $i = $this->adapterCount; while ($i--) { $deleted = $this->adapters[$i]->deleteItems($keys) && $deleted; @@ -165,9 +170,9 @@ public function deleteItems(array $keys) /** * {@inheritdoc} */ - public function save(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item) + public function save(CacheItemInterface $item) { - $saved = \true; + $saved = true; $i = $this->adapterCount; while ($i--) { $saved = $this->adapters[$i]->save($item) && $saved; @@ -177,9 +182,9 @@ public function save(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item /** * {@inheritdoc} */ - public function saveDeferred(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item) + public function saveDeferred(CacheItemInterface $item) { - $saved = \true; + $saved = true; $i = $this->adapterCount; while ($i--) { $saved = $this->adapters[$i]->saveDeferred($item) && $saved; @@ -191,7 +196,7 @@ public function saveDeferred(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterfa */ public function commit() { - $committed = \true; + $committed = true; $i = $this->adapterCount; while ($i--) { $committed = $this->adapters[$i]->commit() && $committed; @@ -203,9 +208,9 @@ public function commit() */ public function prune() { - $pruned = \true; + $pruned = true; foreach ($this->adapters as $adapter) { - if ($adapter instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface) { + if ($adapter instanceof PruneableInterface) { $pruned = $adapter->prune() && $pruned; } } @@ -217,7 +222,7 @@ public function prune() public function reset() { foreach ($this->adapters as $adapter) { - if ($adapter instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface) { + if ($adapter instanceof ResettableInterface) { $adapter->reset(); } } diff --git a/vendor/symfony/cache/Adapter/DoctrineAdapter.php b/vendor/symfony/cache/Adapter/DoctrineAdapter.php index 170ae20f8..c06360fcf 100644 --- a/vendor/symfony/cache/Adapter/DoctrineAdapter.php +++ b/vendor/symfony/cache/Adapter/DoctrineAdapter.php @@ -12,14 +12,14 @@ use _PhpScoper5ea00cc67502b\Doctrine\Common\Cache\CacheProvider; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\DoctrineTrait; -class DoctrineAdapter extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AbstractAdapter +class DoctrineAdapter extends AbstractAdapter { use DoctrineTrait; /** * @param string $namespace * @param int $defaultLifetime */ - public function __construct(\_PhpScoper5ea00cc67502b\Doctrine\Common\Cache\CacheProvider $provider, $namespace = '', $defaultLifetime = 0) + public function __construct(CacheProvider $provider, $namespace = '', $defaultLifetime = 0) { parent::__construct('', $defaultLifetime); $this->provider = $provider; diff --git a/vendor/symfony/cache/Adapter/FilesystemAdapter.php b/vendor/symfony/cache/Adapter/FilesystemAdapter.php index dba482e91..0afe42ef0 100644 --- a/vendor/symfony/cache/Adapter/FilesystemAdapter.php +++ b/vendor/symfony/cache/Adapter/FilesystemAdapter.php @@ -12,7 +12,7 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\FilesystemTrait; -class FilesystemAdapter extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AbstractAdapter implements \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface +class FilesystemAdapter extends AbstractAdapter implements PruneableInterface { use FilesystemTrait; /** diff --git a/vendor/symfony/cache/Adapter/MemcachedAdapter.php b/vendor/symfony/cache/Adapter/MemcachedAdapter.php index 1f5c969f3..96d684dff 100644 --- a/vendor/symfony/cache/Adapter/MemcachedAdapter.php +++ b/vendor/symfony/cache/Adapter/MemcachedAdapter.php @@ -10,8 +10,9 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter; +use _PhpScoper5ea00cc67502b\Memcached; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\MemcachedTrait; -class MemcachedAdapter extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AbstractAdapter +class MemcachedAdapter extends AbstractAdapter { use MemcachedTrait; protected $maxIdLength = 250; @@ -25,7 +26,7 @@ class MemcachedAdapter extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\ * * Using a MemcachedAdapter as a pure items store is fine. */ - public function __construct(\_PhpScoper5ea00cc67502b\Memcached $client, $namespace = '', $defaultLifetime = 0) + public function __construct(Memcached $client, $namespace = '', $defaultLifetime = 0) { $this->init($client, $namespace, $defaultLifetime); } diff --git a/vendor/symfony/cache/Adapter/NullAdapter.php b/vendor/symfony/cache/Adapter/NullAdapter.php index 3f07146d4..0409cd6cb 100644 --- a/vendor/symfony/cache/Adapter/NullAdapter.php +++ b/vendor/symfony/cache/Adapter/NullAdapter.php @@ -12,20 +12,22 @@ use _PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem; +use Closure; + /** * @author Titouan Galopin */ -class NullAdapter implements \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AdapterInterface +class NullAdapter implements AdapterInterface { private $createCacheItem; public function __construct() { - $this->createCacheItem = \Closure::bind(function ($key) { - $item = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem(); + $this->createCacheItem = Closure::bind(function ($key) { + $item = new CacheItem(); $item->key = $key; - $item->isHit = \false; + $item->isHit = false; return $item; - }, $this, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::class); + }, $this, CacheItem::class); } /** * {@inheritdoc} @@ -47,49 +49,49 @@ public function getItems(array $keys = []) */ public function hasItem($key) { - return \false; + return false; } /** * {@inheritdoc} */ public function clear() { - return \true; + return true; } /** * {@inheritdoc} */ public function deleteItem($key) { - return \true; + return true; } /** * {@inheritdoc} */ public function deleteItems(array $keys) { - return \true; + return true; } /** * {@inheritdoc} */ - public function save(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item) + public function save(CacheItemInterface $item) { - return \false; + return false; } /** * {@inheritdoc} */ - public function saveDeferred(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item) + public function saveDeferred(CacheItemInterface $item) { - return \false; + return false; } /** * {@inheritdoc} */ public function commit() { - return \false; + return false; } private function generateItems(array $keys) { diff --git a/vendor/symfony/cache/Adapter/PdoAdapter.php b/vendor/symfony/cache/Adapter/PdoAdapter.php index e976dae89..a8fd3c399 100644 --- a/vendor/symfony/cache/Adapter/PdoAdapter.php +++ b/vendor/symfony/cache/Adapter/PdoAdapter.php @@ -14,7 +14,9 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\PdoTrait; -class PdoAdapter extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AbstractAdapter implements \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface +use PDO; + +class PdoAdapter extends AbstractAdapter implements PruneableInterface { use PdoTrait; protected $maxIdLength = 255; @@ -33,7 +35,7 @@ class PdoAdapter extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapte * * db_password: The password when lazy-connect [default: ''] * * db_connection_options: An array of driver-specific connection options [default: []] * - * @param \PDO|Connection|string $connOrDsn A \PDO or Connection instance or DSN string or null + * @param PDO|Connection|string $connOrDsn A \PDO or Connection instance or DSN string or null * @param string $namespace * @param int $defaultLifetime * @param array $options An associative array of options diff --git a/vendor/symfony/cache/Adapter/PhpArrayAdapter.php b/vendor/symfony/cache/Adapter/PhpArrayAdapter.php index 5547a0919..e1e5ef841 100644 --- a/vendor/symfony/cache/Adapter/PhpArrayAdapter.php +++ b/vendor/symfony/cache/Adapter/PhpArrayAdapter.php @@ -17,6 +17,24 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\PhpArrayTrait; +use Closure; +use Error; +use Exception; +use Generator; +use ReflectionException; +use function array_search; +use function debug_backtrace; +use function filter_var; +use function get_class; +use function gettype; +use function ini_get; +use function is_object; +use function is_string; +use function sprintf; +use function unserialize; +use const FILTER_VALIDATE_BOOLEAN; +use const PHP_VERSION_ID; + /** * Caches items at warm up time using a PHP array that is stored in shared memory by OPCache since PHP 7.0. * Warmed up items are read-only and run-time discovered items are cached using a fallback adapter. @@ -24,7 +42,7 @@ * @author Titouan Galopin * @author Nicolas Grekas */ -class PhpArrayAdapter implements \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AdapterInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface +class PhpArrayAdapter implements AdapterInterface, PruneableInterface, ResettableInterface { use PhpArrayTrait; private $createCacheItem; @@ -32,18 +50,18 @@ class PhpArrayAdapter implements \_PhpScoper5ea00cc67502b\Symfony\Component\Cach * @param string $file The PHP file were values are cached * @param AdapterInterface $fallbackPool A pool to fallback on when an item is not hit */ - public function __construct($file, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AdapterInterface $fallbackPool) + public function __construct($file, AdapterInterface $fallbackPool) { $this->file = $file; $this->pool = $fallbackPool; - $this->zendDetectUnicode = \filter_var(\ini_get('zend.detect_unicode'), \FILTER_VALIDATE_BOOLEAN); - $this->createCacheItem = \Closure::bind(static function ($key, $value, $isHit) { - $item = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem(); + $this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), FILTER_VALIDATE_BOOLEAN); + $this->createCacheItem = Closure::bind(static function ($key, $value, $isHit) { + $item = new CacheItem(); $item->key = $key; $item->value = $value; $item->isHit = $isHit; return $item; - }, null, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::class); + }, null, CacheItem::class); } /** * This adapter should only be used on PHP 7.0+ to take advantage of how PHP @@ -55,11 +73,11 @@ public function __construct($file, \_PhpScoper5ea00cc67502b\Symfony\Component\Ca * * @return CacheItemPoolInterface */ - public static function create($file, \_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemPoolInterface $fallbackPool) + public static function create($file, CacheItemPoolInterface $fallbackPool) { - if (\PHP_VERSION_ID >= 70000) { - if (!$fallbackPool instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AdapterInterface) { - $fallbackPool = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ProxyAdapter($fallbackPool); + if (PHP_VERSION_ID >= 70000) { + if (!$fallbackPool instanceof AdapterInterface) { + $fallbackPool = new ProxyAdapter($fallbackPool); } return new static($file, $fallbackPool); } @@ -70,8 +88,8 @@ public static function create($file, \_PhpScoper5ea00cc67502b\Psr\Cache\CacheIte */ public function getItem($key) { - if (!\is_string($key)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache key must be string, "%s" given.', \is_object($key) ? \get_class($key) : \gettype($key))); + if (!is_string($key)) { + throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', is_object($key) ? get_class($key) : gettype($key))); } if (null === $this->values) { $this->initialize(); @@ -80,19 +98,19 @@ public function getItem($key) return $this->pool->getItem($key); } $value = $this->values[$key]; - $isHit = \true; + $isHit = true; if ('N;' === $value) { $value = null; - } elseif (\is_string($value) && isset($value[2]) && ':' === $value[1]) { + } elseif (is_string($value) && isset($value[2]) && ':' === $value[1]) { try { $e = null; - $value = \unserialize($value); - } catch (\Error $e) { - } catch (\Exception $e) { + $value = unserialize($value); + } catch (Error $e) { + } catch (Exception $e) { } if (null !== $e) { $value = null; - $isHit = \false; + $isHit = false; } } $f = $this->createCacheItem; @@ -104,8 +122,8 @@ public function getItem($key) public function getItems(array $keys = []) { foreach ($keys as $key) { - if (!\is_string($key)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache key must be string, "%s" given.', \is_object($key) ? \get_class($key) : \gettype($key))); + if (!is_string($key)) { + throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', is_object($key) ? get_class($key) : gettype($key))); } } if (null === $this->values) { @@ -118,8 +136,8 @@ public function getItems(array $keys = []) */ public function hasItem($key) { - if (!\is_string($key)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache key must be string, "%s" given.', \is_object($key) ? \get_class($key) : \gettype($key))); + if (!is_string($key)) { + throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', is_object($key) ? get_class($key) : gettype($key))); } if (null === $this->values) { $this->initialize(); @@ -131,8 +149,8 @@ public function hasItem($key) */ public function deleteItem($key) { - if (!\is_string($key)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache key must be string, "%s" given.', \is_object($key) ? \get_class($key) : \gettype($key))); + if (!is_string($key)) { + throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', is_object($key) ? get_class($key) : gettype($key))); } if (null === $this->values) { $this->initialize(); @@ -144,14 +162,14 @@ public function deleteItem($key) */ public function deleteItems(array $keys) { - $deleted = \true; + $deleted = true; $fallbackKeys = []; foreach ($keys as $key) { - if (!\is_string($key)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache key must be string, "%s" given.', \is_object($key) ? \get_class($key) : \gettype($key))); + if (!is_string($key)) { + throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', is_object($key) ? get_class($key) : gettype($key))); } if (isset($this->values[$key])) { - $deleted = \false; + $deleted = false; } else { $fallbackKeys[] = $key; } @@ -167,7 +185,7 @@ public function deleteItems(array $keys) /** * {@inheritdoc} */ - public function save(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item) + public function save(CacheItemInterface $item) { if (null === $this->values) { $this->initialize(); @@ -177,7 +195,7 @@ public function save(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item /** * {@inheritdoc} */ - public function saveDeferred(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item) + public function saveDeferred(CacheItemInterface $item) { if (null === $this->values) { $this->initialize(); @@ -192,7 +210,7 @@ public function commit() return $this->pool->commit(); } /** - * @return \Generator + * @return Generator */ private function generateItems(array $keys) { @@ -202,17 +220,17 @@ private function generateItems(array $keys) if (isset($this->values[$key])) { $value = $this->values[$key]; if ('N;' === $value) { - (yield $key => $f($key, null, \true)); - } elseif (\is_string($value) && isset($value[2]) && ':' === $value[1]) { + (yield $key => $f($key, null, true)); + } elseif (is_string($value) && isset($value[2]) && ':' === $value[1]) { try { - (yield $key => $f($key, \unserialize($value), \true)); - } catch (\Error $e) { - (yield $key => $f($key, null, \false)); - } catch (\Exception $e) { - (yield $key => $f($key, null, \false)); + (yield $key => $f($key, unserialize($value), true)); + } catch (Error $e) { + (yield $key => $f($key, null, false)); + } catch (Exception $e) { + (yield $key => $f($key, null, false)); } } else { - (yield $key => $f($key, $value, \true)); + (yield $key => $f($key, $value, true)); } } else { $fallbackKeys[] = $key; @@ -225,16 +243,16 @@ private function generateItems(array $keys) } } /** - * @throws \ReflectionException When $class is not found and is required + * @throws ReflectionException When $class is not found and is required * * @internal to be removed in Symfony 5.0 */ public static function throwOnRequiredClass($class) { - $e = new \ReflectionException("Class {$class} does not exist"); - $trace = \debug_backtrace(); + $e = new ReflectionException("Class {$class} does not exist"); + $trace = debug_backtrace(); $autoloadFrame = ['function' => 'spl_autoload_call', 'args' => [$class]]; - $i = 1 + \array_search($autoloadFrame, $trace, \true); + $i = 1 + array_search($autoloadFrame, $trace, true); if (isset($trace[$i]['function']) && !isset($trace[$i]['class'])) { switch ($trace[$i]['function']) { case 'get_class_methods': diff --git a/vendor/symfony/cache/Adapter/PhpFilesAdapter.php b/vendor/symfony/cache/Adapter/PhpFilesAdapter.php index 12ecac92c..357c8edc4 100644 --- a/vendor/symfony/cache/Adapter/PhpFilesAdapter.php +++ b/vendor/symfony/cache/Adapter/PhpFilesAdapter.php @@ -13,7 +13,12 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\CacheException; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\PhpFilesTrait; -class PhpFilesAdapter extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AbstractAdapter implements \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface +use Exception; +use function filter_var; +use function ini_get; +use const FILTER_VALIDATE_BOOLEAN; + +class PhpFilesAdapter extends AbstractAdapter implements PruneableInterface { use PhpFilesTrait; /** @@ -26,14 +31,14 @@ class PhpFilesAdapter extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\A public function __construct($namespace = '', $defaultLifetime = 0, $directory = null) { if (!static::isSupported()) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\CacheException('OPcache is not enabled.'); + throw new CacheException('OPcache is not enabled.'); } parent::__construct('', $defaultLifetime); $this->init($namespace, $directory); - $e = new \Exception(); + $e = new Exception(); $this->includeHandler = function () use($e) { throw $e; }; - $this->zendDetectUnicode = \filter_var(\ini_get('zend.detect_unicode'), \FILTER_VALIDATE_BOOLEAN); + $this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), FILTER_VALIDATE_BOOLEAN); } } diff --git a/vendor/symfony/cache/Adapter/ProxyAdapter.php b/vendor/symfony/cache/Adapter/ProxyAdapter.php index 960ea70ef..5b732f3ad 100644 --- a/vendor/symfony/cache/Adapter/ProxyAdapter.php +++ b/vendor/symfony/cache/Adapter/ProxyAdapter.php @@ -16,10 +16,17 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\ProxyTrait; +use Closure; +use DateTime; +use function spl_object_hash; +use function strlen; +use function substr; +use function time; + /** * @author Nicolas Grekas */ -class ProxyAdapter implements \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AdapterInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface +class ProxyAdapter implements AdapterInterface, PruneableInterface, ResettableInterface { use ProxyTrait; private $namespace; @@ -30,14 +37,14 @@ class ProxyAdapter implements \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\A * @param string $namespace * @param int $defaultLifetime */ - public function __construct(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemPoolInterface $pool, $namespace = '', $defaultLifetime = 0) + public function __construct(CacheItemPoolInterface $pool, $namespace = '', $defaultLifetime = 0) { $this->pool = $pool; - $this->poolHash = $poolHash = \spl_object_hash($pool); - $this->namespace = '' === $namespace ? '' : \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::validateKey($namespace); - $this->namespaceLen = \strlen($namespace); - $this->createCacheItem = \Closure::bind(static function ($key, $innerItem) use($defaultLifetime, $poolHash) { - $item = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem(); + $this->poolHash = $poolHash = spl_object_hash($pool); + $this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace); + $this->namespaceLen = strlen($namespace); + $this->createCacheItem = Closure::bind(static function ($key, $innerItem) use($defaultLifetime, $poolHash) { + $item = new CacheItem(); $item->key = $key; $item->defaultLifetime = $defaultLifetime; $item->poolHash = $poolHash; @@ -48,7 +55,7 @@ public function __construct(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemPoolInte $innerItem->set(null); } return $item; - }, null, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::class); + }, null, CacheItem::class); } /** * {@inheritdoc} @@ -107,14 +114,14 @@ public function deleteItems(array $keys) /** * {@inheritdoc} */ - public function save(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item) + public function save(CacheItemInterface $item) { return $this->doSave($item, __FUNCTION__); } /** * {@inheritdoc} */ - public function saveDeferred(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item) + public function saveDeferred(CacheItemInterface $item) { return $this->doSave($item, __FUNCTION__); } @@ -125,19 +132,19 @@ public function commit() { return $this->pool->commit(); } - private function doSave(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item, $method) + private function doSave(CacheItemInterface $item, $method) { - if (!$item instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem) { - return \false; + if (!$item instanceof CacheItem) { + return false; } $item = (array) $item; $expiry = $item["\0*\0expiry"]; if (null === $expiry && 0 < $item["\0*\0defaultLifetime"]) { - $expiry = \time() + $item["\0*\0defaultLifetime"]; + $expiry = time() + $item["\0*\0defaultLifetime"]; } if ($item["\0*\0poolHash"] === $this->poolHash && $item["\0*\0innerItem"]) { $innerItem = $item["\0*\0innerItem"]; - } elseif ($this->pool instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AdapterInterface) { + } elseif ($this->pool instanceof AdapterInterface) { // this is an optimization specific for AdapterInterface implementations // so we can save a round-trip to the backend by just creating a new item $f = $this->createCacheItem; @@ -146,7 +153,7 @@ private function doSave(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $i $innerItem = $this->pool->getItem($this->namespace . $item["\0*\0key"]); } $innerItem->set($item["\0*\0value"]); - $innerItem->expiresAt(null !== $expiry ? \DateTime::createFromFormat('U', $expiry) : null); + $innerItem->expiresAt(null !== $expiry ? DateTime::createFromFormat('U', $expiry) : null); return $this->pool->{$method}($innerItem); } private function generateItems($items) @@ -154,14 +161,14 @@ private function generateItems($items) $f = $this->createCacheItem; foreach ($items as $key => $item) { if ($this->namespaceLen) { - $key = \substr($key, $this->namespaceLen); + $key = substr($key, $this->namespaceLen); } (yield $key => $f($key, $item)); } } private function getId($key) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::validateKey($key); + CacheItem::validateKey($key); return $this->namespace . $key; } } diff --git a/vendor/symfony/cache/Adapter/RedisAdapter.php b/vendor/symfony/cache/Adapter/RedisAdapter.php index 83eb8f625..6f4dedb5b 100644 --- a/vendor/symfony/cache/Adapter/RedisAdapter.php +++ b/vendor/symfony/cache/Adapter/RedisAdapter.php @@ -11,11 +11,16 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\RedisTrait; -class RedisAdapter extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AbstractAdapter +use Predis\Client; +use Redis; +use RedisArray; +use RedisCluster; + +class RedisAdapter extends AbstractAdapter { use RedisTrait; /** - * @param \Redis|\RedisArray|\RedisCluster|\Predis\Client $redisClient The redis client + * @param Redis|RedisArray|RedisCluster|Client $redisClient The redis client * @param string $namespace The default namespace * @param int $defaultLifetime The default lifetime */ diff --git a/vendor/symfony/cache/Adapter/SimpleCacheAdapter.php b/vendor/symfony/cache/Adapter/SimpleCacheAdapter.php index e4156ca8d..7a7276e3f 100644 --- a/vendor/symfony/cache/Adapter/SimpleCacheAdapter.php +++ b/vendor/symfony/cache/Adapter/SimpleCacheAdapter.php @@ -13,10 +13,12 @@ use _PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\ProxyTrait; +use stdClass; + /** * @author Nicolas Grekas */ -class SimpleCacheAdapter extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AbstractAdapter implements \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface +class SimpleCacheAdapter extends AbstractAdapter implements PruneableInterface { /** * @internal @@ -24,11 +26,11 @@ class SimpleCacheAdapter extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cach const NS_SEPARATOR = '_'; use ProxyTrait; private $miss; - public function __construct(\_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheInterface $pool, $namespace = '', $defaultLifetime = 0) + public function __construct(CacheInterface $pool, $namespace = '', $defaultLifetime = 0) { parent::__construct($namespace, $defaultLifetime); $this->pool = $pool; - $this->miss = new \stdClass(); + $this->miss = new stdClass(); } /** * {@inheritdoc} diff --git a/vendor/symfony/cache/Adapter/TagAwareAdapter.php b/vendor/symfony/cache/Adapter/TagAwareAdapter.php index a277d5c9a..2fe3c69f7 100644 --- a/vendor/symfony/cache/Adapter/TagAwareAdapter.php +++ b/vendor/symfony/cache/Adapter/TagAwareAdapter.php @@ -16,10 +16,18 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\ProxyTrait; +use BadMethodCallException; +use Closure; +use function array_intersect_key; +use function array_keys; +use function func_num_args; +use function is_string; +use function microtime; + /** * @author Nicolas Grekas */ -class TagAwareAdapter implements \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\TagAwareAdapterInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface +class TagAwareAdapter implements TagAwareAdapterInterface, PruneableInterface, ResettableInterface { const TAGS_PREFIX = "\0tags\0"; use ProxyTrait; @@ -31,21 +39,21 @@ class TagAwareAdapter implements \_PhpScoper5ea00cc67502b\Symfony\Component\Cach private $tags; private $knownTagVersions = []; private $knownTagVersionsTtl; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AdapterInterface $itemsPool, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AdapterInterface $tagsPool = null, $knownTagVersionsTtl = 0.15) + public function __construct(AdapterInterface $itemsPool, AdapterInterface $tagsPool = null, $knownTagVersionsTtl = 0.15) { $this->pool = $itemsPool; $this->tags = $tagsPool ?: $itemsPool; $this->knownTagVersionsTtl = $knownTagVersionsTtl; - $this->createCacheItem = \Closure::bind(static function ($key, $value, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem $protoItem) { - $item = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem(); + $this->createCacheItem = Closure::bind(static function ($key, $value, CacheItem $protoItem) { + $item = new CacheItem(); $item->key = $key; $item->value = $value; $item->defaultLifetime = $protoItem->defaultLifetime; $item->expiry = $protoItem->expiry; $item->poolHash = $protoItem->poolHash; return $item; - }, null, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::class); - $this->setCacheItemTags = \Closure::bind(static function (\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem $item, $key, array &$itemTags) { + }, null, CacheItem::class); + $this->setCacheItemTags = Closure::bind(static function (CacheItem $item, $key, array &$itemTags) { if (!$item->isHit) { return $item; } @@ -56,36 +64,36 @@ public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Ada unset($itemTags[$key]); } else { $item->value = null; - $item->isHit = \false; + $item->isHit = false; } return $item; - }, null, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::class); - $this->getTagsByKey = \Closure::bind(static function ($deferred) { + }, null, CacheItem::class); + $this->getTagsByKey = Closure::bind(static function ($deferred) { $tagsByKey = []; foreach ($deferred as $key => $item) { $tagsByKey[$key] = $item->tags; } return $tagsByKey; - }, null, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::class); - $this->invalidateTags = \Closure::bind(static function (\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AdapterInterface $tagsAdapter, array $tags) { + }, null, CacheItem::class); + $this->invalidateTags = Closure::bind(static function (AdapterInterface $tagsAdapter, array $tags) { foreach ($tags as $v) { $v->defaultLifetime = 0; $v->expiry = null; $tagsAdapter->saveDeferred($v); } return $tagsAdapter->commit(); - }, null, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::class); + }, null, CacheItem::class); } /** * {@inheritdoc} */ public function invalidateTags(array $tags) { - $ok = \true; + $ok = true; $tagsByKey = []; $invalidatedTags = []; foreach ($tags as $tag) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::validateKey($tag); + CacheItem::validateKey($tag); $invalidatedTags[$tag] = 0; } if ($this->deferred) { @@ -93,7 +101,7 @@ public function invalidateTags(array $tags) foreach ($items as $key => $item) { if (!$this->pool->saveDeferred($item)) { unset($this->deferred[$key]); - $ok = \false; + $ok = false; } } $f = $this->getTagsByKey; @@ -103,7 +111,7 @@ public function invalidateTags(array $tags) $tagVersions = $this->getTagVersions($tagsByKey, $invalidatedTags); $f = $this->createCacheItem; foreach ($tagsByKey as $key => $tags) { - $this->pool->saveDeferred($f(static::TAGS_PREFIX . $key, \array_intersect_key($tagVersions, $tags), $items[$key])); + $this->pool->saveDeferred($f(static::TAGS_PREFIX . $key, array_intersect_key($tagVersions, $tags), $items[$key])); } $ok = $this->pool->commit() && $ok; if ($invalidatedTags) { @@ -121,21 +129,21 @@ public function hasItem($key) $this->commit(); } if (!$this->pool->hasItem($key)) { - return \false; + return false; } $itemTags = $this->pool->getItem(static::TAGS_PREFIX . $key); if (!$itemTags->isHit()) { - return \false; + return false; } if (!($itemTags = $itemTags->get())) { - return \true; + return true; } foreach ($this->getTagVersions([$itemTags]) as $tag => $version) { if ($itemTags[$tag] !== $version && 1 !== $itemTags[$tag] - $version) { - return \false; + return false; } } - return \true; + return true; } /** * {@inheritdoc} @@ -157,14 +165,14 @@ public function getItems(array $keys = []) } $tagKeys = []; foreach ($keys as $key) { - if ('' !== $key && \is_string($key)) { + if ('' !== $key && is_string($key)) { $key = static::TAGS_PREFIX . $key; $tagKeys[$key] = $key; } } try { $items = $this->pool->getItems($tagKeys + $keys); - } catch (\_PhpScoper5ea00cc67502b\Psr\Cache\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $this->pool->getItems($keys); // Should throw an exception throw $e; @@ -192,7 +200,7 @@ public function deleteItem($key) public function deleteItems(array $keys) { foreach ($keys as $key) { - if ('' !== $key && \is_string($key)) { + if ('' !== $key && is_string($key)) { $keys[] = static::TAGS_PREFIX . $key; } } @@ -201,10 +209,10 @@ public function deleteItems(array $keys) /** * {@inheritdoc} */ - public function save(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item) + public function save(CacheItemInterface $item) { - if (!$item instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem) { - return \false; + if (!$item instanceof CacheItem) { + return false; } $this->deferred[$item->getKey()] = $item; return $this->commit(); @@ -212,13 +220,13 @@ public function save(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item /** * {@inheritdoc} */ - public function saveDeferred(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item) + public function saveDeferred(CacheItemInterface $item) { - if (!$item instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem) { - return \false; + if (!$item instanceof CacheItem) { + return false; } $this->deferred[$item->getKey()] = $item; - return \true; + return true; } /** * {@inheritdoc} @@ -229,11 +237,11 @@ public function commit() } public function __sleep() { - throw new \BadMethodCallException('Cannot serialize ' . __CLASS__); + throw new BadMethodCallException('Cannot serialize ' . __CLASS__); } public function __wakeup() { - throw new \BadMethodCallException('Cannot unserialize ' . __CLASS__); + throw new BadMethodCallException('Cannot unserialize ' . __CLASS__); } public function __destruct() { @@ -283,7 +291,7 @@ private function getTagVersions(array $tagsByKey, array &$invalidatedTags = []) if (!$tagVersions) { return []; } - if (!($fetchTagVersions = 1 !== \func_num_args())) { + if (!($fetchTagVersions = 1 !== func_num_args())) { foreach ($tagsByKey as $tags) { foreach ($tags as $tag => $version) { if ($tagVersions[$tag] > $version) { @@ -292,18 +300,18 @@ private function getTagVersions(array $tagsByKey, array &$invalidatedTags = []) } } } - $now = \microtime(\true); + $now = microtime(true); $tags = []; foreach ($tagVersions as $tag => $version) { $tags[$tag . static::TAGS_PREFIX] = $tag; if ($fetchTagVersions || !isset($this->knownTagVersions[$tag])) { - $fetchTagVersions = \true; + $fetchTagVersions = true; continue; } $version -= $this->knownTagVersions[$tag][1]; if (0 !== $version && 1 !== $version || $now - $this->knownTagVersions[$tag][0] >= $this->knownTagVersionsTtl) { // reuse previously fetched tag versions up to the ttl, unless we are storing items or a potential miss arises - $fetchTagVersions = \true; + $fetchTagVersions = true; } else { $this->knownTagVersions[$tag][1] += $version; } @@ -311,7 +319,7 @@ private function getTagVersions(array $tagsByKey, array &$invalidatedTags = []) if (!$fetchTagVersions) { return $tagVersions; } - foreach ($this->tags->getItems(\array_keys($tags)) as $tag => $version) { + foreach ($this->tags->getItems(array_keys($tags)) as $tag => $version) { $tagVersions[$tag = $tags[$tag]] = $version->get() ?: 0; if (isset($invalidatedTags[$tag])) { $invalidatedTags[$tag] = $version->set(++$tagVersions[$tag]); diff --git a/vendor/symfony/cache/Adapter/TagAwareAdapterInterface.php b/vendor/symfony/cache/Adapter/TagAwareAdapterInterface.php index c3ca04fa4..1e82c8cb3 100644 --- a/vendor/symfony/cache/Adapter/TagAwareAdapterInterface.php +++ b/vendor/symfony/cache/Adapter/TagAwareAdapterInterface.php @@ -16,7 +16,7 @@ * * @author Nicolas Grekas */ -interface TagAwareAdapterInterface extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AdapterInterface +interface TagAwareAdapterInterface extends AdapterInterface { /** * Invalidates cached items using tags. diff --git a/vendor/symfony/cache/Adapter/TraceableAdapter.php b/vendor/symfony/cache/Adapter/TraceableAdapter.php index 45ddbb9ac..1bf3a4dcd 100644 --- a/vendor/symfony/cache/Adapter/TraceableAdapter.php +++ b/vendor/symfony/cache/Adapter/TraceableAdapter.php @@ -13,6 +13,8 @@ use _PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface; +use function microtime; + /** * An adapter that collects data about all cache calls. * @@ -20,11 +22,11 @@ * @author Tobias Nyholm * @author Nicolas Grekas */ -class TraceableAdapter implements \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AdapterInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface +class TraceableAdapter implements AdapterInterface, PruneableInterface, ResettableInterface { protected $pool; private $calls = []; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AdapterInterface $pool) + public function __construct(AdapterInterface $pool) { $this->pool = $pool; } @@ -37,7 +39,7 @@ public function getItem($key) try { $item = $this->pool->getItem($key); } finally { - $event->end = \microtime(\true); + $event->end = microtime(true); } if ($event->result[$key] = $item->isHit()) { ++$event->hits; @@ -55,7 +57,7 @@ public function hasItem($key) try { return $event->result[$key] = $this->pool->hasItem($key); } finally { - $event->end = \microtime(\true); + $event->end = microtime(true); } } /** @@ -67,31 +69,31 @@ public function deleteItem($key) try { return $event->result[$key] = $this->pool->deleteItem($key); } finally { - $event->end = \microtime(\true); + $event->end = microtime(true); } } /** * {@inheritdoc} */ - public function save(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item) + public function save(CacheItemInterface $item) { $event = $this->start(__FUNCTION__); try { return $event->result[$item->getKey()] = $this->pool->save($item); } finally { - $event->end = \microtime(\true); + $event->end = microtime(true); } } /** * {@inheritdoc} */ - public function saveDeferred(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item) + public function saveDeferred(CacheItemInterface $item) { $event = $this->start(__FUNCTION__); try { return $event->result[$item->getKey()] = $this->pool->saveDeferred($item); } finally { - $event->end = \microtime(\true); + $event->end = microtime(true); } } /** @@ -103,7 +105,7 @@ public function getItems(array $keys = []) try { $result = $this->pool->getItems($keys); } finally { - $event->end = \microtime(\true); + $event->end = microtime(true); } $f = function () use($result, $event) { $event->result = []; @@ -127,7 +129,7 @@ public function clear() try { return $event->result = $this->pool->clear(); } finally { - $event->end = \microtime(\true); + $event->end = microtime(true); } } /** @@ -140,7 +142,7 @@ public function deleteItems(array $keys) try { return $event->result['result'] = $this->pool->deleteItems($keys); } finally { - $event->end = \microtime(\true); + $event->end = microtime(true); } } /** @@ -152,7 +154,7 @@ public function commit() try { return $event->result = $this->pool->commit(); } finally { - $event->end = \microtime(\true); + $event->end = microtime(true); } } /** @@ -160,14 +162,14 @@ public function commit() */ public function prune() { - if (!$this->pool instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface) { - return \false; + if (!$this->pool instanceof PruneableInterface) { + return false; } $event = $this->start(__FUNCTION__); try { return $event->result = $this->pool->prune(); } finally { - $event->end = \microtime(\true); + $event->end = microtime(true); } } /** @@ -175,14 +177,14 @@ public function prune() */ public function reset() { - if (!$this->pool instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface) { + if (!$this->pool instanceof ResettableInterface) { return; } $event = $this->start(__FUNCTION__); try { $this->pool->reset(); } finally { - $event->end = \microtime(\true); + $event->end = microtime(true); } } public function getCalls() @@ -195,9 +197,9 @@ public function clearCalls() } protected function start($name) { - $this->calls[] = $event = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\TraceableAdapterEvent(); + $this->calls[] = $event = new TraceableAdapterEvent(); $event->name = $name; - $event->start = \microtime(\true); + $event->start = microtime(true); return $event; } } diff --git a/vendor/symfony/cache/Adapter/TraceableTagAwareAdapter.php b/vendor/symfony/cache/Adapter/TraceableTagAwareAdapter.php index f0a2e4d4e..383a6f7ba 100644 --- a/vendor/symfony/cache/Adapter/TraceableTagAwareAdapter.php +++ b/vendor/symfony/cache/Adapter/TraceableTagAwareAdapter.php @@ -10,12 +10,14 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter; +use function microtime; + /** * @author Robin Chalas */ -class TraceableTagAwareAdapter extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\TraceableAdapter implements \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\TagAwareAdapterInterface +class TraceableTagAwareAdapter extends TraceableAdapter implements TagAwareAdapterInterface { - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\TagAwareAdapterInterface $pool) + public function __construct(TagAwareAdapterInterface $pool) { parent::__construct($pool); } @@ -28,7 +30,7 @@ public function invalidateTags(array $tags) try { return $event->result = $this->pool->invalidateTags($tags); } finally { - $event->end = \microtime(\true); + $event->end = microtime(true); } } } diff --git a/vendor/symfony/cache/Adapter/index.php b/vendor/symfony/cache/Adapter/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/cache/Adapter/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/cache/CacheItem.php b/vendor/symfony/cache/CacheItem.php index 29df83358..5c28ca7e2 100644 --- a/vendor/symfony/cache/CacheItem.php +++ b/vendor/symfony/cache/CacheItem.php @@ -13,14 +13,31 @@ use _PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface; use _PhpScoper5ea00cc67502b\Psr\Log\LoggerInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException; +use DateInterval; +use DateTime; +use DateTimeInterface; +use function get_class; +use function gettype; +use function is_array; +use function is_int; +use function is_object; +use function is_scalar; +use function is_string; +use function sprintf; +use function strpbrk; +use function strtr; +use function time; +use function trigger_error; +use const E_USER_WARNING; + /** * @author Nicolas Grekas */ -final class CacheItem implements \_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface +final class CacheItem implements CacheItemInterface { protected $key; protected $value; - protected $isHit = \false; + protected $isHit = false; protected $expiry; protected $defaultLifetime; protected $tags = []; @@ -66,11 +83,11 @@ public function set($value) public function expiresAt($expiration) { if (null === $expiration) { - $this->expiry = $this->defaultLifetime > 0 ? \time() + $this->defaultLifetime : null; - } elseif ($expiration instanceof \DateTimeInterface) { + $this->expiry = $this->defaultLifetime > 0 ? time() + $this->defaultLifetime : null; + } elseif ($expiration instanceof DateTimeInterface) { $this->expiry = (int) $expiration->format('U'); } else { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Expiration date must implement DateTimeInterface or be null, "%s" given.', \is_object($expiration) ? \get_class($expiration) : \gettype($expiration))); + throw new InvalidArgumentException(sprintf('Expiration date must implement DateTimeInterface or be null, "%s" given.', is_object($expiration) ? get_class($expiration) : gettype($expiration))); } return $this; } @@ -82,13 +99,13 @@ public function expiresAt($expiration) public function expiresAfter($time) { if (null === $time) { - $this->expiry = $this->defaultLifetime > 0 ? \time() + $this->defaultLifetime : null; - } elseif ($time instanceof \DateInterval) { - $this->expiry = (int) \DateTime::createFromFormat('U', \time())->add($time)->format('U'); - } elseif (\is_int($time)) { - $this->expiry = $time + \time(); + $this->expiry = $this->defaultLifetime > 0 ? time() + $this->defaultLifetime : null; + } elseif ($time instanceof DateInterval) { + $this->expiry = (int) DateTime::createFromFormat('U', time())->add($time)->format('U'); + } elseif (is_int($time)) { + $this->expiry = $time + time(); } else { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given.', \is_object($time) ? \get_class($time) : \gettype($time))); + throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given.', is_object($time) ? get_class($time) : gettype($time))); } return $this; } @@ -103,21 +120,21 @@ public function expiresAfter($time) */ public function tag($tags) { - if (!\is_array($tags)) { + if (!is_array($tags)) { $tags = [$tags]; } foreach ($tags as $tag) { - if (!\is_string($tag)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache tag must be string, "%s" given.', \is_object($tag) ? \get_class($tag) : \gettype($tag))); + if (!is_string($tag)) { + throw new InvalidArgumentException(sprintf('Cache tag must be string, "%s" given.', is_object($tag) ? get_class($tag) : gettype($tag))); } if (isset($this->tags[$tag])) { continue; } if ('' === $tag) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException('Cache tag length must be greater than zero.'); + throw new InvalidArgumentException('Cache tag length must be greater than zero.'); } - if (\false !== \strpbrk($tag, '{}()/\\@:')) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache tag "%s" contains reserved characters {}()/\\@:.', $tag)); + if (false !== strpbrk($tag, '{}()/\\@:')) { + throw new InvalidArgumentException(sprintf('Cache tag "%s" contains reserved characters {}()/\\@:.', $tag)); } $this->tags[$tag] = $tag; } @@ -143,14 +160,14 @@ public function getPreviousTags() */ public static function validateKey($key) { - if (!\is_string($key)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache key must be string, "%s" given.', \is_object($key) ? \get_class($key) : \gettype($key))); + if (!is_string($key)) { + throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', is_object($key) ? get_class($key) : gettype($key))); } if ('' === $key) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException('Cache key length must be greater than zero.'); + throw new InvalidArgumentException('Cache key length must be greater than zero.'); } - if (\false !== \strpbrk($key, '{}()/\\@:')) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache key "%s" contains reserved characters {}()/\\@:.', $key)); + if (false !== strpbrk($key, '{}()/\\@:')) { + throw new InvalidArgumentException(sprintf('Cache key "%s" contains reserved characters {}()/\\@:.', $key)); } return $key; } @@ -159,18 +176,18 @@ public static function validateKey($key) * * @internal */ - public static function log(\_PhpScoper5ea00cc67502b\Psr\Log\LoggerInterface $logger = null, $message, $context = []) + public static function log(LoggerInterface $logger = null, $message, $context = []) { if ($logger) { $logger->warning($message, $context); } else { $replace = []; foreach ($context as $k => $v) { - if (\is_scalar($v)) { + if (is_scalar($v)) { $replace['{' . $k . '}'] = $v; } } - @\trigger_error(\strtr($message, $replace), \E_USER_WARNING); + @trigger_error(strtr($message, $replace), E_USER_WARNING); } } } diff --git a/vendor/symfony/cache/DataCollector/CacheDataCollector.php b/vendor/symfony/cache/DataCollector/CacheDataCollector.php index 3f555d87f..63d8e0399 100644 --- a/vendor/symfony/cache/DataCollector/CacheDataCollector.php +++ b/vendor/symfony/cache/DataCollector/CacheDataCollector.php @@ -16,11 +16,14 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\HttpFoundation\Response; use _PhpScoper5ea00cc67502b\Symfony\Component\HttpKernel\DataCollector\DataCollector; use _PhpScoper5ea00cc67502b\Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface; +use Exception; +use function round; + /** * @author Aaron Scherer * @author Tobias Nyholm */ -class CacheDataCollector extends \_PhpScoper5ea00cc67502b\Symfony\Component\HttpKernel\DataCollector\DataCollector implements \_PhpScoper5ea00cc67502b\Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface +class CacheDataCollector extends DataCollector implements LateDataCollectorInterface { /** * @var TraceableAdapter[] @@ -29,14 +32,14 @@ class CacheDataCollector extends \_PhpScoper5ea00cc67502b\Symfony\Component\Http /** * @param string $name */ - public function addInstance($name, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\TraceableAdapter $instance) + public function addInstance($name, TraceableAdapter $instance) { $this->instances[$name] = $instance; } /** * {@inheritdoc} */ - public function collect(\_PhpScoper5ea00cc67502b\Symfony\Component\HttpFoundation\Request $request, \_PhpScoper5ea00cc67502b\Symfony\Component\HttpFoundation\Response $response, \Exception $exception = null) + public function collect(Request $request, Response $response, Exception $exception = null) { $empty = ['calls' => [], 'config' => [], 'options' => [], 'statistics' => []]; $this->data = ['instances' => $empty, 'total' => $empty]; @@ -116,7 +119,7 @@ private function calculateStatistics() $statistics[$name]['misses'] += $call->misses; } elseif ('hasItem' === $call->name) { ++$statistics[$name]['reads']; - if (\false === $call->result) { + if (false === $call->result) { ++$statistics[$name]['misses']; } else { ++$statistics[$name]['hits']; @@ -128,7 +131,7 @@ private function calculateStatistics() } } if ($statistics[$name]['reads']) { - $statistics[$name]['hit_read_ratio'] = \round(100 * $statistics[$name]['hits'] / $statistics[$name]['reads'], 2); + $statistics[$name]['hit_read_ratio'] = round(100 * $statistics[$name]['hits'] / $statistics[$name]['reads'], 2); } else { $statistics[$name]['hit_read_ratio'] = null; } @@ -148,7 +151,7 @@ private function calculateTotalStatistics() } } if ($totals['reads']) { - $totals['hit_read_ratio'] = \round(100 * $totals['hits'] / $totals['reads'], 2); + $totals['hit_read_ratio'] = round(100 * $totals['hits'] / $totals['reads'], 2); } else { $totals['hit_read_ratio'] = null; } diff --git a/vendor/symfony/cache/DataCollector/index.php b/vendor/symfony/cache/DataCollector/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/cache/DataCollector/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/cache/DoctrineProvider.php b/vendor/symfony/cache/DoctrineProvider.php index 0cc1782c6..8642f5bb8 100644 --- a/vendor/symfony/cache/DoctrineProvider.php +++ b/vendor/symfony/cache/DoctrineProvider.php @@ -12,13 +12,15 @@ use _PhpScoper5ea00cc67502b\Doctrine\Common\Cache\CacheProvider; use _PhpScoper5ea00cc67502b\Psr\Cache\CacheItemPoolInterface; +use function rawurlencode; + /** * @author Nicolas Grekas */ -class DoctrineProvider extends \_PhpScoper5ea00cc67502b\Doctrine\Common\Cache\CacheProvider implements \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface +class DoctrineProvider extends CacheProvider implements PruneableInterface, ResettableInterface { private $pool; - public function __construct(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemPoolInterface $pool) + public function __construct(CacheItemPoolInterface $pool) { $this->pool = $pool; } @@ -27,14 +29,14 @@ public function __construct(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemPoolInte */ public function prune() { - return $this->pool instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface && $this->pool->prune(); + return $this->pool instanceof PruneableInterface && $this->pool->prune(); } /** * {@inheritdoc} */ public function reset() { - if ($this->pool instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface) { + if ($this->pool instanceof ResettableInterface) { $this->pool->reset(); } $this->setNamespace($this->getNamespace()); @@ -44,22 +46,22 @@ public function reset() */ protected function doFetch($id) { - $item = $this->pool->getItem(\rawurlencode($id)); - return $item->isHit() ? $item->get() : \false; + $item = $this->pool->getItem(rawurlencode($id)); + return $item->isHit() ? $item->get() : false; } /** * {@inheritdoc} */ protected function doContains($id) { - return $this->pool->hasItem(\rawurlencode($id)); + return $this->pool->hasItem(rawurlencode($id)); } /** * {@inheritdoc} */ protected function doSave($id, $data, $lifeTime = 0) { - $item = $this->pool->getItem(\rawurlencode($id)); + $item = $this->pool->getItem(rawurlencode($id)); if (0 < $lifeTime) { $item->expiresAfter($lifeTime); } @@ -70,7 +72,7 @@ protected function doSave($id, $data, $lifeTime = 0) */ protected function doDelete($id) { - return $this->pool->deleteItem(\rawurlencode($id)); + return $this->pool->deleteItem(rawurlencode($id)); } /** * {@inheritdoc} diff --git a/vendor/symfony/cache/Exception/CacheException.php b/vendor/symfony/cache/Exception/CacheException.php index 79facebe4..111dbded3 100644 --- a/vendor/symfony/cache/Exception/CacheException.php +++ b/vendor/symfony/cache/Exception/CacheException.php @@ -12,6 +12,8 @@ use _PhpScoper5ea00cc67502b\Psr\Cache\CacheException as Psr6CacheInterface; use _PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheException as SimpleCacheInterface; -class CacheException extends \Exception implements \_PhpScoper5ea00cc67502b\Psr\Cache\CacheException, \_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheException +use Exception; + +class CacheException extends Exception implements Psr6CacheInterface, SimpleCacheInterface { } diff --git a/vendor/symfony/cache/Exception/InvalidArgumentException.php b/vendor/symfony/cache/Exception/InvalidArgumentException.php index c22260291..11b89572a 100644 --- a/vendor/symfony/cache/Exception/InvalidArgumentException.php +++ b/vendor/symfony/cache/Exception/InvalidArgumentException.php @@ -12,6 +12,6 @@ use _PhpScoper5ea00cc67502b\Psr\Cache\InvalidArgumentException as Psr6CacheInterface; use _PhpScoper5ea00cc67502b\Psr\SimpleCache\InvalidArgumentException as SimpleCacheInterface; -class InvalidArgumentException extends \InvalidArgumentException implements \_PhpScoper5ea00cc67502b\Psr\Cache\InvalidArgumentException, \_PhpScoper5ea00cc67502b\Psr\SimpleCache\InvalidArgumentException +class InvalidArgumentException extends \InvalidArgumentException implements Psr6CacheInterface, SimpleCacheInterface { } diff --git a/vendor/symfony/cache/Exception/index.php b/vendor/symfony/cache/Exception/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/cache/Exception/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/cache/Simple/AbstractCache.php b/vendor/symfony/cache/Simple/AbstractCache.php index a57e02dcc..fb377d130 100644 --- a/vendor/symfony/cache/Simple/AbstractCache.php +++ b/vendor/symfony/cache/Simple/AbstractCache.php @@ -16,10 +16,29 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\AbstractTrait; +use DateInterval; +use DateTime; +use Exception; +use Traversable; +use function array_combine; +use function array_keys; +use function array_values; +use function get_class; +use function gettype; +use function is_array; +use function is_int; +use function is_object; +use function iterator_to_array; +use function key; +use function max; +use function sprintf; +use function strlen; +use function substr; + /** * @author Nicolas Grekas */ -abstract class AbstractCache implements \_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheInterface, \_PhpScoper5ea00cc67502b\Psr\Log\LoggerAwareInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface +abstract class AbstractCache implements CacheInterface, LoggerAwareInterface, ResettableInterface { /** * @internal @@ -37,10 +56,10 @@ abstract class AbstractCache implements \_PhpScoper5ea00cc67502b\Psr\SimpleCache */ protected function __construct($namespace = '', $defaultLifetime = 0) { - $this->defaultLifetime = \max(0, (int) $defaultLifetime); - $this->namespace = '' === $namespace ? '' : \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::validateKey($namespace) . ':'; - if (null !== $this->maxIdLength && \strlen($namespace) > $this->maxIdLength - 24) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Namespace must be %d chars max, %d given ("%s").', $this->maxIdLength - 24, \strlen($namespace), $namespace)); + $this->defaultLifetime = max(0, (int) $defaultLifetime); + $this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace) . ':'; + if (null !== $this->maxIdLength && strlen($namespace) > $this->maxIdLength - 24) { + throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s").', $this->maxIdLength - 24, strlen($namespace), $namespace)); } } /** @@ -53,8 +72,8 @@ public function get($key, $default = null) foreach ($this->doFetch([$id]) as $value) { return $value; } - } catch (\Exception $e) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::log($this->logger, 'Failed to fetch key "{key}"', ['key' => $key, 'exception' => $e]); + } catch (Exception $e) { + CacheItem::log($this->logger, 'Failed to fetch key "{key}"', ['key' => $key, 'exception' => $e]); } return $default; } @@ -63,7 +82,7 @@ public function get($key, $default = null) */ public function set($key, $value, $ttl = null) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::validateKey($key); + CacheItem::validateKey($key); return $this->setMultiple([$key => $value], $ttl); } /** @@ -71,10 +90,10 @@ public function set($key, $value, $ttl = null) */ public function getMultiple($keys, $default = null) { - if ($keys instanceof \Traversable) { - $keys = \iterator_to_array($keys, \false); - } elseif (!\is_array($keys)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys))); + if ($keys instanceof Traversable) { + $keys = iterator_to_array($keys, false); + } elseif (!is_array($keys)) { + throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', is_object($keys) ? get_class($keys) : gettype($keys))); } $ids = []; foreach ($keys as $key) { @@ -82,11 +101,11 @@ public function getMultiple($keys, $default = null) } try { $values = $this->doFetch($ids); - } catch (\Exception $e) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::log($this->logger, 'Failed to fetch requested values', ['keys' => $keys, 'exception' => $e]); + } catch (Exception $e) { + CacheItem::log($this->logger, 'Failed to fetch requested values', ['keys' => $keys, 'exception' => $e]); $values = []; } - $ids = \array_combine($ids, $keys); + $ids = array_combine($ids, $keys); return $this->generateValues($values, $ids, $default); } /** @@ -94,42 +113,42 @@ public function getMultiple($keys, $default = null) */ public function setMultiple($values, $ttl = null) { - if (!\is_array($values) && !$values instanceof \Traversable) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache values must be array or Traversable, "%s" given.', \is_object($values) ? \get_class($values) : \gettype($values))); + if (!is_array($values) && !$values instanceof Traversable) { + throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given.', is_object($values) ? get_class($values) : gettype($values))); } $valuesById = []; foreach ($values as $key => $value) { - if (\is_int($key)) { + if (is_int($key)) { $key = (string) $key; } $valuesById[$this->getId($key)] = $value; } - if (\false === ($ttl = $this->normalizeTtl($ttl))) { - return $this->doDelete(\array_keys($valuesById)); + if (false === ($ttl = $this->normalizeTtl($ttl))) { + return $this->doDelete(array_keys($valuesById)); } try { $e = $this->doSave($valuesById, $ttl); - } catch (\Exception $e) { + } catch (Exception $e) { } - if (\true === $e || [] === $e) { - return \true; + if (true === $e || [] === $e) { + return true; } $keys = []; - foreach (\is_array($e) ? $e : \array_keys($valuesById) as $id) { - $keys[] = \substr($id, \strlen($this->namespace)); + foreach (is_array($e) ? $e : array_keys($valuesById) as $id) { + $keys[] = substr($id, strlen($this->namespace)); } - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::log($this->logger, 'Failed to save values', ['keys' => $keys, 'exception' => $e instanceof \Exception ? $e : null]); - return \false; + CacheItem::log($this->logger, 'Failed to save values', ['keys' => $keys, 'exception' => $e instanceof Exception ? $e : null]); + return false; } /** * {@inheritdoc} */ public function deleteMultiple($keys) { - if ($keys instanceof \Traversable) { - $keys = \iterator_to_array($keys, \false); - } elseif (!\is_array($keys)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys))); + if ($keys instanceof Traversable) { + $keys = iterator_to_array($keys, false); + } elseif (!is_array($keys)) { + throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', is_object($keys) ? get_class($keys) : gettype($keys))); } return $this->deleteItems($keys); } @@ -138,27 +157,27 @@ private function normalizeTtl($ttl) if (null === $ttl) { return $this->defaultLifetime; } - if ($ttl instanceof \DateInterval) { - $ttl = (int) \DateTime::createFromFormat('U', 0)->add($ttl)->format('U'); + if ($ttl instanceof DateInterval) { + $ttl = (int) DateTime::createFromFormat('U', 0)->add($ttl)->format('U'); } - if (\is_int($ttl)) { - return 0 < $ttl ? $ttl : \false; + if (is_int($ttl)) { + return 0 < $ttl ? $ttl : false; } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given.', \is_object($ttl) ? \get_class($ttl) : \gettype($ttl))); + throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given.', is_object($ttl) ? get_class($ttl) : gettype($ttl))); } private function generateValues($values, &$keys, $default) { try { foreach ($values as $id => $value) { if (!isset($keys[$id])) { - $id = \key($keys); + $id = key($keys); } $key = $keys[$id]; unset($keys[$id]); (yield $key => $value); } - } catch (\Exception $e) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::log($this->logger, 'Failed to fetch requested values', ['keys' => \array_values($keys), 'exception' => $e]); + } catch (Exception $e) { + CacheItem::log($this->logger, 'Failed to fetch requested values', ['keys' => array_values($keys), 'exception' => $e]); } foreach ($keys as $key) { (yield $key => $default); diff --git a/vendor/symfony/cache/Simple/ApcuCache.php b/vendor/symfony/cache/Simple/ApcuCache.php index a2861362b..da64e48d9 100644 --- a/vendor/symfony/cache/Simple/ApcuCache.php +++ b/vendor/symfony/cache/Simple/ApcuCache.php @@ -11,7 +11,7 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\ApcuTrait; -class ApcuCache extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\AbstractCache +class ApcuCache extends AbstractCache { use ApcuTrait; /** diff --git a/vendor/symfony/cache/Simple/ArrayCache.php b/vendor/symfony/cache/Simple/ArrayCache.php index 9e633f1a6..6b0f38da9 100644 --- a/vendor/symfony/cache/Simple/ArrayCache.php +++ b/vendor/symfony/cache/Simple/ArrayCache.php @@ -16,10 +16,26 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\ArrayTrait; +use DateInterval; +use DateTime; +use Exception; +use Traversable; +use function array_keys; +use function get_class; +use function gettype; +use function is_array; +use function is_int; +use function is_object; +use function iterator_to_array; +use function serialize; +use function sprintf; +use function time; +use const PHP_INT_MAX; + /** * @author Nicolas Grekas */ -class ArrayCache implements \_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheInterface, \_PhpScoper5ea00cc67502b\Psr\Log\LoggerAwareInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface +class ArrayCache implements CacheInterface, LoggerAwareInterface, ResettableInterface { use ArrayTrait { ArrayTrait::deleteItem as delete; @@ -30,7 +46,7 @@ class ArrayCache implements \_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheInterf * @param int $defaultLifetime * @param bool $storeSerialized Disabling serialization can lead to cache corruptions when storing mutable values but increases performance otherwise */ - public function __construct($defaultLifetime = 0, $storeSerialized = \true) + public function __construct($defaultLifetime = 0, $storeSerialized = true) { $this->defaultLifetime = (int) $defaultLifetime; $this->storeSerialized = $storeSerialized; @@ -49,15 +65,15 @@ public function get($key, $default = null) */ public function getMultiple($keys, $default = null) { - if ($keys instanceof \Traversable) { - $keys = \iterator_to_array($keys, \false); - } elseif (!\is_array($keys)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys))); + if ($keys instanceof Traversable) { + $keys = iterator_to_array($keys, false); + } elseif (!is_array($keys)) { + throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', is_object($keys) ? get_class($keys) : gettype($keys))); } foreach ($keys as $key) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::validateKey($key); + CacheItem::validateKey($key); } - return $this->generateItems($keys, \time(), function ($k, $v, $hit) use($default) { + return $this->generateItems($keys, time(), function ($k, $v, $hit) use($default) { return $hit ? $v : $default; }); } @@ -66,20 +82,20 @@ public function getMultiple($keys, $default = null) */ public function deleteMultiple($keys) { - if (!\is_array($keys) && !$keys instanceof \Traversable) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys))); + if (!is_array($keys) && !$keys instanceof Traversable) { + throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', is_object($keys) ? get_class($keys) : gettype($keys))); } foreach ($keys as $key) { $this->delete($key); } - return \true; + return true; } /** * {@inheritdoc} */ public function set($key, $value, $ttl = null) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::validateKey($key); + CacheItem::validateKey($key); return $this->setMultiple([$key => $value], $ttl); } /** @@ -87,46 +103,46 @@ public function set($key, $value, $ttl = null) */ public function setMultiple($values, $ttl = null) { - if (!\is_array($values) && !$values instanceof \Traversable) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache values must be array or Traversable, "%s" given.', \is_object($values) ? \get_class($values) : \gettype($values))); + if (!is_array($values) && !$values instanceof Traversable) { + throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given.', is_object($values) ? get_class($values) : gettype($values))); } $valuesArray = []; foreach ($values as $key => $value) { - \is_int($key) || \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::validateKey($key); + is_int($key) || CacheItem::validateKey($key); $valuesArray[$key] = $value; } - if (\false === ($ttl = $this->normalizeTtl($ttl))) { - return $this->deleteMultiple(\array_keys($valuesArray)); + if (false === ($ttl = $this->normalizeTtl($ttl))) { + return $this->deleteMultiple(array_keys($valuesArray)); } if ($this->storeSerialized) { foreach ($valuesArray as $key => $value) { try { - $valuesArray[$key] = \serialize($value); - } catch (\Exception $e) { - $type = \is_object($value) ? \get_class($value) : \gettype($value); - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', ['key' => $key, 'type' => $type, 'exception' => $e]); - return \false; + $valuesArray[$key] = serialize($value); + } catch (Exception $e) { + $type = is_object($value) ? get_class($value) : gettype($value); + CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', ['key' => $key, 'type' => $type, 'exception' => $e]); + return false; } } } - $expiry = 0 < $ttl ? \time() + $ttl : \PHP_INT_MAX; + $expiry = 0 < $ttl ? time() + $ttl : PHP_INT_MAX; foreach ($valuesArray as $key => $value) { $this->values[$key] = $value; $this->expiries[$key] = $expiry; } - return \true; + return true; } private function normalizeTtl($ttl) { if (null === $ttl) { return $this->defaultLifetime; } - if ($ttl instanceof \DateInterval) { - $ttl = (int) \DateTime::createFromFormat('U', 0)->add($ttl)->format('U'); + if ($ttl instanceof DateInterval) { + $ttl = (int) DateTime::createFromFormat('U', 0)->add($ttl)->format('U'); } - if (\is_int($ttl)) { - return 0 < $ttl ? $ttl : \false; + if (is_int($ttl)) { + return 0 < $ttl ? $ttl : false; } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given.', \is_object($ttl) ? \get_class($ttl) : \gettype($ttl))); + throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given.', is_object($ttl) ? get_class($ttl) : gettype($ttl))); } } diff --git a/vendor/symfony/cache/Simple/ChainCache.php b/vendor/symfony/cache/Simple/ChainCache.php index e44dc13a1..1a7114d5e 100644 --- a/vendor/symfony/cache/Simple/ChainCache.php +++ b/vendor/symfony/cache/Simple/ChainCache.php @@ -14,6 +14,15 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface; +use stdClass; +use Traversable; +use function array_values; +use function count; +use function get_class; +use function is_object; +use function iterator_to_array; +use function sprintf; + /** * Chains several caches together. * @@ -22,7 +31,7 @@ * * @author Nicolas Grekas */ -class ChainCache implements \_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface +class ChainCache implements CacheInterface, PruneableInterface, ResettableInterface { private $miss; private $caches = []; @@ -35,16 +44,16 @@ class ChainCache implements \_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheInterf public function __construct(array $caches, $defaultLifetime = 0) { if (!$caches) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException('At least one cache must be specified.'); + throw new InvalidArgumentException('At least one cache must be specified.'); } foreach ($caches as $cache) { - if (!$cache instanceof \_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheInterface) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('The class "%s" does not implement the "%s" interface.', \get_class($cache), \_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheInterface::class)); + if (!$cache instanceof CacheInterface) { + throw new InvalidArgumentException(sprintf('The class "%s" does not implement the "%s" interface.', get_class($cache), CacheInterface::class)); } } - $this->miss = new \stdClass(); - $this->caches = \array_values($caches); - $this->cacheCount = \count($this->caches); + $this->miss = new stdClass(); + $this->caches = array_values($caches); + $this->cacheCount = count($this->caches); $this->defaultLifetime = 0 < $defaultLifetime ? (int) $defaultLifetime : null; } /** @@ -52,7 +61,7 @@ public function __construct(array $caches, $defaultLifetime = 0) */ public function get($key, $default = null) { - $miss = null !== $default && \is_object($default) ? $default : $this->miss; + $miss = null !== $default && is_object($default) ? $default : $this->miss; foreach ($this->caches as $i => $cache) { $value = $cache->get($key, $miss); if ($miss !== $value) { @@ -69,7 +78,7 @@ public function get($key, $default = null) */ public function getMultiple($keys, $default = null) { - $miss = null !== $default && \is_object($default) ? $default : $this->miss; + $miss = null !== $default && is_object($default) ? $default : $this->miss; return $this->generateItems($this->caches[0]->getMultiple($keys, $miss), 0, $miss, $default); } private function generateItems($values, $cacheIndex, $miss, $default) @@ -106,17 +115,17 @@ public function has($key) { foreach ($this->caches as $cache) { if ($cache->has($key)) { - return \true; + return true; } } - return \false; + return false; } /** * {@inheritdoc} */ public function clear() { - $cleared = \true; + $cleared = true; $i = $this->cacheCount; while ($i--) { $cleared = $this->caches[$i]->clear() && $cleared; @@ -128,7 +137,7 @@ public function clear() */ public function delete($key) { - $deleted = \true; + $deleted = true; $i = $this->cacheCount; while ($i--) { $deleted = $this->caches[$i]->delete($key) && $deleted; @@ -140,10 +149,10 @@ public function delete($key) */ public function deleteMultiple($keys) { - if ($keys instanceof \Traversable) { - $keys = \iterator_to_array($keys, \false); + if ($keys instanceof Traversable) { + $keys = iterator_to_array($keys, false); } - $deleted = \true; + $deleted = true; $i = $this->cacheCount; while ($i--) { $deleted = $this->caches[$i]->deleteMultiple($keys) && $deleted; @@ -155,7 +164,7 @@ public function deleteMultiple($keys) */ public function set($key, $value, $ttl = null) { - $saved = \true; + $saved = true; $i = $this->cacheCount; while ($i--) { $saved = $this->caches[$i]->set($key, $value, $ttl) && $saved; @@ -167,7 +176,7 @@ public function set($key, $value, $ttl = null) */ public function setMultiple($values, $ttl = null) { - if ($values instanceof \Traversable) { + if ($values instanceof Traversable) { $valuesIterator = $values; $values = function () use($valuesIterator, &$values) { $generatedValues = []; @@ -179,7 +188,7 @@ public function setMultiple($values, $ttl = null) }; $values = $values(); } - $saved = \true; + $saved = true; $i = $this->cacheCount; while ($i--) { $saved = $this->caches[$i]->setMultiple($values, $ttl) && $saved; @@ -191,9 +200,9 @@ public function setMultiple($values, $ttl = null) */ public function prune() { - $pruned = \true; + $pruned = true; foreach ($this->caches as $cache) { - if ($cache instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface) { + if ($cache instanceof PruneableInterface) { $pruned = $cache->prune() && $pruned; } } @@ -205,7 +214,7 @@ public function prune() public function reset() { foreach ($this->caches as $cache) { - if ($cache instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface) { + if ($cache instanceof ResettableInterface) { $cache->reset(); } } diff --git a/vendor/symfony/cache/Simple/DoctrineCache.php b/vendor/symfony/cache/Simple/DoctrineCache.php index 92da9b53a..7a2bbd79c 100644 --- a/vendor/symfony/cache/Simple/DoctrineCache.php +++ b/vendor/symfony/cache/Simple/DoctrineCache.php @@ -12,14 +12,14 @@ use _PhpScoper5ea00cc67502b\Doctrine\Common\Cache\CacheProvider; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\DoctrineTrait; -class DoctrineCache extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\AbstractCache +class DoctrineCache extends AbstractCache { use DoctrineTrait; /** * @param string $namespace * @param int $defaultLifetime */ - public function __construct(\_PhpScoper5ea00cc67502b\Doctrine\Common\Cache\CacheProvider $provider, $namespace = '', $defaultLifetime = 0) + public function __construct(CacheProvider $provider, $namespace = '', $defaultLifetime = 0) { parent::__construct('', $defaultLifetime); $this->provider = $provider; diff --git a/vendor/symfony/cache/Simple/FilesystemCache.php b/vendor/symfony/cache/Simple/FilesystemCache.php index 1c1a5e5b0..117c66d66 100644 --- a/vendor/symfony/cache/Simple/FilesystemCache.php +++ b/vendor/symfony/cache/Simple/FilesystemCache.php @@ -12,7 +12,7 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\FilesystemTrait; -class FilesystemCache extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\AbstractCache implements \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface +class FilesystemCache extends AbstractCache implements PruneableInterface { use FilesystemTrait; /** diff --git a/vendor/symfony/cache/Simple/MemcachedCache.php b/vendor/symfony/cache/Simple/MemcachedCache.php index a63840a24..daffb7c7a 100644 --- a/vendor/symfony/cache/Simple/MemcachedCache.php +++ b/vendor/symfony/cache/Simple/MemcachedCache.php @@ -10,8 +10,9 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple; +use _PhpScoper5ea00cc67502b\Memcached; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\MemcachedTrait; -class MemcachedCache extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\AbstractCache +class MemcachedCache extends AbstractCache { use MemcachedTrait; protected $maxIdLength = 250; @@ -19,7 +20,7 @@ class MemcachedCache extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Si * @param string $namespace * @param int $defaultLifetime */ - public function __construct(\_PhpScoper5ea00cc67502b\Memcached $client, $namespace = '', $defaultLifetime = 0) + public function __construct(Memcached $client, $namespace = '', $defaultLifetime = 0) { $this->init($client, $namespace, $defaultLifetime); } diff --git a/vendor/symfony/cache/Simple/NullCache.php b/vendor/symfony/cache/Simple/NullCache.php index b637721fb..4aca2a7d7 100644 --- a/vendor/symfony/cache/Simple/NullCache.php +++ b/vendor/symfony/cache/Simple/NullCache.php @@ -14,7 +14,7 @@ /** * @author Nicolas Grekas */ -class NullCache implements \_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheInterface +class NullCache implements CacheInterface { /** * {@inheritdoc} @@ -37,41 +37,41 @@ public function getMultiple($keys, $default = null) */ public function has($key) { - return \false; + return false; } /** * {@inheritdoc} */ public function clear() { - return \true; + return true; } /** * {@inheritdoc} */ public function delete($key) { - return \true; + return true; } /** * {@inheritdoc} */ public function deleteMultiple($keys) { - return \true; + return true; } /** * {@inheritdoc} */ public function set($key, $value, $ttl = null) { - return \false; + return false; } /** * {@inheritdoc} */ public function setMultiple($values, $ttl = null) { - return \false; + return false; } } diff --git a/vendor/symfony/cache/Simple/PdoCache.php b/vendor/symfony/cache/Simple/PdoCache.php index 6737e288a..792e529dc 100644 --- a/vendor/symfony/cache/Simple/PdoCache.php +++ b/vendor/symfony/cache/Simple/PdoCache.php @@ -12,7 +12,9 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\PdoTrait; -class PdoCache extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\AbstractCache implements \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface +use PDO; + +class PdoCache extends AbstractCache implements PruneableInterface { use PdoTrait; protected $maxIdLength = 255; @@ -31,7 +33,7 @@ class PdoCache extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\A * * db_password: The password when lazy-connect [default: ''] * * db_connection_options: An array of driver-specific connection options [default: []] * - * @param \PDO|Connection|string $connOrDsn A \PDO or Connection instance or DSN string or null + * @param PDO|Connection|string $connOrDsn A \PDO or Connection instance or DSN string or null * @param string $namespace * @param int $defaultLifetime * @param array $options An associative array of options diff --git a/vendor/symfony/cache/Simple/PhpArrayCache.php b/vendor/symfony/cache/Simple/PhpArrayCache.php index 829721b9c..250e42031 100644 --- a/vendor/symfony/cache/Simple/PhpArrayCache.php +++ b/vendor/symfony/cache/Simple/PhpArrayCache.php @@ -15,6 +15,23 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\PhpArrayTrait; +use Error; +use Exception; +use Traversable; +use function filter_var; +use function get_class; +use function gettype; +use function ini_get; +use function is_array; +use function is_int; +use function is_object; +use function is_string; +use function iterator_to_array; +use function sprintf; +use function unserialize; +use const FILTER_VALIDATE_BOOLEAN; +use const PHP_VERSION_ID; + /** * Caches items at warm up time using a PHP array that is stored in shared memory by OPCache since PHP 7.0. * Warmed up items are read-only and run-time discovered items are cached using a fallback adapter. @@ -22,18 +39,18 @@ * @author Titouan Galopin * @author Nicolas Grekas */ -class PhpArrayCache implements \_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface +class PhpArrayCache implements CacheInterface, PruneableInterface, ResettableInterface { use PhpArrayTrait; /** * @param string $file The PHP file were values are cached * @param CacheInterface $fallbackPool A pool to fallback on when an item is not hit */ - public function __construct($file, \_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheInterface $fallbackPool) + public function __construct($file, CacheInterface $fallbackPool) { $this->file = $file; $this->pool = $fallbackPool; - $this->zendDetectUnicode = \filter_var(\ini_get('zend.detect_unicode'), \FILTER_VALIDATE_BOOLEAN); + $this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), FILTER_VALIDATE_BOOLEAN); } /** * This adapter should only be used on PHP 7.0+ to take advantage of how PHP @@ -45,9 +62,9 @@ public function __construct($file, \_PhpScoper5ea00cc67502b\Psr\SimpleCache\Cach * * @return CacheInterface */ - public static function create($file, \_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheInterface $fallbackPool) + public static function create($file, CacheInterface $fallbackPool) { - if (\PHP_VERSION_ID >= 70000) { + if (PHP_VERSION_ID >= 70000) { return new static($file, $fallbackPool); } return $fallbackPool; @@ -57,8 +74,8 @@ public static function create($file, \_PhpScoper5ea00cc67502b\Psr\SimpleCache\Ca */ public function get($key, $default = null) { - if (!\is_string($key)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache key must be string, "%s" given.', \is_object($key) ? \get_class($key) : \gettype($key))); + if (!is_string($key)) { + throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', is_object($key) ? get_class($key) : gettype($key))); } if (null === $this->values) { $this->initialize(); @@ -69,12 +86,12 @@ public function get($key, $default = null) $value = $this->values[$key]; if ('N;' === $value) { $value = null; - } elseif (\is_string($value) && isset($value[2]) && ':' === $value[1]) { + } elseif (is_string($value) && isset($value[2]) && ':' === $value[1]) { try { $e = null; - $value = \unserialize($value); - } catch (\Error $e) { - } catch (\Exception $e) { + $value = unserialize($value); + } catch (Error $e) { + } catch (Exception $e) { } if (null !== $e) { return $default; @@ -87,14 +104,14 @@ public function get($key, $default = null) */ public function getMultiple($keys, $default = null) { - if ($keys instanceof \Traversable) { - $keys = \iterator_to_array($keys, \false); - } elseif (!\is_array($keys)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys))); + if ($keys instanceof Traversable) { + $keys = iterator_to_array($keys, false); + } elseif (!is_array($keys)) { + throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', is_object($keys) ? get_class($keys) : gettype($keys))); } foreach ($keys as $key) { - if (!\is_string($key)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache key must be string, "%s" given.', \is_object($key) ? \get_class($key) : \gettype($key))); + if (!is_string($key)) { + throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', is_object($key) ? get_class($key) : gettype($key))); } } if (null === $this->values) { @@ -107,8 +124,8 @@ public function getMultiple($keys, $default = null) */ public function has($key) { - if (!\is_string($key)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache key must be string, "%s" given.', \is_object($key) ? \get_class($key) : \gettype($key))); + if (!is_string($key)) { + throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', is_object($key) ? get_class($key) : gettype($key))); } if (null === $this->values) { $this->initialize(); @@ -120,8 +137,8 @@ public function has($key) */ public function delete($key) { - if (!\is_string($key)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache key must be string, "%s" given.', \is_object($key) ? \get_class($key) : \gettype($key))); + if (!is_string($key)) { + throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', is_object($key) ? get_class($key) : gettype($key))); } if (null === $this->values) { $this->initialize(); @@ -133,17 +150,17 @@ public function delete($key) */ public function deleteMultiple($keys) { - if (!\is_array($keys) && !$keys instanceof \Traversable) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys))); + if (!is_array($keys) && !$keys instanceof Traversable) { + throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', is_object($keys) ? get_class($keys) : gettype($keys))); } - $deleted = \true; + $deleted = true; $fallbackKeys = []; foreach ($keys as $key) { - if (!\is_string($key)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache key must be string, "%s" given.', \is_object($key) ? \get_class($key) : \gettype($key))); + if (!is_string($key)) { + throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', is_object($key) ? get_class($key) : gettype($key))); } if (isset($this->values[$key])) { - $deleted = \false; + $deleted = false; } else { $fallbackKeys[] = $key; } @@ -161,8 +178,8 @@ public function deleteMultiple($keys) */ public function set($key, $value, $ttl = null) { - if (!\is_string($key)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache key must be string, "%s" given.', \is_object($key) ? \get_class($key) : \gettype($key))); + if (!is_string($key)) { + throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', is_object($key) ? get_class($key) : gettype($key))); } if (null === $this->values) { $this->initialize(); @@ -174,17 +191,17 @@ public function set($key, $value, $ttl = null) */ public function setMultiple($values, $ttl = null) { - if (!\is_array($values) && !$values instanceof \Traversable) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache values must be array or Traversable, "%s" given.', \is_object($values) ? \get_class($values) : \gettype($values))); + if (!is_array($values) && !$values instanceof Traversable) { + throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given.', is_object($values) ? get_class($values) : gettype($values))); } - $saved = \true; + $saved = true; $fallbackValues = []; foreach ($values as $key => $value) { - if (!\is_string($key) && !\is_int($key)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache key must be string, "%s" given.', \is_object($key) ? \get_class($key) : \gettype($key))); + if (!is_string($key) && !is_int($key)) { + throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', is_object($key) ? get_class($key) : gettype($key))); } if (isset($this->values[$key])) { - $saved = \false; + $saved = false; } else { $fallbackValues[$key] = $value; } @@ -202,12 +219,12 @@ private function generateItems(array $keys, $default) $value = $this->values[$key]; if ('N;' === $value) { (yield $key => null); - } elseif (\is_string($value) && isset($value[2]) && ':' === $value[1]) { + } elseif (is_string($value) && isset($value[2]) && ':' === $value[1]) { try { - (yield $key => \unserialize($value)); - } catch (\Error $e) { + (yield $key => unserialize($value)); + } catch (Error $e) { (yield $key => $default); - } catch (\Exception $e) { + } catch (Exception $e) { (yield $key => $default); } } else { diff --git a/vendor/symfony/cache/Simple/PhpFilesCache.php b/vendor/symfony/cache/Simple/PhpFilesCache.php index 20b93fae1..47debddc2 100644 --- a/vendor/symfony/cache/Simple/PhpFilesCache.php +++ b/vendor/symfony/cache/Simple/PhpFilesCache.php @@ -13,7 +13,12 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\CacheException; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\PhpFilesTrait; -class PhpFilesCache extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\AbstractCache implements \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface +use Exception; +use function filter_var; +use function ini_get; +use const FILTER_VALIDATE_BOOLEAN; + +class PhpFilesCache extends AbstractCache implements PruneableInterface { use PhpFilesTrait; /** @@ -26,14 +31,14 @@ class PhpFilesCache extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Sim public function __construct($namespace = '', $defaultLifetime = 0, $directory = null) { if (!static::isSupported()) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\CacheException('OPcache is not enabled.'); + throw new CacheException('OPcache is not enabled.'); } parent::__construct('', $defaultLifetime); $this->init($namespace, $directory); - $e = new \Exception(); + $e = new Exception(); $this->includeHandler = function () use($e) { throw $e; }; - $this->zendDetectUnicode = \filter_var(\ini_get('zend.detect_unicode'), \FILTER_VALIDATE_BOOLEAN); + $this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), FILTER_VALIDATE_BOOLEAN); } } diff --git a/vendor/symfony/cache/Simple/Psr6Cache.php b/vendor/symfony/cache/Simple/Psr6Cache.php index ad01125b1..de87ef88e 100644 --- a/vendor/symfony/cache/Simple/Psr6Cache.php +++ b/vendor/symfony/cache/Simple/Psr6Cache.php @@ -20,31 +20,41 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\ProxyTrait; +use Closure; +use Traversable; +use function get_class; +use function gettype; +use function is_array; +use function is_int; +use function is_object; +use function iterator_to_array; +use function sprintf; + /** * @author Nicolas Grekas */ -class Psr6Cache implements \_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface +class Psr6Cache implements CacheInterface, PruneableInterface, ResettableInterface { use ProxyTrait; private $createCacheItem; private $cacheItemPrototype; - public function __construct(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemPoolInterface $pool) + public function __construct(CacheItemPoolInterface $pool) { $this->pool = $pool; - if (!$pool instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AdapterInterface) { + if (!$pool instanceof AdapterInterface) { return; } $cacheItemPrototype =& $this->cacheItemPrototype; - $createCacheItem = \Closure::bind(static function ($key, $value, $allowInt = \false) use(&$cacheItemPrototype) { + $createCacheItem = Closure::bind(static function ($key, $value, $allowInt = false) use(&$cacheItemPrototype) { $item = clone $cacheItemPrototype; - $item->key = $allowInt && \is_int($key) ? (string) $key : \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::validateKey($key); + $item->key = $allowInt && is_int($key) ? (string) $key : CacheItem::validateKey($key); $item->value = $value; - $item->isHit = \false; + $item->isHit = false; return $item; - }, null, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::class); - $this->createCacheItem = function ($key, $value, $allowInt = \false) use($createCacheItem) { + }, null, CacheItem::class); + $this->createCacheItem = function ($key, $value, $allowInt = false) use($createCacheItem) { if (null === $this->cacheItemPrototype) { - $this->get($allowInt && \is_int($key) ? (string) $key : $key); + $this->get($allowInt && is_int($key) ? (string) $key : $key); } $this->createCacheItem = $createCacheItem; return $createCacheItem($key, $value, $allowInt); @@ -57,10 +67,10 @@ public function get($key, $default = null) { try { $item = $this->pool->getItem($key); - } catch (\_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheException $e) { + } catch (SimpleCacheException $e) { throw $e; - } catch (\_PhpScoper5ea00cc67502b\Psr\Cache\CacheException $e) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException($e->getMessage(), $e->getCode(), $e); + } catch (Psr6CacheException $e) { + throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e); } if (null === $this->cacheItemPrototype) { $this->cacheItemPrototype = clone $item; @@ -79,10 +89,10 @@ public function set($key, $value, $ttl = null) } else { $item = $this->pool->getItem($key)->set($value); } - } catch (\_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheException $e) { + } catch (SimpleCacheException $e) { throw $e; - } catch (\_PhpScoper5ea00cc67502b\Psr\Cache\CacheException $e) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException($e->getMessage(), $e->getCode(), $e); + } catch (Psr6CacheException $e) { + throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e); } if (null !== $ttl) { $item->expiresAfter($ttl); @@ -96,10 +106,10 @@ public function delete($key) { try { return $this->pool->deleteItem($key); - } catch (\_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheException $e) { + } catch (SimpleCacheException $e) { throw $e; - } catch (\_PhpScoper5ea00cc67502b\Psr\Cache\CacheException $e) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException($e->getMessage(), $e->getCode(), $e); + } catch (Psr6CacheException $e) { + throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e); } } /** @@ -114,17 +124,17 @@ public function clear() */ public function getMultiple($keys, $default = null) { - if ($keys instanceof \Traversable) { - $keys = \iterator_to_array($keys, \false); - } elseif (!\is_array($keys)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys))); + if ($keys instanceof Traversable) { + $keys = iterator_to_array($keys, false); + } elseif (!is_array($keys)) { + throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', is_object($keys) ? get_class($keys) : gettype($keys))); } try { $items = $this->pool->getItems($keys); - } catch (\_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheException $e) { + } catch (SimpleCacheException $e) { throw $e; - } catch (\_PhpScoper5ea00cc67502b\Psr\Cache\CacheException $e) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException($e->getMessage(), $e->getCode(), $e); + } catch (Psr6CacheException $e) { + throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e); } $values = []; foreach ($items as $key => $item) { @@ -137,16 +147,16 @@ public function getMultiple($keys, $default = null) */ public function setMultiple($values, $ttl = null) { - $valuesIsArray = \is_array($values); - if (!$valuesIsArray && !$values instanceof \Traversable) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache values must be array or Traversable, "%s" given.', \is_object($values) ? \get_class($values) : \gettype($values))); + $valuesIsArray = is_array($values); + if (!$valuesIsArray && !$values instanceof Traversable) { + throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given.', is_object($values) ? get_class($values) : gettype($values))); } $items = []; try { if (null !== ($f = $this->createCacheItem)) { - $valuesIsArray = \false; + $valuesIsArray = false; foreach ($values as $key => $value) { - $items[$key] = $f($key, $value, \true); + $items[$key] = $f($key, $value, true); } } elseif ($valuesIsArray) { $items = []; @@ -156,18 +166,18 @@ public function setMultiple($values, $ttl = null) $items = $this->pool->getItems($items); } else { foreach ($values as $key => $value) { - if (\is_int($key)) { + if (is_int($key)) { $key = (string) $key; } $items[$key] = $this->pool->getItem($key)->set($value); } } - } catch (\_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheException $e) { + } catch (SimpleCacheException $e) { throw $e; - } catch (\_PhpScoper5ea00cc67502b\Psr\Cache\CacheException $e) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException($e->getMessage(), $e->getCode(), $e); + } catch (Psr6CacheException $e) { + throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e); } - $ok = \true; + $ok = true; foreach ($items as $key => $item) { if ($valuesIsArray) { $item->set($values[$key]); @@ -184,17 +194,17 @@ public function setMultiple($values, $ttl = null) */ public function deleteMultiple($keys) { - if ($keys instanceof \Traversable) { - $keys = \iterator_to_array($keys, \false); - } elseif (!\is_array($keys)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys))); + if ($keys instanceof Traversable) { + $keys = iterator_to_array($keys, false); + } elseif (!is_array($keys)) { + throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', is_object($keys) ? get_class($keys) : gettype($keys))); } try { return $this->pool->deleteItems($keys); - } catch (\_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheException $e) { + } catch (SimpleCacheException $e) { throw $e; - } catch (\_PhpScoper5ea00cc67502b\Psr\Cache\CacheException $e) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException($e->getMessage(), $e->getCode(), $e); + } catch (Psr6CacheException $e) { + throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e); } } /** @@ -204,10 +214,10 @@ public function has($key) { try { return $this->pool->hasItem($key); - } catch (\_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheException $e) { + } catch (SimpleCacheException $e) { throw $e; - } catch (\_PhpScoper5ea00cc67502b\Psr\Cache\CacheException $e) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException($e->getMessage(), $e->getCode(), $e); + } catch (Psr6CacheException $e) { + throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e); } } } diff --git a/vendor/symfony/cache/Simple/RedisCache.php b/vendor/symfony/cache/Simple/RedisCache.php index 7f8610069..d39fe8f95 100644 --- a/vendor/symfony/cache/Simple/RedisCache.php +++ b/vendor/symfony/cache/Simple/RedisCache.php @@ -11,11 +11,16 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\RedisTrait; -class RedisCache extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\AbstractCache +use Predis\Client; +use Redis; +use RedisArray; +use RedisCluster; + +class RedisCache extends AbstractCache { use RedisTrait; /** - * @param \Redis|\RedisArray|\RedisCluster|\Predis\Client $redisClient + * @param Redis|RedisArray|RedisCluster|Client $redisClient * @param string $namespace * @param int $defaultLifetime */ diff --git a/vendor/symfony/cache/Simple/TraceableCache.php b/vendor/symfony/cache/Simple/TraceableCache.php index f1e9a53ce..c04e8d7d2 100644 --- a/vendor/symfony/cache/Simple/TraceableCache.php +++ b/vendor/symfony/cache/Simple/TraceableCache.php @@ -13,32 +13,40 @@ use _PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface; +use stdClass; +use Traversable; +use function array_keys; +use function is_array; +use function is_object; +use function iterator_to_array; +use function microtime; + /** * An adapter that collects data about all cache calls. * * @author Nicolas Grekas */ -class TraceableCache implements \_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface +class TraceableCache implements CacheInterface, PruneableInterface, ResettableInterface { private $pool; private $miss; private $calls = []; - public function __construct(\_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheInterface $pool) + public function __construct(CacheInterface $pool) { $this->pool = $pool; - $this->miss = new \stdClass(); + $this->miss = new stdClass(); } /** * {@inheritdoc} */ public function get($key, $default = null) { - $miss = null !== $default && \is_object($default) ? $default : $this->miss; + $miss = null !== $default && is_object($default) ? $default : $this->miss; $event = $this->start(__FUNCTION__); try { $value = $this->pool->get($key, $miss); } finally { - $event->end = \microtime(\true); + $event->end = microtime(true); } if ($event->result[$key] = $miss !== $value) { ++$event->hits; @@ -57,7 +65,7 @@ public function has($key) try { return $event->result[$key] = $this->pool->has($key); } finally { - $event->end = \microtime(\true); + $event->end = microtime(true); } } /** @@ -69,7 +77,7 @@ public function delete($key) try { return $event->result[$key] = $this->pool->delete($key); } finally { - $event->end = \microtime(\true); + $event->end = microtime(true); } } /** @@ -81,7 +89,7 @@ public function set($key, $value, $ttl = null) try { return $event->result[$key] = $this->pool->set($key, $value, $ttl); } finally { - $event->end = \microtime(\true); + $event->end = microtime(true); } } /** @@ -91,7 +99,7 @@ public function setMultiple($values, $ttl = null) { $event = $this->start(__FUNCTION__); $event->result['keys'] = []; - if ($values instanceof \Traversable) { + if ($values instanceof Traversable) { $values = function () use($values, $event) { foreach ($values as $k => $v) { $event->result['keys'][] = $k; @@ -99,13 +107,13 @@ public function setMultiple($values, $ttl = null) } }; $values = $values(); - } elseif (\is_array($values)) { - $event->result['keys'] = \array_keys($values); + } elseif (is_array($values)) { + $event->result['keys'] = array_keys($values); } try { return $event->result['result'] = $this->pool->setMultiple($values, $ttl); } finally { - $event->end = \microtime(\true); + $event->end = microtime(true); } } /** @@ -113,12 +121,12 @@ public function setMultiple($values, $ttl = null) */ public function getMultiple($keys, $default = null) { - $miss = null !== $default && \is_object($default) ? $default : $this->miss; + $miss = null !== $default && is_object($default) ? $default : $this->miss; $event = $this->start(__FUNCTION__); try { $result = $this->pool->getMultiple($keys, $miss); } finally { - $event->end = \microtime(\true); + $event->end = microtime(true); } $f = function () use($result, $event, $miss, $default) { $event->result = []; @@ -143,7 +151,7 @@ public function clear() try { return $event->result = $this->pool->clear(); } finally { - $event->end = \microtime(\true); + $event->end = microtime(true); } } /** @@ -152,15 +160,15 @@ public function clear() public function deleteMultiple($keys) { $event = $this->start(__FUNCTION__); - if ($keys instanceof \Traversable) { - $keys = $event->result['keys'] = \iterator_to_array($keys, \false); + if ($keys instanceof Traversable) { + $keys = $event->result['keys'] = iterator_to_array($keys, false); } else { $event->result['keys'] = $keys; } try { return $event->result['result'] = $this->pool->deleteMultiple($keys); } finally { - $event->end = \microtime(\true); + $event->end = microtime(true); } } /** @@ -168,14 +176,14 @@ public function deleteMultiple($keys) */ public function prune() { - if (!$this->pool instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface) { - return \false; + if (!$this->pool instanceof PruneableInterface) { + return false; } $event = $this->start(__FUNCTION__); try { return $event->result = $this->pool->prune(); } finally { - $event->end = \microtime(\true); + $event->end = microtime(true); } } /** @@ -183,14 +191,14 @@ public function prune() */ public function reset() { - if (!$this->pool instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface) { + if (!$this->pool instanceof ResettableInterface) { return; } $event = $this->start(__FUNCTION__); try { $this->pool->reset(); } finally { - $event->end = \microtime(\true); + $event->end = microtime(true); } } public function getCalls() @@ -203,9 +211,9 @@ public function getCalls() } private function start($name) { - $this->calls[] = $event = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\TraceableCacheEvent(); + $this->calls[] = $event = new TraceableCacheEvent(); $event->name = $name; - $event->start = \microtime(\true); + $event->start = microtime(true); return $event; } } diff --git a/vendor/symfony/cache/Simple/index.php b/vendor/symfony/cache/Simple/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/cache/Simple/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/cache/Tests/Adapter/AbstractRedisAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/AbstractRedisAdapterTest.php index dadc0ee20..5ee7f5f1b 100644 --- a/vendor/symfony/cache/Tests/Adapter/AbstractRedisAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/AbstractRedisAdapterTest.php @@ -10,22 +10,28 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter; +use _PhpScoper5ea00cc67502b\Redis; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\RedisAdapter; -abstract class AbstractRedisAdapterTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\AdapterTestCase +use function error_get_last; +use function extension_loaded; +use function getenv; +use function str_replace; + +abstract class AbstractRedisAdapterTest extends AdapterTestCase { protected $skippedTests = ['testExpiration' => 'Testing expiration slows down the test suite', 'testHasItemReturnsFalseWhenDeferredItemIsExpired' => 'Testing expiration slows down the test suite', 'testDefaultLifeTime' => 'Testing expiration slows down the test suite']; protected static $redis; public function createCachePool($defaultLifetime = 0) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\RedisAdapter(self::$redis, \str_replace('\\', '.', __CLASS__), $defaultLifetime); + return new RedisAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime); } public static function setUpBeforeClass() { - if (!\extension_loaded('redis')) { + if (!extension_loaded('redis')) { self::markTestSkipped('Extension redis required.'); } - if (!@(new \_PhpScoper5ea00cc67502b\Redis())->connect(\getenv('REDIS_HOST'))) { - $e = \error_get_last(); + if (!@(new Redis())->connect(getenv('REDIS_HOST'))) { + $e = error_get_last(); self::markTestSkipped($e['message']); } } diff --git a/vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php b/vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php index 17255e0c8..18e2cef6a 100644 --- a/vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php +++ b/vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php @@ -13,15 +13,24 @@ use _PhpScoper5ea00cc67502b\Cache\IntegrationTests\CachePoolTest; use _PhpScoper5ea00cc67502b\Psr\Cache\CacheItemPoolInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface; -abstract class AdapterTestCase extends \_PhpScoper5ea00cc67502b\Cache\IntegrationTests\CachePoolTest +use DateInterval; +use Exception; +use Serializable; +use function array_key_exists; +use function defined; +use function method_exists; +use function serialize; +use function sleep; + +abstract class AdapterTestCase extends CachePoolTest { protected function setUp() { parent::setUp(); - if (!\array_key_exists('testDeferredSaveWithoutCommit', $this->skippedTests) && \defined('HHVM_VERSION')) { + if (!array_key_exists('testDeferredSaveWithoutCommit', $this->skippedTests) && defined('HHVM_VERSION')) { $this->skippedTests['testDeferredSaveWithoutCommit'] = 'Destructors are called late on HHVM.'; } - if (!\array_key_exists('testPrune', $this->skippedTests) && !$this->createCachePool() instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface) { + if (!array_key_exists('testPrune', $this->skippedTests) && !$this->createCachePool() instanceof PruneableInterface) { $this->skippedTests['testPrune'] = 'Not a pruneable cache pool.'; } } @@ -34,10 +43,10 @@ public function testDefaultLifeTime() $item = $cache->getItem('key.dlt'); $item->set('value'); $cache->save($item); - \sleep(1); + sleep(1); $item = $cache->getItem('key.dlt'); $this->assertTrue($item->isHit()); - \sleep(2); + sleep(2); $item = $cache->getItem('key.dlt'); $this->assertFalse($item->isHit()); } @@ -49,7 +58,7 @@ public function testExpiration() $cache = $this->createCachePool(); $cache->save($cache->getItem('k1')->set('v1')->expiresAfter(2)); $cache->save($cache->getItem('k2')->set('v2')->expiresAfter(366 * 86400)); - \sleep(3); + sleep(3); $item = $cache->getItem('k1'); $this->assertFalse($item->isHit()); $this->assertNull($item->get(), "Item's value must be null when isHit() is false."); @@ -64,12 +73,12 @@ public function testNotUnserializable() } $cache = $this->createCachePool(); $item = $cache->getItem('foo'); - $cache->save($item->set(new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\NotUnserializable())); + $cache->save($item->set(new NotUnserializable())); $item = $cache->getItem('foo'); $this->assertFalse($item->isHit()); foreach ($cache->getItems(['foo']) as $item) { } - $cache->save($item->set(new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\NotUnserializable())); + $cache->save($item->set(new NotUnserializable())); foreach ($cache->getItems(['foo']) as $item) { } $this->assertFalse($item->isHit()); @@ -79,12 +88,12 @@ public function testPrune() if (isset($this->skippedTests[__FUNCTION__])) { $this->markTestSkipped($this->skippedTests[__FUNCTION__]); } - if (!\method_exists($this, 'isPruned')) { + if (!method_exists($this, 'isPruned')) { $this->fail('Test classes for pruneable caches must implement `isPruned($cache, $name)` method.'); } /** @var PruneableInterface|CacheItemPoolInterface $cache */ $cache = $this->createCachePool(); - $doSet = function ($name, $value, \DateInterval $expiresAfter = null) use($cache) { + $doSet = function ($name, $value, DateInterval $expiresAfter = null) use($cache) { $item = $cache->getItem($name); $item->set($value); if ($expiresAfter) { @@ -92,50 +101,50 @@ public function testPrune() } $cache->save($item); }; - $doSet('foo', 'foo-val', new \DateInterval('PT05S')); - $doSet('bar', 'bar-val', new \DateInterval('PT10S')); - $doSet('baz', 'baz-val', new \DateInterval('PT15S')); - $doSet('qux', 'qux-val', new \DateInterval('PT20S')); - \sleep(30); + $doSet('foo', 'foo-val', new DateInterval('PT05S')); + $doSet('bar', 'bar-val', new DateInterval('PT10S')); + $doSet('baz', 'baz-val', new DateInterval('PT15S')); + $doSet('qux', 'qux-val', new DateInterval('PT20S')); + sleep(30); $cache->prune(); $this->assertTrue($this->isPruned($cache, 'foo')); $this->assertTrue($this->isPruned($cache, 'bar')); $this->assertTrue($this->isPruned($cache, 'baz')); $this->assertTrue($this->isPruned($cache, 'qux')); $doSet('foo', 'foo-val'); - $doSet('bar', 'bar-val', new \DateInterval('PT20S')); - $doSet('baz', 'baz-val', new \DateInterval('PT40S')); - $doSet('qux', 'qux-val', new \DateInterval('PT80S')); + $doSet('bar', 'bar-val', new DateInterval('PT20S')); + $doSet('baz', 'baz-val', new DateInterval('PT40S')); + $doSet('qux', 'qux-val', new DateInterval('PT80S')); $cache->prune(); $this->assertFalse($this->isPruned($cache, 'foo')); $this->assertFalse($this->isPruned($cache, 'bar')); $this->assertFalse($this->isPruned($cache, 'baz')); $this->assertFalse($this->isPruned($cache, 'qux')); - \sleep(30); + sleep(30); $cache->prune(); $this->assertFalse($this->isPruned($cache, 'foo')); $this->assertTrue($this->isPruned($cache, 'bar')); $this->assertFalse($this->isPruned($cache, 'baz')); $this->assertFalse($this->isPruned($cache, 'qux')); - \sleep(30); + sleep(30); $cache->prune(); $this->assertFalse($this->isPruned($cache, 'foo')); $this->assertTrue($this->isPruned($cache, 'baz')); $this->assertFalse($this->isPruned($cache, 'qux')); - \sleep(30); + sleep(30); $cache->prune(); $this->assertFalse($this->isPruned($cache, 'foo')); $this->assertTrue($this->isPruned($cache, 'qux')); } } -class NotUnserializable implements \Serializable +class NotUnserializable implements Serializable { public function serialize() { - return \serialize(123); + return serialize(123); } public function unserialize($ser) { - throw new \Exception(__CLASS__); + throw new Exception(__CLASS__); } } diff --git a/vendor/symfony/cache/Tests/Adapter/ApcuAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/ApcuAdapterTest.php index 459211bfc..ad6485c40 100644 --- a/vendor/symfony/cache/Tests/Adapter/ApcuAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/ApcuAdapterTest.php @@ -12,23 +12,33 @@ use _PhpScoper5ea00cc67502b\Psr\Log\NullLogger; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ApcuAdapter; -class ApcuAdapterTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\AdapterTestCase +use function filter_var; +use function function_exists; +use function ini_get; +use function restore_error_handler; +use function set_error_handler; +use function str_replace; +use const DIRECTORY_SEPARATOR; +use const FILTER_VALIDATE_BOOLEAN; +use const PHP_SAPI; + +class ApcuAdapterTest extends AdapterTestCase { protected $skippedTests = ['testExpiration' => 'Testing expiration slows down the test suite', 'testHasItemReturnsFalseWhenDeferredItemIsExpired' => 'Testing expiration slows down the test suite', 'testDefaultLifeTime' => 'Testing expiration slows down the test suite']; public function createCachePool($defaultLifetime = 0) { - if (!\function_exists('_PhpScoper5ea00cc67502b\\apcu_fetch') || !\filter_var(\ini_get('apc.enabled'), \FILTER_VALIDATE_BOOLEAN)) { + if (!function_exists('_PhpScoper5ea00cc67502b\\apcu_fetch') || !filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN)) { $this->markTestSkipped('APCu extension is required.'); } - if ('cli' === \PHP_SAPI && !\filter_var(\ini_get('apc.enable_cli'), \FILTER_VALIDATE_BOOLEAN)) { + if ('cli' === PHP_SAPI && !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) { if ('testWithCliSapi' !== $this->getName()) { $this->markTestSkipped('apc.enable_cli=1 is required.'); } } - if ('\\' === \DIRECTORY_SEPARATOR) { + if ('\\' === DIRECTORY_SEPARATOR) { $this->markTestSkipped('Fails transiently on Windows.'); } - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ApcuAdapter(\str_replace('\\', '.', __CLASS__), $defaultLifetime); + return new ApcuAdapter(str_replace('\\', '.', __CLASS__), $defaultLifetime); } public function testUnserializable() { @@ -42,15 +52,15 @@ public function testUnserializable() } public function testVersion() { - $namespace = \str_replace('\\', '.', static::class); - $pool1 = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ApcuAdapter($namespace, 0, 'p1'); + $namespace = str_replace('\\', '.', static::class); + $pool1 = new ApcuAdapter($namespace, 0, 'p1'); $item = $pool1->getItem('foo'); $this->assertFalse($item->isHit()); $this->assertTrue($pool1->save($item->set('bar'))); $item = $pool1->getItem('foo'); $this->assertTrue($item->isHit()); $this->assertSame('bar', $item->get()); - $pool2 = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ApcuAdapter($namespace, 0, 'p2'); + $pool2 = new ApcuAdapter($namespace, 0, 'p2'); $item = $pool2->getItem('foo'); $this->assertFalse($item->isHit()); $this->assertNull($item->get()); @@ -60,15 +70,15 @@ public function testVersion() } public function testNamespace() { - $namespace = \str_replace('\\', '.', static::class); - $pool1 = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ApcuAdapter($namespace . '_1', 0, 'p1'); + $namespace = str_replace('\\', '.', static::class); + $pool1 = new ApcuAdapter($namespace . '_1', 0, 'p1'); $item = $pool1->getItem('foo'); $this->assertFalse($item->isHit()); $this->assertTrue($pool1->save($item->set('bar'))); $item = $pool1->getItem('foo'); $this->assertTrue($item->isHit()); $this->assertSame('bar', $item->get()); - $pool2 = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ApcuAdapter($namespace . '_2', 0, 'p1'); + $pool2 = new ApcuAdapter($namespace . '_2', 0, 'p1'); $item = $pool2->getItem('foo'); $this->assertFalse($item->isHit()); $this->assertNull($item->get()); @@ -80,18 +90,18 @@ public function testWithCliSapi() { try { // disable PHPUnit error handler to mimic a production environment - $isCalled = \false; - \set_error_handler(function () use(&$isCalled) { - $isCalled = \true; + $isCalled = false; + set_error_handler(function () use(&$isCalled) { + $isCalled = true; }); - $pool = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ApcuAdapter(\str_replace('\\', '.', __CLASS__)); - $pool->setLogger(new \_PhpScoper5ea00cc67502b\Psr\Log\NullLogger()); + $pool = new ApcuAdapter(str_replace('\\', '.', __CLASS__)); + $pool->setLogger(new NullLogger()); $item = $pool->getItem('foo'); $item->isHit(); $pool->save($item->set('bar')); $this->assertFalse($isCalled); } finally { - \restore_error_handler(); + restore_error_handler(); } } } diff --git a/vendor/symfony/cache/Tests/Adapter/ArrayAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/ArrayAdapterTest.php index 7eb9c9bbb..611d5c4f6 100644 --- a/vendor/symfony/cache/Tests/Adapter/ArrayAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/ArrayAdapterTest.php @@ -11,15 +11,17 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ArrayAdapter; +use function serialize; + /** * @group time-sensitive */ -class ArrayAdapterTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\AdapterTestCase +class ArrayAdapterTest extends AdapterTestCase { protected $skippedTests = ['testDeferredSaveWithoutCommit' => 'Assumes a shared cache which ArrayAdapter is not.', 'testSaveWithoutExpire' => 'Assumes a shared cache which ArrayAdapter is not.']; public function createCachePool($defaultLifetime = 0) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ArrayAdapter($defaultLifetime); + return new ArrayAdapter($defaultLifetime); } public function testGetValuesHitAndMiss() { @@ -37,7 +39,7 @@ public function testGetValuesHitAndMiss() $values = $cache->getValues(); $this->assertCount(2, $values); $this->assertArrayHasKey('foo', $values); - $this->assertSame(\serialize('4711'), $values['foo']); + $this->assertSame(serialize('4711'), $values['foo']); $this->assertArrayHasKey('bar', $values); $this->assertNull($values['bar']); } diff --git a/vendor/symfony/cache/Tests/Adapter/ChainAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/ChainAdapterTest.php index 8ece80d1a..f01ba3209 100644 --- a/vendor/symfony/cache/Tests/Adapter/ChainAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/ChainAdapterTest.php @@ -17,36 +17,38 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\FilesystemAdapter; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Fixtures\ExternalAdapter; +use stdClass; + /** * @author Kévin Dunglas * @group time-sensitive */ -class ChainAdapterTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\AdapterTestCase +class ChainAdapterTest extends AdapterTestCase { public function createCachePool($defaultLifetime = 0) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ChainAdapter([new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ArrayAdapter($defaultLifetime), new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Fixtures\ExternalAdapter(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\FilesystemAdapter('', $defaultLifetime)], $defaultLifetime); + return new ChainAdapter([new ArrayAdapter($defaultLifetime), new ExternalAdapter(), new FilesystemAdapter('', $defaultLifetime)], $defaultLifetime); } public function testEmptyAdaptersException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Cache\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('At least one adapter must be specified.'); - new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ChainAdapter([]); + new ChainAdapter([]); } public function testInvalidAdapterException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Cache\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('The class "stdClass" does not implement'); - new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ChainAdapter([new \stdClass()]); + new ChainAdapter([new stdClass()]); } public function testPrune() { if (isset($this->skippedTests[__FUNCTION__])) { $this->markTestSkipped($this->skippedTests[__FUNCTION__]); } - $cache = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ChainAdapter([$this->getPruneableMock(), $this->getNonPruneableMock(), $this->getPruneableMock()]); + $cache = new ChainAdapter([$this->getPruneableMock(), $this->getNonPruneableMock(), $this->getPruneableMock()]); $this->assertTrue($cache->prune()); - $cache = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ChainAdapter([$this->getPruneableMock(), $this->getFailingPruneableMock(), $this->getPruneableMock()]); + $cache = new ChainAdapter([$this->getPruneableMock(), $this->getFailingPruneableMock(), $this->getPruneableMock()]); $this->assertFalse($cache->prune()); } /** @@ -54,8 +56,8 @@ public function testPrune() */ private function getPruneableMock() { - $pruneable = $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\PruneableCacheInterface::class)->getMock(); - $pruneable->expects($this->atLeastOnce())->method('prune')->willReturn(\true); + $pruneable = $this->getMockBuilder(PruneableCacheInterface::class)->getMock(); + $pruneable->expects($this->atLeastOnce())->method('prune')->willReturn(true); return $pruneable; } /** @@ -63,8 +65,8 @@ private function getPruneableMock() */ private function getFailingPruneableMock() { - $pruneable = $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\PruneableCacheInterface::class)->getMock(); - $pruneable->expects($this->atLeastOnce())->method('prune')->willReturn(\false); + $pruneable = $this->getMockBuilder(PruneableCacheInterface::class)->getMock(); + $pruneable->expects($this->atLeastOnce())->method('prune')->willReturn(false); return $pruneable; } /** @@ -72,9 +74,9 @@ private function getFailingPruneableMock() */ private function getNonPruneableMock() { - return $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AdapterInterface::class)->getMock(); + return $this->getMockBuilder(AdapterInterface::class)->getMock(); } } -interface PruneableCacheInterface extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AdapterInterface +interface PruneableCacheInterface extends PruneableInterface, AdapterInterface { } diff --git a/vendor/symfony/cache/Tests/Adapter/DoctrineAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/DoctrineAdapterTest.php index 1f1a4f044..8f23d046a 100644 --- a/vendor/symfony/cache/Tests/Adapter/DoctrineAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/DoctrineAdapterTest.php @@ -15,11 +15,11 @@ /** * @group time-sensitive */ -class DoctrineAdapterTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\AdapterTestCase +class DoctrineAdapterTest extends AdapterTestCase { protected $skippedTests = ['testDeferredSaveWithoutCommit' => 'Assumes a shared cache which ArrayCache is not.', 'testSaveWithoutExpire' => 'Assumes a shared cache which ArrayCache is not.', 'testNotUnserializable' => 'ArrayCache does not use serialize/unserialize']; public function createCachePool($defaultLifetime = 0) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\DoctrineAdapter(new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Fixtures\ArrayCache($defaultLifetime), '', $defaultLifetime); + return new DoctrineAdapter(new ArrayCache($defaultLifetime), '', $defaultLifetime); } } diff --git a/vendor/symfony/cache/Tests/Adapter/FilesystemAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/FilesystemAdapterTest.php index b2459daf1..47e98fbc2 100644 --- a/vendor/symfony/cache/Tests/Adapter/FilesystemAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/FilesystemAdapterTest.php @@ -12,41 +12,52 @@ use _PhpScoper5ea00cc67502b\Psr\Cache\CacheItemPoolInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\FilesystemAdapter; +use Exception; +use RecursiveDirectoryIterator; +use RecursiveIteratorIterator; +use ReflectionObject; +use function dirname; +use function file_exists; +use function rmdir; +use function strpos; +use function sys_get_temp_dir; +use function unlink; + /** * @group time-sensitive */ -class FilesystemAdapterTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\AdapterTestCase +class FilesystemAdapterTest extends AdapterTestCase { public function createCachePool($defaultLifetime = 0) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\FilesystemAdapter('', $defaultLifetime); + return new FilesystemAdapter('', $defaultLifetime); } public static function tearDownAfterClass() { - self::rmdir(\sys_get_temp_dir() . '/symfony-cache'); + self::rmdir(sys_get_temp_dir() . '/symfony-cache'); } public static function rmdir($dir) { - if (!\file_exists($dir)) { + if (!file_exists($dir)) { return; } - if (!$dir || 0 !== \strpos(\dirname($dir), \sys_get_temp_dir())) { - throw new \Exception(__METHOD__ . "() operates only on subdirs of system's temp dir"); + if (!$dir || 0 !== strpos(dirname($dir), sys_get_temp_dir())) { + throw new Exception(__METHOD__ . "() operates only on subdirs of system's temp dir"); } - $children = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::CHILD_FIRST); + $children = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST); foreach ($children as $child) { if ($child->isDir()) { - \rmdir($child); + rmdir($child); } else { - \unlink($child); + unlink($child); } } - \rmdir($dir); + rmdir($dir); } - protected function isPruned(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemPoolInterface $cache, $name) + protected function isPruned(CacheItemPoolInterface $cache, $name) { - $getFileMethod = (new \ReflectionObject($cache))->getMethod('getFile'); - $getFileMethod->setAccessible(\true); - return !\file_exists($getFileMethod->invoke($cache, $name)); + $getFileMethod = (new ReflectionObject($cache))->getMethod('getFile'); + $getFileMethod->setAccessible(true); + return !file_exists($getFileMethod->invoke($cache, $name)); } } diff --git a/vendor/symfony/cache/Tests/Adapter/MaxIdLengthAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/MaxIdLengthAdapterTest.php index 82e2a4b18..e7fbed548 100644 --- a/vendor/symfony/cache/Tests/Adapter/MaxIdLengthAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/MaxIdLengthAdapterTest.php @@ -12,44 +12,48 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AbstractAdapter; -class MaxIdLengthAdapterTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use ReflectionClass; +use function str_repeat; +use function strlen; + +class MaxIdLengthAdapterTest extends TestCase { public function testLongKey() { - $cache = $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\MaxIdLengthAdapter::class)->setConstructorArgs([\str_repeat('-', 10)])->setMethods(['doHave', 'doFetch', 'doDelete', 'doSave', 'doClear'])->getMock(); + $cache = $this->getMockBuilder(MaxIdLengthAdapter::class)->setConstructorArgs([str_repeat('-', 10)])->setMethods(['doHave', 'doFetch', 'doDelete', 'doSave', 'doClear'])->getMock(); $cache->expects($this->exactly(2))->method('doHave')->withConsecutive([$this->equalTo('----------:0GTYWa9n4ed8vqNlOT2iEr:')], [$this->equalTo('----------:---------------------------------------')]); - $cache->hasItem(\str_repeat('-', 40)); - $cache->hasItem(\str_repeat('-', 39)); + $cache->hasItem(str_repeat('-', 40)); + $cache->hasItem(str_repeat('-', 39)); } public function testLongKeyVersioning() { - $cache = $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\MaxIdLengthAdapter::class)->setConstructorArgs([\str_repeat('-', 26)])->getMock(); + $cache = $this->getMockBuilder(MaxIdLengthAdapter::class)->setConstructorArgs([str_repeat('-', 26)])->getMock(); $cache->method('doFetch')->willReturn(['2:']); - $reflectionClass = new \ReflectionClass(\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AbstractAdapter::class); + $reflectionClass = new ReflectionClass(AbstractAdapter::class); $reflectionMethod = $reflectionClass->getMethod('getId'); - $reflectionMethod->setAccessible(\true); + $reflectionMethod->setAccessible(true); // No versioning enabled - $this->assertEquals('--------------------------:------------', $reflectionMethod->invokeArgs($cache, [\str_repeat('-', 12)])); - $this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, [\str_repeat('-', 12)]))); - $this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, [\str_repeat('-', 23)]))); - $this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, [\str_repeat('-', 40)]))); + $this->assertEquals('--------------------------:------------', $reflectionMethod->invokeArgs($cache, [str_repeat('-', 12)])); + $this->assertLessThanOrEqual(50, strlen($reflectionMethod->invokeArgs($cache, [str_repeat('-', 12)]))); + $this->assertLessThanOrEqual(50, strlen($reflectionMethod->invokeArgs($cache, [str_repeat('-', 23)]))); + $this->assertLessThanOrEqual(50, strlen($reflectionMethod->invokeArgs($cache, [str_repeat('-', 40)]))); $reflectionProperty = $reflectionClass->getProperty('versioningIsEnabled'); - $reflectionProperty->setAccessible(\true); - $reflectionProperty->setValue($cache, \true); + $reflectionProperty->setAccessible(true); + $reflectionProperty->setValue($cache, true); // Versioning enabled - $this->assertEquals('--------------------------:2:------------', $reflectionMethod->invokeArgs($cache, [\str_repeat('-', 12)])); - $this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, [\str_repeat('-', 12)]))); - $this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, [\str_repeat('-', 23)]))); - $this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, [\str_repeat('-', 40)]))); + $this->assertEquals('--------------------------:2:------------', $reflectionMethod->invokeArgs($cache, [str_repeat('-', 12)])); + $this->assertLessThanOrEqual(50, strlen($reflectionMethod->invokeArgs($cache, [str_repeat('-', 12)]))); + $this->assertLessThanOrEqual(50, strlen($reflectionMethod->invokeArgs($cache, [str_repeat('-', 23)]))); + $this->assertLessThanOrEqual(50, strlen($reflectionMethod->invokeArgs($cache, [str_repeat('-', 40)]))); } public function testTooLongNamespace() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Cache\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('Namespace must be 26 chars max, 40 given ("----------------------------------------")'); - $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\MaxIdLengthAdapter::class)->setConstructorArgs([\str_repeat('-', 40)])->getMock(); + $this->getMockBuilder(MaxIdLengthAdapter::class)->setConstructorArgs([str_repeat('-', 40)])->getMock(); } } -abstract class MaxIdLengthAdapter extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AbstractAdapter +abstract class MaxIdLengthAdapter extends AbstractAdapter { protected $maxIdLength = 50; public function __construct($ns) diff --git a/vendor/symfony/cache/Tests/Adapter/MemcachedAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/MemcachedAdapterTest.php index 51766a477..dd79c4182 100644 --- a/vendor/symfony/cache/Tests/Adapter/MemcachedAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/MemcachedAdapterTest.php @@ -10,37 +10,47 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter; +use _PhpScoper5ea00cc67502b\Memcached; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AbstractAdapter; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\MemcachedAdapter; -class MemcachedAdapterTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\AdapterTestCase +use function array_map; +use function class_exists; +use function filter_var; +use function getenv; +use function ini_get; +use function str_replace; +use function strtolower; +use const FILTER_VALIDATE_BOOLEAN; + +class MemcachedAdapterTest extends AdapterTestCase { protected $skippedTests = ['testHasItemReturnsFalseWhenDeferredItemIsExpired' => 'Testing expiration slows down the test suite', 'testDefaultLifeTime' => 'Testing expiration slows down the test suite']; protected static $client; public static function setUpBeforeClass() { - if (!\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\MemcachedAdapter::isSupported()) { + if (!MemcachedAdapter::isSupported()) { self::markTestSkipped('Extension memcached >=2.2.0 required.'); } - self::$client = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AbstractAdapter::createConnection('memcached://' . \getenv('MEMCACHED_HOST'), ['binary_protocol' => \false]); + self::$client = AbstractAdapter::createConnection('memcached://' . getenv('MEMCACHED_HOST'), ['binary_protocol' => false]); self::$client->get('foo'); $code = self::$client->getResultCode(); - if (\_PhpScoper5ea00cc67502b\Memcached::RES_SUCCESS !== $code && \_PhpScoper5ea00cc67502b\Memcached::RES_NOTFOUND !== $code) { - self::markTestSkipped('Memcached error: ' . \strtolower(self::$client->getResultMessage())); + if (Memcached::RES_SUCCESS !== $code && Memcached::RES_NOTFOUND !== $code) { + self::markTestSkipped('Memcached error: ' . strtolower(self::$client->getResultMessage())); } } public function createCachePool($defaultLifetime = 0) { - $client = $defaultLifetime ? \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AbstractAdapter::createConnection('memcached://' . \getenv('MEMCACHED_HOST')) : self::$client; - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\MemcachedAdapter($client, \str_replace('\\', '.', __CLASS__), $defaultLifetime); + $client = $defaultLifetime ? AbstractAdapter::createConnection('memcached://' . getenv('MEMCACHED_HOST')) : self::$client; + return new MemcachedAdapter($client, str_replace('\\', '.', __CLASS__), $defaultLifetime); } public function testOptions() { - $client = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\MemcachedAdapter::createConnection([], ['libketama_compatible' => \false, 'distribution' => 'modula', 'compression' => \true, 'serializer' => 'php', 'hash' => 'md5']); - $this->assertSame(\_PhpScoper5ea00cc67502b\Memcached::SERIALIZER_PHP, $client->getOption(\_PhpScoper5ea00cc67502b\Memcached::OPT_SERIALIZER)); - $this->assertSame(\_PhpScoper5ea00cc67502b\Memcached::HASH_MD5, $client->getOption(\_PhpScoper5ea00cc67502b\Memcached::OPT_HASH)); - $this->assertTrue($client->getOption(\_PhpScoper5ea00cc67502b\Memcached::OPT_COMPRESSION)); - $this->assertSame(0, $client->getOption(\_PhpScoper5ea00cc67502b\Memcached::OPT_LIBKETAMA_COMPATIBLE)); - $this->assertSame(\_PhpScoper5ea00cc67502b\Memcached::DISTRIBUTION_MODULA, $client->getOption(\_PhpScoper5ea00cc67502b\Memcached::OPT_DISTRIBUTION)); + $client = MemcachedAdapter::createConnection([], ['libketama_compatible' => false, 'distribution' => 'modula', 'compression' => true, 'serializer' => 'php', 'hash' => 'md5']); + $this->assertSame(Memcached::SERIALIZER_PHP, $client->getOption(Memcached::OPT_SERIALIZER)); + $this->assertSame(Memcached::HASH_MD5, $client->getOption(Memcached::OPT_HASH)); + $this->assertTrue($client->getOption(Memcached::OPT_COMPRESSION)); + $this->assertSame(0, $client->getOption(Memcached::OPT_LIBKETAMA_COMPATIBLE)); + $this->assertSame(Memcached::DISTRIBUTION_MODULA, $client->getOption(Memcached::OPT_DISTRIBUTION)); } /** * @dataProvider provideBadOptions @@ -49,7 +59,7 @@ public function testBadOptions($name, $value) { $this->expectException('ErrorException'); $this->expectExceptionMessage('constant(): Couldn\'t find constant Memcached::'); - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\MemcachedAdapter::createConnection([], [$name => $value]); + MemcachedAdapter::createConnection([], [$name => $value]); } public function provideBadOptions() { @@ -57,48 +67,48 @@ public function provideBadOptions() } public function testDefaultOptions() { - $this->assertTrue(\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\MemcachedAdapter::isSupported()); - $client = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\MemcachedAdapter::createConnection([]); - $this->assertTrue($client->getOption(\_PhpScoper5ea00cc67502b\Memcached::OPT_COMPRESSION)); - $this->assertSame(1, $client->getOption(\_PhpScoper5ea00cc67502b\Memcached::OPT_BINARY_PROTOCOL)); - $this->assertSame(1, $client->getOption(\_PhpScoper5ea00cc67502b\Memcached::OPT_TCP_NODELAY)); - $this->assertSame(1, $client->getOption(\_PhpScoper5ea00cc67502b\Memcached::OPT_LIBKETAMA_COMPATIBLE)); + $this->assertTrue(MemcachedAdapter::isSupported()); + $client = MemcachedAdapter::createConnection([]); + $this->assertTrue($client->getOption(Memcached::OPT_COMPRESSION)); + $this->assertSame(1, $client->getOption(Memcached::OPT_BINARY_PROTOCOL)); + $this->assertSame(1, $client->getOption(Memcached::OPT_TCP_NODELAY)); + $this->assertSame(1, $client->getOption(Memcached::OPT_LIBKETAMA_COMPATIBLE)); } public function testOptionSerializer() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Cache\\Exception\\CacheException'); $this->expectExceptionMessage('MemcachedAdapter: "serializer" option must be "php" or "igbinary".'); - if (!\_PhpScoper5ea00cc67502b\Memcached::HAVE_JSON) { + if (!Memcached::HAVE_JSON) { $this->markTestSkipped('Memcached::HAVE_JSON required'); } - new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\MemcachedAdapter(\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\MemcachedAdapter::createConnection([], ['serializer' => 'json'])); + new MemcachedAdapter(MemcachedAdapter::createConnection([], ['serializer' => 'json'])); } /** * @dataProvider provideServersSetting */ public function testServersSetting($dsn, $host, $port) { - $client1 = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\MemcachedAdapter::createConnection($dsn); - $client2 = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\MemcachedAdapter::createConnection([$dsn]); - $client3 = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\MemcachedAdapter::createConnection([[$host, $port]]); + $client1 = MemcachedAdapter::createConnection($dsn); + $client2 = MemcachedAdapter::createConnection([$dsn]); + $client3 = MemcachedAdapter::createConnection([[$host, $port]]); $expect = ['host' => $host, 'port' => $port]; $f = function ($s) { return ['host' => $s['host'], 'port' => $s['port']]; }; - $this->assertSame([$expect], \array_map($f, $client1->getServerList())); - $this->assertSame([$expect], \array_map($f, $client2->getServerList())); - $this->assertSame([$expect], \array_map($f, $client3->getServerList())); + $this->assertSame([$expect], array_map($f, $client1->getServerList())); + $this->assertSame([$expect], array_map($f, $client2->getServerList())); + $this->assertSame([$expect], array_map($f, $client3->getServerList())); } public function provideServersSetting() { (yield ['memcached://127.0.0.1/50', '127.0.0.1', 11211]); (yield ['memcached://localhost:11222?weight=25', 'localhost', 11222]); - if (\filter_var(\ini_get('memcached.use_sasl'), \FILTER_VALIDATE_BOOLEAN)) { + if (filter_var(ini_get('memcached.use_sasl'), FILTER_VALIDATE_BOOLEAN)) { (yield ['memcached://user:password@127.0.0.1?weight=50', '127.0.0.1', 11211]); } (yield ['memcached:///var/run/memcached.sock?weight=25', '/var/run/memcached.sock', 0]); (yield ['memcached:///var/local/run/memcached.socket?weight=25', '/var/local/run/memcached.socket', 0]); - if (\filter_var(\ini_get('memcached.use_sasl'), \FILTER_VALIDATE_BOOLEAN)) { + if (filter_var(ini_get('memcached.use_sasl'), FILTER_VALIDATE_BOOLEAN)) { (yield ['memcached://user:password@/var/local/run/memcached.socket?weight=25', '/var/local/run/memcached.socket', 0]); } } @@ -107,18 +117,18 @@ public function provideServersSetting() */ public function testDsnWithOptions($dsn, array $options, array $expectedOptions) { - $client = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\MemcachedAdapter::createConnection($dsn, $options); + $client = MemcachedAdapter::createConnection($dsn, $options); foreach ($expectedOptions as $option => $expect) { $this->assertSame($expect, $client->getOption($option)); } } public function provideDsnWithOptions() { - if (!\class_exists('_PhpScoper5ea00cc67502b\\Memcached')) { + if (!class_exists('_PhpScoper5ea00cc67502b\\Memcached')) { self::markTestSkipped('Extension memcached required.'); } - (yield ['memcached://localhost:11222?retry_timeout=10', [\_PhpScoper5ea00cc67502b\Memcached::OPT_RETRY_TIMEOUT => 8], [\_PhpScoper5ea00cc67502b\Memcached::OPT_RETRY_TIMEOUT => 10]]); - (yield ['memcached://localhost:11222?socket_recv_size=1&socket_send_size=2', [\_PhpScoper5ea00cc67502b\Memcached::OPT_RETRY_TIMEOUT => 8], [\_PhpScoper5ea00cc67502b\Memcached::OPT_SOCKET_RECV_SIZE => 1, \_PhpScoper5ea00cc67502b\Memcached::OPT_SOCKET_SEND_SIZE => 2, \_PhpScoper5ea00cc67502b\Memcached::OPT_RETRY_TIMEOUT => 8]]); + (yield ['memcached://localhost:11222?retry_timeout=10', [Memcached::OPT_RETRY_TIMEOUT => 8], [Memcached::OPT_RETRY_TIMEOUT => 10]]); + (yield ['memcached://localhost:11222?socket_recv_size=1&socket_send_size=2', [Memcached::OPT_RETRY_TIMEOUT => 8], [Memcached::OPT_SOCKET_RECV_SIZE => 1, Memcached::OPT_SOCKET_SEND_SIZE => 2, Memcached::OPT_RETRY_TIMEOUT => 8]]); } public function testClear() { diff --git a/vendor/symfony/cache/Tests/Adapter/NamespacedProxyAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/NamespacedProxyAdapterTest.php index 05cf919a6..c12aed980 100644 --- a/vendor/symfony/cache/Tests/Adapter/NamespacedProxyAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/NamespacedProxyAdapterTest.php @@ -15,10 +15,10 @@ /** * @group time-sensitive */ -class NamespacedProxyAdapterTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\ProxyAdapterTest +class NamespacedProxyAdapterTest extends ProxyAdapterTest { public function createCachePool($defaultLifetime = 0) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ProxyAdapter(new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ArrayAdapter($defaultLifetime), 'foo', $defaultLifetime); + return new ProxyAdapter(new ArrayAdapter($defaultLifetime), 'foo', $defaultLifetime); } } diff --git a/vendor/symfony/cache/Tests/Adapter/NullAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/NullAdapterTest.php index 4807a99db..eecab073d 100644 --- a/vendor/symfony/cache/Tests/Adapter/NullAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/NullAdapterTest.php @@ -16,11 +16,11 @@ /** * @group time-sensitive */ -class NullAdapterTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class NullAdapterTest extends TestCase { public function createCachePool() { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\NullAdapter(); + return new NullAdapter(); } public function testGetItem() { diff --git a/vendor/symfony/cache/Tests/Adapter/PdoAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/PdoAdapterTest.php index ec7c9cc94..39803fda4 100644 --- a/vendor/symfony/cache/Tests/Adapter/PdoAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/PdoAdapterTest.php @@ -12,35 +12,42 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\PdoAdapter; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Traits\PdoPruneableTrait; +use PDO; +use function extension_loaded; +use function sleep; +use function sys_get_temp_dir; +use function tempnam; +use function unlink; + /** * @group time-sensitive */ -class PdoAdapterTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\AdapterTestCase +class PdoAdapterTest extends AdapterTestCase { use PdoPruneableTrait; protected static $dbFile; public static function setUpBeforeClass() { - if (!\extension_loaded('pdo_sqlite')) { + if (!extension_loaded('pdo_sqlite')) { self::markTestSkipped('Extension pdo_sqlite required.'); } - self::$dbFile = \tempnam(\sys_get_temp_dir(), 'sf_sqlite_cache'); - $pool = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\PdoAdapter('sqlite:' . self::$dbFile); + self::$dbFile = tempnam(sys_get_temp_dir(), 'sf_sqlite_cache'); + $pool = new PdoAdapter('sqlite:' . self::$dbFile); $pool->createTable(); } public static function tearDownAfterClass() { - @\unlink(self::$dbFile); + @unlink(self::$dbFile); } public function createCachePool($defaultLifetime = 0) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\PdoAdapter('sqlite:' . self::$dbFile, 'ns', $defaultLifetime); + return new PdoAdapter('sqlite:' . self::$dbFile, 'ns', $defaultLifetime); } public function testCleanupExpiredItems() { - $pdo = new \PDO('sqlite:' . self::$dbFile); + $pdo = new PDO('sqlite:' . self::$dbFile); $getCacheItemCount = function () use($pdo) { - return (int) $pdo->query('SELECT COUNT(*) FROM cache_items')->fetch(\PDO::FETCH_COLUMN); + return (int) $pdo->query('SELECT COUNT(*) FROM cache_items')->fetch(PDO::FETCH_COLUMN); }; $this->assertSame(0, $getCacheItemCount()); $cache = $this->createCachePool(); @@ -49,7 +56,7 @@ public function testCleanupExpiredItems() $item->set(1); $cache->save($item); $this->assertSame(1, $getCacheItemCount()); - \sleep(2); + sleep(2); $newItem = $cache->getItem($item->getKey()); $this->assertFalse($newItem->isHit()); $this->assertSame(0, $getCacheItemCount(), 'PDOAdapter must clean up expired items'); diff --git a/vendor/symfony/cache/Tests/Adapter/PdoDbalAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/PdoDbalAdapterTest.php index f1888c17f..5075a4edb 100644 --- a/vendor/symfony/cache/Tests/Adapter/PdoDbalAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/PdoDbalAdapterTest.php @@ -13,28 +13,33 @@ use _PhpScoper5ea00cc67502b\Doctrine\DBAL\DriverManager; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\PdoAdapter; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Traits\PdoPruneableTrait; +use function extension_loaded; +use function sys_get_temp_dir; +use function tempnam; +use function unlink; + /** * @group time-sensitive */ -class PdoDbalAdapterTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\AdapterTestCase +class PdoDbalAdapterTest extends AdapterTestCase { use PdoPruneableTrait; protected static $dbFile; public static function setUpBeforeClass() { - if (!\extension_loaded('pdo_sqlite')) { + if (!extension_loaded('pdo_sqlite')) { self::markTestSkipped('Extension pdo_sqlite required.'); } - self::$dbFile = \tempnam(\sys_get_temp_dir(), 'sf_sqlite_cache'); - $pool = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\PdoAdapter(\_PhpScoper5ea00cc67502b\Doctrine\DBAL\DriverManager::getConnection(['driver' => 'pdo_sqlite', 'path' => self::$dbFile])); + self::$dbFile = tempnam(sys_get_temp_dir(), 'sf_sqlite_cache'); + $pool = new PdoAdapter(DriverManager::getConnection(['driver' => 'pdo_sqlite', 'path' => self::$dbFile])); $pool->createTable(); } public static function tearDownAfterClass() { - @\unlink(self::$dbFile); + @unlink(self::$dbFile); } public function createCachePool($defaultLifetime = 0) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\PdoAdapter(\_PhpScoper5ea00cc67502b\Doctrine\DBAL\DriverManager::getConnection(['driver' => 'pdo_sqlite', 'path' => self::$dbFile]), '', $defaultLifetime); + return new PdoAdapter(DriverManager::getConnection(['driver' => 'pdo_sqlite', 'path' => self::$dbFile]), '', $defaultLifetime); } } diff --git a/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterTest.php index 5da874100..0d74eed6b 100644 --- a/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterTest.php @@ -13,27 +13,35 @@ use _PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\NullAdapter; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\PhpArrayAdapter; +use Closure; +use function call_user_func; +use function file_exists; +use function file_get_contents; +use function serialize; +use function substr; +use function sys_get_temp_dir; + /** * @group time-sensitive */ -class PhpArrayAdapterTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\AdapterTestCase +class PhpArrayAdapterTest extends AdapterTestCase { protected $skippedTests = ['testBasicUsage' => 'PhpArrayAdapter is read-only.', 'testBasicUsageWithLongKey' => 'PhpArrayAdapter is read-only.', 'testClear' => 'PhpArrayAdapter is read-only.', 'testClearWithDeferredItems' => 'PhpArrayAdapter is read-only.', 'testDeleteItem' => 'PhpArrayAdapter is read-only.', 'testSaveExpired' => 'PhpArrayAdapter is read-only.', 'testSaveWithoutExpire' => 'PhpArrayAdapter is read-only.', 'testDeferredSave' => 'PhpArrayAdapter is read-only.', 'testDeferredSaveWithoutCommit' => 'PhpArrayAdapter is read-only.', 'testDeleteItems' => 'PhpArrayAdapter is read-only.', 'testDeleteDeferredItem' => 'PhpArrayAdapter is read-only.', 'testCommit' => 'PhpArrayAdapter is read-only.', 'testSaveDeferredWhenChangingValues' => 'PhpArrayAdapter is read-only.', 'testSaveDeferredOverwrite' => 'PhpArrayAdapter is read-only.', 'testIsHitDeferred' => 'PhpArrayAdapter is read-only.', 'testExpiresAt' => 'PhpArrayAdapter does not support expiration.', 'testExpiresAtWithNull' => 'PhpArrayAdapter does not support expiration.', 'testExpiresAfterWithNull' => 'PhpArrayAdapter does not support expiration.', 'testDeferredExpired' => 'PhpArrayAdapter does not support expiration.', 'testExpiration' => 'PhpArrayAdapter does not support expiration.', 'testGetItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.', 'testGetItemsInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.', 'testHasItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.', 'testDeleteItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.', 'testDeleteItemsInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.', 'testDefaultLifeTime' => 'PhpArrayAdapter does not allow configuring a default lifetime.', 'testPrune' => 'PhpArrayAdapter just proxies']; protected static $file; public static function setUpBeforeClass() { - self::$file = \sys_get_temp_dir() . '/symfony-cache/php-array-adapter-test.php'; + self::$file = sys_get_temp_dir() . '/symfony-cache/php-array-adapter-test.php'; } protected function tearDown() { $this->createCachePool()->clear(); - if (\file_exists(\sys_get_temp_dir() . '/symfony-cache')) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\FilesystemAdapterTest::rmdir(\sys_get_temp_dir() . '/symfony-cache'); + if (file_exists(sys_get_temp_dir() . '/symfony-cache')) { + FilesystemAdapterTest::rmdir(sys_get_temp_dir() . '/symfony-cache'); } } public function createCachePool() { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\PhpArrayAdapterWrapper(self::$file, new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\NullAdapter()); + return new PhpArrayAdapterWrapper(self::$file, new NullAdapter()); } public function testStore() { @@ -41,31 +49,31 @@ public function testStore() $arrayWithRefs[0] = 123; $arrayWithRefs[1] =& $arrayWithRefs[0]; $object = (object) ['foo' => 'bar', 'foo2' => 'bar2']; - $expected = ['null' => null, 'serializedString' => \serialize($object), 'arrayWithRefs' => $arrayWithRefs, 'object' => $object, 'arrayWithObject' => ['bar' => $object]]; + $expected = ['null' => null, 'serializedString' => serialize($object), 'arrayWithRefs' => $arrayWithRefs, 'object' => $object, 'arrayWithObject' => ['bar' => $object]]; $adapter = $this->createCachePool(); $adapter->warmUp($expected); foreach ($expected as $key => $value) { - $this->assertSame(\serialize($value), \serialize($adapter->getItem($key)->get()), 'Warm up should create a PHP file that OPCache can load in memory'); + $this->assertSame(serialize($value), serialize($adapter->getItem($key)->get()), 'Warm up should create a PHP file that OPCache can load in memory'); } } public function testStoredFile() { - $expected = ['integer' => 42, 'float' => 42.42, 'boolean' => \true, 'array_simple' => ['foo', 'bar'], 'array_associative' => ['foo' => 'bar', 'foo2' => 'bar2']]; + $expected = ['integer' => 42, 'float' => 42.42, 'boolean' => true, 'array_simple' => ['foo', 'bar'], 'array_associative' => ['foo' => 'bar', 'foo2' => 'bar2']]; $adapter = $this->createCachePool(); $adapter->warmUp($expected); - $values = eval(\substr(\file_get_contents(self::$file), 6)); + $values = eval(substr(file_get_contents(self::$file), 6)); $this->assertSame($expected, $values, 'Warm up should create a PHP file that OPCache can load in memory'); } } -class PhpArrayAdapterWrapper extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\PhpArrayAdapter +class PhpArrayAdapterWrapper extends PhpArrayAdapter { - public function save(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item) + public function save(CacheItemInterface $item) { - \call_user_func(\Closure::bind(function () use($item) { + call_user_func(Closure::bind(function () use($item) { $this->values[$item->getKey()] = $item->get(); $this->warmUp($this->values); - $this->values = eval(\substr(\file_get_contents($this->file), 6)); - }, $this, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\PhpArrayAdapter::class)); - return \true; + $this->values = eval(substr(file_get_contents($this->file), 6)); + }, $this, PhpArrayAdapter::class)); + return true; } } diff --git a/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php b/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php index 2fcf7b6b7..f56420b44 100644 --- a/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php +++ b/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php @@ -12,26 +12,29 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\FilesystemAdapter; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\PhpArrayAdapter; +use function file_exists; +use function sys_get_temp_dir; + /** * @group time-sensitive */ -class PhpArrayAdapterWithFallbackTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\AdapterTestCase +class PhpArrayAdapterWithFallbackTest extends AdapterTestCase { protected $skippedTests = ['testGetItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.', 'testGetItemsInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.', 'testHasItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.', 'testDeleteItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.', 'testDeleteItemsInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.', 'testPrune' => 'PhpArrayAdapter just proxies']; protected static $file; public static function setUpBeforeClass() { - self::$file = \sys_get_temp_dir() . '/symfony-cache/php-array-adapter-test.php'; + self::$file = sys_get_temp_dir() . '/symfony-cache/php-array-adapter-test.php'; } protected function tearDown() { $this->createCachePool()->clear(); - if (\file_exists(\sys_get_temp_dir() . '/symfony-cache')) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\FilesystemAdapterTest::rmdir(\sys_get_temp_dir() . '/symfony-cache'); + if (file_exists(sys_get_temp_dir() . '/symfony-cache')) { + FilesystemAdapterTest::rmdir(sys_get_temp_dir() . '/symfony-cache'); } } public function createCachePool($defaultLifetime = 0) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\PhpArrayAdapter(self::$file, new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\FilesystemAdapter('php-array-fallback', $defaultLifetime)); + return new PhpArrayAdapter(self::$file, new FilesystemAdapter('php-array-fallback', $defaultLifetime)); } } diff --git a/vendor/symfony/cache/Tests/Adapter/PhpFilesAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/PhpFilesAdapterTest.php index 273b3a9ac..e84fcf74f 100644 --- a/vendor/symfony/cache/Tests/Adapter/PhpFilesAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/PhpFilesAdapterTest.php @@ -12,27 +12,31 @@ use _PhpScoper5ea00cc67502b\Psr\Cache\CacheItemPoolInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\PhpFilesAdapter; +use ReflectionObject; +use function file_exists; +use function sys_get_temp_dir; + /** * @group time-sensitive */ -class PhpFilesAdapterTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\AdapterTestCase +class PhpFilesAdapterTest extends AdapterTestCase { protected $skippedTests = ['testDefaultLifeTime' => 'PhpFilesAdapter does not allow configuring a default lifetime.']; public function createCachePool() { - if (!\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\PhpFilesAdapter::isSupported()) { + if (!PhpFilesAdapter::isSupported()) { $this->markTestSkipped('OPcache extension is not enabled.'); } - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\PhpFilesAdapter('sf-cache'); + return new PhpFilesAdapter('sf-cache'); } public static function tearDownAfterClass() { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\FilesystemAdapterTest::rmdir(\sys_get_temp_dir() . '/symfony-cache'); + FilesystemAdapterTest::rmdir(sys_get_temp_dir() . '/symfony-cache'); } - protected function isPruned(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemPoolInterface $cache, $name) + protected function isPruned(CacheItemPoolInterface $cache, $name) { - $getFileMethod = (new \ReflectionObject($cache))->getMethod('getFile'); - $getFileMethod->setAccessible(\true); - return !\file_exists($getFileMethod->invoke($cache, $name)); + $getFileMethod = (new ReflectionObject($cache))->getMethod('getFile'); + $getFileMethod->setAccessible(true); + return !file_exists($getFileMethod->invoke($cache, $name)); } } diff --git a/vendor/symfony/cache/Tests/Adapter/PredisAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/PredisAdapterTest.php index 32978ce13..ef6590ccd 100644 --- a/vendor/symfony/cache/Tests/Adapter/PredisAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/PredisAdapterTest.php @@ -10,23 +10,26 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter; +use _PhpScoper5ea00cc67502b\Predis\Client; use _PhpScoper5ea00cc67502b\Predis\Connection\StreamConnection; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\RedisAdapter; -class PredisAdapterTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\AbstractRedisAdapterTest +use function getenv; + +class PredisAdapterTest extends AbstractRedisAdapterTest { public static function setUpBeforeClass() { parent::setUpBeforeClass(); - self::$redis = new \_PhpScoper5ea00cc67502b\Predis\Client(['host' => \getenv('REDIS_HOST')]); + self::$redis = new Client(['host' => getenv('REDIS_HOST')]); } public function testCreateConnection() { - $redisHost = \getenv('REDIS_HOST'); - $redis = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\RedisAdapter::createConnection('redis://' . $redisHost . '/1', ['class' => \_PhpScoper5ea00cc67502b\Predis\Client::class, 'timeout' => 3]); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Predis\Client::class, $redis); + $redisHost = getenv('REDIS_HOST'); + $redis = RedisAdapter::createConnection('redis://' . $redisHost . '/1', ['class' => Client::class, 'timeout' => 3]); + $this->assertInstanceOf(Client::class, $redis); $connection = $redis->getConnection(); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Predis\Connection\StreamConnection::class, $connection); - $params = ['scheme' => 'tcp', 'host' => $redisHost, 'path' => '', 'dbindex' => '1', 'port' => 6379, 'class' => '_PhpScoper5ea00cc67502b\\Predis\\Client', 'timeout' => 3, 'persistent' => 0, 'persistent_id' => null, 'read_timeout' => 0, 'retry_interval' => 0, 'lazy' => \false, 'database' => '1', 'password' => null]; + $this->assertInstanceOf(StreamConnection::class, $connection); + $params = ['scheme' => 'tcp', 'host' => $redisHost, 'path' => '', 'dbindex' => '1', 'port' => 6379, 'class' => '_PhpScoper5ea00cc67502b\\Predis\\Client', 'timeout' => 3, 'persistent' => 0, 'persistent_id' => null, 'read_timeout' => 0, 'retry_interval' => 0, 'lazy' => false, 'database' => '1', 'password' => null]; $this->assertSame($params, $connection->getParameters()->toArray()); } } diff --git a/vendor/symfony/cache/Tests/Adapter/PredisClusterAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/PredisClusterAdapterTest.php index ab67b4d3d..e1b7a57f9 100644 --- a/vendor/symfony/cache/Tests/Adapter/PredisClusterAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/PredisClusterAdapterTest.php @@ -10,12 +10,15 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter; -class PredisClusterAdapterTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\AbstractRedisAdapterTest +use _PhpScoper5ea00cc67502b\Predis\Client; +use function getenv; + +class PredisClusterAdapterTest extends AbstractRedisAdapterTest { public static function setUpBeforeClass() { parent::setUpBeforeClass(); - self::$redis = new \_PhpScoper5ea00cc67502b\Predis\Client([['host' => \getenv('REDIS_HOST')]]); + self::$redis = new Client([['host' => getenv('REDIS_HOST')]]); } public static function tearDownAfterClass() { diff --git a/vendor/symfony/cache/Tests/Adapter/PredisRedisClusterAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/PredisRedisClusterAdapterTest.php index 058409378..66c165364 100644 --- a/vendor/symfony/cache/Tests/Adapter/PredisRedisClusterAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/PredisRedisClusterAdapterTest.php @@ -10,14 +10,18 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter; -class PredisRedisClusterAdapterTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\AbstractRedisAdapterTest +use _PhpScoper5ea00cc67502b\Predis\Client; +use function explode; +use function getenv; + +class PredisRedisClusterAdapterTest extends AbstractRedisAdapterTest { public static function setUpBeforeClass() { - if (!($hosts = \getenv('REDIS_CLUSTER_HOSTS'))) { + if (!($hosts = getenv('REDIS_CLUSTER_HOSTS'))) { self::markTestSkipped('REDIS_CLUSTER_HOSTS env var is not defined.'); } - self::$redis = new \_PhpScoper5ea00cc67502b\Predis\Client(\explode(' ', $hosts), ['cluster' => 'redis']); + self::$redis = new Client(explode(' ', $hosts), ['cluster' => 'redis']); } public static function tearDownAfterClass() { diff --git a/vendor/symfony/cache/Tests/Adapter/ProxyAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/ProxyAdapterTest.php index 622e0b47c..e3f32cecc 100644 --- a/vendor/symfony/cache/Tests/Adapter/ProxyAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/ProxyAdapterTest.php @@ -14,31 +14,33 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ArrayAdapter; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ProxyAdapter; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem; +use Exception; + /** * @group time-sensitive */ -class ProxyAdapterTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\AdapterTestCase +class ProxyAdapterTest extends AdapterTestCase { protected $skippedTests = ['testDeferredSaveWithoutCommit' => 'Assumes a shared cache which ArrayAdapter is not.', 'testSaveWithoutExpire' => 'Assumes a shared cache which ArrayAdapter is not.', 'testPrune' => 'ProxyAdapter just proxies']; public function createCachePool($defaultLifetime = 0) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ProxyAdapter(new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ArrayAdapter(), '', $defaultLifetime); + return new ProxyAdapter(new ArrayAdapter(), '', $defaultLifetime); } public function testProxyfiedItem() { $this->expectException('Exception'); $this->expectExceptionMessage('OK bar'); - $item = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem(); - $pool = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ProxyAdapter(new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\TestingArrayAdapter($item)); + $item = new CacheItem(); + $pool = new ProxyAdapter(new TestingArrayAdapter($item)); $proxyItem = $pool->getItem('foo'); $this->assertNotSame($item, $proxyItem); $pool->save($proxyItem->set('bar')); } } -class TestingArrayAdapter extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ArrayAdapter +class TestingArrayAdapter extends ArrayAdapter { private $item; - public function __construct(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item) + public function __construct(CacheItemInterface $item) { $this->item = $item; } @@ -46,10 +48,10 @@ public function getItem($key) { return $this->item; } - public function save(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item) + public function save(CacheItemInterface $item) { if ($item === $this->item) { - throw new \Exception('OK ' . $item->get()); + throw new Exception('OK ' . $item->get()); } } } diff --git a/vendor/symfony/cache/Tests/Adapter/RedisAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/RedisAdapterTest.php index b3586068a..fbab94400 100644 --- a/vendor/symfony/cache/Tests/Adapter/RedisAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/RedisAdapterTest.php @@ -10,36 +10,39 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter; +use _PhpScoper5ea00cc67502b\Redis; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AbstractAdapter; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\RedisAdapter; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\RedisProxy; -class RedisAdapterTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\AbstractRedisAdapterTest +use function getenv; + +class RedisAdapterTest extends AbstractRedisAdapterTest { public static function setUpBeforeClass() { parent::setUpBeforeClass(); - self::$redis = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AbstractAdapter::createConnection('redis://' . \getenv('REDIS_HOST'), ['lazy' => \true]); + self::$redis = AbstractAdapter::createConnection('redis://' . getenv('REDIS_HOST'), ['lazy' => true]); } public function createCachePool($defaultLifetime = 0) { $adapter = parent::createCachePool($defaultLifetime); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\RedisProxy::class, self::$redis); + $this->assertInstanceOf(RedisProxy::class, self::$redis); return $adapter; } public function testCreateConnection() { - $redisHost = \getenv('REDIS_HOST'); - $redis = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\RedisAdapter::createConnection('redis://' . $redisHost); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Redis::class, $redis); + $redisHost = getenv('REDIS_HOST'); + $redis = RedisAdapter::createConnection('redis://' . $redisHost); + $this->assertInstanceOf(Redis::class, $redis); $this->assertTrue($redis->isConnected()); $this->assertSame(0, $redis->getDbNum()); - $redis = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\RedisAdapter::createConnection('redis://' . $redisHost . '/2'); + $redis = RedisAdapter::createConnection('redis://' . $redisHost . '/2'); $this->assertSame(2, $redis->getDbNum()); - $redis = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\RedisAdapter::createConnection('redis://' . $redisHost, ['timeout' => 3]); + $redis = RedisAdapter::createConnection('redis://' . $redisHost, ['timeout' => 3]); $this->assertEquals(3, $redis->getTimeout()); - $redis = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\RedisAdapter::createConnection('redis://' . $redisHost . '?timeout=4'); + $redis = RedisAdapter::createConnection('redis://' . $redisHost . '?timeout=4'); $this->assertEquals(4, $redis->getTimeout()); - $redis = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\RedisAdapter::createConnection('redis://' . $redisHost, ['read_timeout' => 5]); + $redis = RedisAdapter::createConnection('redis://' . $redisHost, ['read_timeout' => 5]); $this->assertEquals(5, $redis->getReadTimeout()); } /** @@ -49,7 +52,7 @@ public function testFailedCreateConnection($dsn) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Cache\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('Redis connection failed'); - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\RedisAdapter::createConnection($dsn); + RedisAdapter::createConnection($dsn); } public function provideFailedCreateConnection() { @@ -62,7 +65,7 @@ public function testInvalidCreateConnection($dsn) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Cache\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('Invalid Redis DSN'); - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\RedisAdapter::createConnection($dsn); + RedisAdapter::createConnection($dsn); } public function provideInvalidCreateConnection() { diff --git a/vendor/symfony/cache/Tests/Adapter/RedisArrayAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/RedisArrayAdapterTest.php index b55b465e3..dfe471074 100644 --- a/vendor/symfony/cache/Tests/Adapter/RedisArrayAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/RedisArrayAdapterTest.php @@ -10,14 +10,18 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter; -class RedisArrayAdapterTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\AbstractRedisAdapterTest +use _PhpScoper5ea00cc67502b\RedisArray; +use function class_exists; +use function getenv; + +class RedisArrayAdapterTest extends AbstractRedisAdapterTest { public static function setUpBeforeClass() { parent::setupBeforeClass(); - if (!\class_exists('_PhpScoper5ea00cc67502b\\RedisArray')) { + if (!class_exists('_PhpScoper5ea00cc67502b\\RedisArray')) { self::markTestSkipped('The RedisArray class is required.'); } - self::$redis = new \_PhpScoper5ea00cc67502b\RedisArray([\getenv('REDIS_HOST')], ['lazy_connect' => \true]); + self::$redis = new RedisArray([getenv('REDIS_HOST')], ['lazy_connect' => true]); } } diff --git a/vendor/symfony/cache/Tests/Adapter/RedisClusterAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/RedisClusterAdapterTest.php index d593a80c5..9d741deed 100644 --- a/vendor/symfony/cache/Tests/Adapter/RedisClusterAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/RedisClusterAdapterTest.php @@ -10,16 +10,21 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter; -class RedisClusterAdapterTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\AbstractRedisAdapterTest +use _PhpScoper5ea00cc67502b\RedisCluster; +use function class_exists; +use function explode; +use function getenv; + +class RedisClusterAdapterTest extends AbstractRedisAdapterTest { public static function setUpBeforeClass() { - if (!\class_exists('_PhpScoper5ea00cc67502b\\RedisCluster')) { + if (!class_exists('_PhpScoper5ea00cc67502b\\RedisCluster')) { self::markTestSkipped('The RedisCluster class is required.'); } - if (!($hosts = \getenv('REDIS_CLUSTER_HOSTS'))) { + if (!($hosts = getenv('REDIS_CLUSTER_HOSTS'))) { self::markTestSkipped('REDIS_CLUSTER_HOSTS env var is not defined.'); } - self::$redis = new \_PhpScoper5ea00cc67502b\RedisCluster(null, \explode(' ', $hosts)); + self::$redis = new RedisCluster(null, explode(' ', $hosts)); } } diff --git a/vendor/symfony/cache/Tests/Adapter/SimpleCacheAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/SimpleCacheAdapterTest.php index b21de58a6..cb6b71a69 100644 --- a/vendor/symfony/cache/Tests/Adapter/SimpleCacheAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/SimpleCacheAdapterTest.php @@ -16,16 +16,16 @@ /** * @group time-sensitive */ -class SimpleCacheAdapterTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\AdapterTestCase +class SimpleCacheAdapterTest extends AdapterTestCase { protected $skippedTests = ['testPrune' => 'SimpleCache just proxies']; public function createCachePool($defaultLifetime = 0) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\SimpleCacheAdapter(new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\FilesystemCache(), '', $defaultLifetime); + return new SimpleCacheAdapter(new FilesystemCache(), '', $defaultLifetime); } public function testValidCacheKeyWithNamespace() { - $cache = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\SimpleCacheAdapter(new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\ArrayCache(), 'some_namespace', 0); + $cache = new SimpleCacheAdapter(new ArrayCache(), 'some_namespace', 0); $item = $cache->getItem('my_key'); $item->set('someValue'); $cache->save($item); diff --git a/vendor/symfony/cache/Tests/Adapter/TagAwareAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/TagAwareAdapterTest.php index c837fce1c..7a404c762 100644 --- a/vendor/symfony/cache/Tests/Adapter/TagAwareAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/TagAwareAdapterTest.php @@ -15,18 +15,21 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AdapterInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\FilesystemAdapter; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\TagAwareAdapter; +use function sleep; +use function sys_get_temp_dir; + /** * @group time-sensitive */ -class TagAwareAdapterTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\AdapterTestCase +class TagAwareAdapterTest extends AdapterTestCase { public function createCachePool($defaultLifetime = 0) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\TagAwareAdapter(new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\FilesystemAdapter('', $defaultLifetime)); + return new TagAwareAdapter(new FilesystemAdapter('', $defaultLifetime)); } public static function tearDownAfterClass() { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\FilesystemAdapterTest::rmdir(\sys_get_temp_dir() . '/symfony-cache'); + FilesystemAdapterTest::rmdir(sys_get_temp_dir() . '/symfony-cache'); } public function testInvalidTag() { @@ -103,7 +106,7 @@ public function testTagItemExpiry() $pool->save($item); $pool->invalidateTags(['baz']); $this->assertFalse($pool->getItem('foo')->isHit()); - \sleep(20); + sleep(20); $this->assertFalse($pool->getItem('foo')->isHit()); } public function testGetPreviousTags() @@ -116,30 +119,30 @@ public function testGetPreviousTags() } public function testPrune() { - $cache = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\TagAwareAdapter($this->getPruneableMock()); + $cache = new TagAwareAdapter($this->getPruneableMock()); $this->assertTrue($cache->prune()); - $cache = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\TagAwareAdapter($this->getNonPruneableMock()); + $cache = new TagAwareAdapter($this->getNonPruneableMock()); $this->assertFalse($cache->prune()); - $cache = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\TagAwareAdapter($this->getFailingPruneableMock()); + $cache = new TagAwareAdapter($this->getFailingPruneableMock()); $this->assertFalse($cache->prune()); } public function testKnownTagVersionsTtl() { - $itemsPool = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\FilesystemAdapter('', 10); - $tagsPool = $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AdapterInterface::class)->getMock(); - $pool = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\TagAwareAdapter($itemsPool, $tagsPool, 10); + $itemsPool = new FilesystemAdapter('', 10); + $tagsPool = $this->getMockBuilder(AdapterInterface::class)->getMock(); + $pool = new TagAwareAdapter($itemsPool, $tagsPool, 10); $item = $pool->getItem('foo'); $item->tag(['baz']); $item->expiresAfter(100); - $tag = $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface::class)->getMock(); + $tag = $this->getMockBuilder(CacheItemInterface::class)->getMock(); $tag->expects(self::exactly(2))->method('get')->willReturn(10); - $tagsPool->expects(self::exactly(2))->method('getItems')->willReturn(['baz' . \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\TagAwareAdapter::TAGS_PREFIX => $tag]); + $tagsPool->expects(self::exactly(2))->method('getItems')->willReturn(['baz' . TagAwareAdapter::TAGS_PREFIX => $tag]); $pool->save($item); $this->assertTrue($pool->getItem('foo')->isHit()); $this->assertTrue($pool->getItem('foo')->isHit()); - \sleep(20); + sleep(20); $this->assertTrue($pool->getItem('foo')->isHit()); - \sleep(5); + sleep(5); $this->assertTrue($pool->getItem('foo')->isHit()); } public function testTagEntryIsCreatedForItemWithoutTags() @@ -148,8 +151,8 @@ public function testTagEntryIsCreatedForItemWithoutTags() $itemKey = 'foo'; $item = $pool->getItem($itemKey); $pool->save($item); - $adapter = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\FilesystemAdapter(); - $this->assertTrue($adapter->hasItem(\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\TagAwareAdapter::TAGS_PREFIX . $itemKey)); + $adapter = new FilesystemAdapter(); + $this->assertTrue($adapter->hasItem(TagAwareAdapter::TAGS_PREFIX . $itemKey)); } public function testHasItemReturnsFalseWhenPoolDoesNotHaveItemTags() { @@ -158,8 +161,8 @@ public function testHasItemReturnsFalseWhenPoolDoesNotHaveItemTags() $item = $pool->getItem($itemKey); $pool->save($item); $anotherPool = $this->createCachePool(); - $adapter = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\FilesystemAdapter(); - $adapter->deleteItem(\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\TagAwareAdapter::TAGS_PREFIX . $itemKey); + $adapter = new FilesystemAdapter(); + $adapter->deleteItem(TagAwareAdapter::TAGS_PREFIX . $itemKey); //simulate item losing tags pair $this->assertFalse($anotherPool->hasItem($itemKey)); } @@ -170,8 +173,8 @@ public function testGetItemReturnsCacheMissWhenPoolDoesNotHaveItemTags() $item = $pool->getItem($itemKey); $pool->save($item); $anotherPool = $this->createCachePool(); - $adapter = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\FilesystemAdapter(); - $adapter->deleteItem(\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\TagAwareAdapter::TAGS_PREFIX . $itemKey); + $adapter = new FilesystemAdapter(); + $adapter->deleteItem(TagAwareAdapter::TAGS_PREFIX . $itemKey); //simulate item losing tags pair $item = $anotherPool->getItem($itemKey); $this->assertFalse($item->isHit()); @@ -183,7 +186,7 @@ public function testHasItemReturnsFalseWhenPoolDoesNotHaveItemAndOnlyHasTags() $item = $pool->getItem($itemKey); $pool->save($item); $anotherPool = $this->createCachePool(); - $adapter = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\FilesystemAdapter(); + $adapter = new FilesystemAdapter(); $adapter->deleteItem($itemKey); //simulate losing item but keeping tags $this->assertFalse($anotherPool->hasItem($itemKey)); @@ -195,7 +198,7 @@ public function testGetItemReturnsCacheMissWhenPoolDoesNotHaveItemAndOnlyHasTags $item = $pool->getItem($itemKey); $pool->save($item); $anotherPool = $this->createCachePool(); - $adapter = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\FilesystemAdapter(); + $adapter = new FilesystemAdapter(); $adapter->deleteItem($itemKey); //simulate losing item but keeping tags $item = $anotherPool->getItem($itemKey); @@ -206,8 +209,8 @@ public function testGetItemReturnsCacheMissWhenPoolDoesNotHaveItemAndOnlyHasTags */ private function getPruneableMock() { - $pruneable = $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\PruneableCacheInterface::class)->getMock(); - $pruneable->expects($this->atLeastOnce())->method('prune')->willReturn(\true); + $pruneable = $this->getMockBuilder(PruneableCacheInterface::class)->getMock(); + $pruneable->expects($this->atLeastOnce())->method('prune')->willReturn(true); return $pruneable; } /** @@ -215,8 +218,8 @@ private function getPruneableMock() */ private function getFailingPruneableMock() { - $pruneable = $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\PruneableCacheInterface::class)->getMock(); - $pruneable->expects($this->atLeastOnce())->method('prune')->willReturn(\false); + $pruneable = $this->getMockBuilder(PruneableCacheInterface::class)->getMock(); + $pruneable->expects($this->atLeastOnce())->method('prune')->willReturn(false); return $pruneable; } /** @@ -224,6 +227,6 @@ private function getFailingPruneableMock() */ private function getNonPruneableMock() { - return $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AdapterInterface::class)->getMock(); + return $this->getMockBuilder(AdapterInterface::class)->getMock(); } } diff --git a/vendor/symfony/cache/Tests/Adapter/TagAwareAndProxyAdapterIntegrationTest.php b/vendor/symfony/cache/Tests/Adapter/TagAwareAndProxyAdapterIntegrationTest.php index 550f59da9..7a5739542 100644 --- a/vendor/symfony/cache/Tests/Adapter/TagAwareAndProxyAdapterIntegrationTest.php +++ b/vendor/symfony/cache/Tests/Adapter/TagAwareAndProxyAdapterIntegrationTest.php @@ -8,14 +8,14 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ProxyAdapter; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\TagAwareAdapter; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Fixtures\ExternalAdapter; -class TagAwareAndProxyAdapterIntegrationTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class TagAwareAndProxyAdapterIntegrationTest extends TestCase { /** * @dataProvider dataProvider */ - public function testIntegrationUsingProxiedAdapter(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemPoolInterface $proxiedAdapter) + public function testIntegrationUsingProxiedAdapter(CacheItemPoolInterface $proxiedAdapter) { - $cache = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\TagAwareAdapter(new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ProxyAdapter($proxiedAdapter)); + $cache = new TagAwareAdapter(new ProxyAdapter($proxiedAdapter)); $item = $cache->getItem('foo'); $item->tag(['tag1', 'tag2']); $item->set('bar'); @@ -25,10 +25,10 @@ public function testIntegrationUsingProxiedAdapter(\_PhpScoper5ea00cc67502b\Psr\ public function dataProvider() { return [ - [new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ArrayAdapter()], + [new ArrayAdapter()], // also testing with a non-AdapterInterface implementation // because the ProxyAdapter behaves slightly different for those - [new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Fixtures\ExternalAdapter()], + [new ExternalAdapter()], ]; } } diff --git a/vendor/symfony/cache/Tests/Adapter/TraceableAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/TraceableAdapterTest.php index 51fe1fe83..fc718a53d 100644 --- a/vendor/symfony/cache/Tests/Adapter/TraceableAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/TraceableAdapterTest.php @@ -15,12 +15,12 @@ /** * @group time-sensitive */ -class TraceableAdapterTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\AdapterTestCase +class TraceableAdapterTest extends AdapterTestCase { protected $skippedTests = ['testPrune' => 'TraceableAdapter just proxies']; public function createCachePool($defaultLifetime = 0) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\TraceableAdapter(new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\FilesystemAdapter('', $defaultLifetime)); + return new TraceableAdapter(new FilesystemAdapter('', $defaultLifetime)); } public function testGetItemMissTrace() { @@ -30,7 +30,7 @@ public function testGetItemMissTrace() $this->assertCount(1, $calls); $call = $calls[0]; $this->assertSame('getItem', $call->name); - $this->assertSame(['k' => \false], $call->result); + $this->assertSame(['k' => false], $call->result); $this->assertSame(0, $call->hits); $this->assertSame(1, $call->misses); $this->assertNotEmpty($call->start); @@ -59,7 +59,7 @@ public function testGetItemsMissTrace() $this->assertCount(1, $calls); $call = $calls[0]; $this->assertSame('getItems', $call->name); - $this->assertSame(['k0' => \false, 'k1' => \false], $call->result); + $this->assertSame(['k0' => false, 'k1' => false], $call->result); $this->assertSame(2, $call->misses); $this->assertNotEmpty($call->start); $this->assertNotEmpty($call->end); @@ -72,7 +72,7 @@ public function testHasItemMissTrace() $this->assertCount(1, $calls); $call = $calls[0]; $this->assertSame('hasItem', $call->name); - $this->assertSame(['k' => \false], $call->result); + $this->assertSame(['k' => false], $call->result); $this->assertNotEmpty($call->start); $this->assertNotEmpty($call->end); } @@ -86,7 +86,7 @@ public function testHasItemHitTrace() $this->assertCount(3, $calls); $call = $calls[2]; $this->assertSame('hasItem', $call->name); - $this->assertSame(['k' => \true], $call->result); + $this->assertSame(['k' => true], $call->result); $this->assertNotEmpty($call->start); $this->assertNotEmpty($call->end); } @@ -98,7 +98,7 @@ public function testDeleteItemTrace() $this->assertCount(1, $calls); $call = $calls[0]; $this->assertSame('deleteItem', $call->name); - $this->assertSame(['k' => \true], $call->result); + $this->assertSame(['k' => true], $call->result); $this->assertSame(0, $call->hits); $this->assertSame(0, $call->misses); $this->assertNotEmpty($call->start); @@ -113,7 +113,7 @@ public function testDeleteItemsTrace() $this->assertCount(1, $calls); $call = $calls[0]; $this->assertSame('deleteItems', $call->name); - $this->assertSame(['keys' => $arg, 'result' => \true], $call->result); + $this->assertSame(['keys' => $arg, 'result' => true], $call->result); $this->assertSame(0, $call->hits); $this->assertSame(0, $call->misses); $this->assertNotEmpty($call->start); @@ -128,7 +128,7 @@ public function testSaveTrace() $this->assertCount(2, $calls); $call = $calls[1]; $this->assertSame('save', $call->name); - $this->assertSame(['k' => \true], $call->result); + $this->assertSame(['k' => true], $call->result); $this->assertSame(0, $call->hits); $this->assertSame(0, $call->misses); $this->assertNotEmpty($call->start); @@ -143,7 +143,7 @@ public function testSaveDeferredTrace() $this->assertCount(2, $calls); $call = $calls[1]; $this->assertSame('saveDeferred', $call->name); - $this->assertSame(['k' => \true], $call->result); + $this->assertSame(['k' => true], $call->result); $this->assertSame(0, $call->hits); $this->assertSame(0, $call->misses); $this->assertNotEmpty($call->start); diff --git a/vendor/symfony/cache/Tests/Adapter/TraceableTagAwareAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/TraceableTagAwareAdapterTest.php index 703366d00..e1d7709e8 100644 --- a/vendor/symfony/cache/Tests/Adapter/TraceableTagAwareAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/TraceableTagAwareAdapterTest.php @@ -16,11 +16,11 @@ /** * @group time-sensitive */ -class TraceableTagAwareAdapterTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\TraceableAdapterTest +class TraceableTagAwareAdapterTest extends TraceableAdapterTest { public function testInvalidateTags() { - $pool = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\TraceableTagAwareAdapter(new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\TagAwareAdapter(new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\FilesystemAdapter())); + $pool = new TraceableTagAwareAdapter(new TagAwareAdapter(new FilesystemAdapter())); $pool->invalidateTags(['foo']); $calls = $pool->getCalls(); $this->assertCount(1, $calls); diff --git a/vendor/symfony/cache/Tests/Adapter/index.php b/vendor/symfony/cache/Tests/Adapter/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/cache/Tests/Adapter/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/cache/Tests/CacheItemTest.php b/vendor/symfony/cache/Tests/CacheItemTest.php index ed89ab6b5..38f21aa18 100644 --- a/vendor/symfony/cache/Tests/CacheItemTest.php +++ b/vendor/symfony/cache/Tests/CacheItemTest.php @@ -12,11 +12,15 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem; -class CacheItemTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use Closure; +use Exception; +use function call_user_func; + +class CacheItemTest extends TestCase { public function testValidKey() { - $this->assertSame('foo', \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::validateKey('foo')); + $this->assertSame('foo', CacheItem::validateKey('foo')); } /** * @dataProvider provideInvalidKey @@ -25,20 +29,20 @@ public function testInvalidKey($key) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Cache\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('Cache key'); - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::validateKey($key); + CacheItem::validateKey($key); } public function provideInvalidKey() { - return [[''], ['{'], ['}'], ['('], [')'], ['/'], ['\\'], ['@'], [':'], [\true], [null], [1], [1.1], [[[]]], [new \Exception('foo')]]; + return [[''], ['{'], ['}'], ['('], [')'], ['/'], ['\\'], ['@'], [':'], [true], [null], [1], [1.1], [[[]]], [new Exception('foo')]]; } public function testTag() { - $item = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem(); + $item = new CacheItem(); $this->assertSame($item, $item->tag('foo')); $this->assertSame($item, $item->tag(['bar', 'baz'])); - \call_user_func(\Closure::bind(function () use($item) { + call_user_func(Closure::bind(function () use($item) { $this->assertSame(['foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz'], $item->tags); - }, $this, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::class)); + }, $this, CacheItem::class)); } /** * @dataProvider provideInvalidKey @@ -47,7 +51,7 @@ public function testInvalidTag($tag) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Cache\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('Cache tag'); - $item = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem(); + $item = new CacheItem(); $item->tag($tag); } } diff --git a/vendor/symfony/cache/Tests/DoctrineProviderTest.php b/vendor/symfony/cache/Tests/DoctrineProviderTest.php index 139449516..1362f65a0 100644 --- a/vendor/symfony/cache/Tests/DoctrineProviderTest.php +++ b/vendor/symfony/cache/Tests/DoctrineProviderTest.php @@ -14,13 +14,13 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ArrayAdapter; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\DoctrineProvider; -class DoctrineProviderTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class DoctrineProviderTest extends TestCase { public function testProvider() { - $pool = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ArrayAdapter(); - $cache = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\DoctrineProvider($pool); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Doctrine\Common\Cache\CacheProvider::class, $cache); + $pool = new ArrayAdapter(); + $cache = new DoctrineProvider($pool); + $this->assertInstanceOf(CacheProvider::class, $cache); $key = '{}()/\\@:'; $this->assertTrue($cache->delete($key)); $this->assertFalse($cache->contains($key)); diff --git a/vendor/symfony/cache/Tests/Fixtures/ArrayCache.php b/vendor/symfony/cache/Tests/Fixtures/ArrayCache.php index 788f18c41..9bfb75a8a 100644 --- a/vendor/symfony/cache/Tests/Fixtures/ArrayCache.php +++ b/vendor/symfony/cache/Tests/Fixtures/ArrayCache.php @@ -3,35 +3,37 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Fixtures; use _PhpScoper5ea00cc67502b\Doctrine\Common\Cache\CacheProvider; -class ArrayCache extends \_PhpScoper5ea00cc67502b\Doctrine\Common\Cache\CacheProvider +use function time; + +class ArrayCache extends CacheProvider { private $data = []; protected function doFetch($id) { - return $this->doContains($id) ? $this->data[$id][0] : \false; + return $this->doContains($id) ? $this->data[$id][0] : false; } protected function doContains($id) { if (!isset($this->data[$id])) { - return \false; + return false; } $expiry = $this->data[$id][1]; - return !$expiry || \time() < $expiry || !$this->doDelete($id); + return !$expiry || time() < $expiry || !$this->doDelete($id); } protected function doSave($id, $data, $lifeTime = 0) { - $this->data[$id] = [$data, $lifeTime ? \time() + $lifeTime : \false]; - return \true; + $this->data[$id] = [$data, $lifeTime ? time() + $lifeTime : false]; + return true; } protected function doDelete($id) { unset($this->data[$id]); - return \true; + return true; } protected function doFlush() { $this->data = []; - return \true; + return true; } protected function doGetStats() { diff --git a/vendor/symfony/cache/Tests/Fixtures/ExternalAdapter.php b/vendor/symfony/cache/Tests/Fixtures/ExternalAdapter.php index 9985de77f..f0abef179 100644 --- a/vendor/symfony/cache/Tests/Fixtures/ExternalAdapter.php +++ b/vendor/symfony/cache/Tests/Fixtures/ExternalAdapter.php @@ -18,12 +18,12 @@ * * @author Kévin Dunglas */ -class ExternalAdapter implements \_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemPoolInterface +class ExternalAdapter implements CacheItemPoolInterface { private $cache; public function __construct() { - $this->cache = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ArrayAdapter(); + $this->cache = new ArrayAdapter(); } public function getItem($key) { @@ -49,11 +49,11 @@ public function deleteItems(array $keys) { return $this->cache->deleteItems($keys); } - public function save(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item) + public function save(CacheItemInterface $item) { return $this->cache->save($item); } - public function saveDeferred(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item) + public function saveDeferred(CacheItemInterface $item) { return $this->cache->saveDeferred($item); } diff --git a/vendor/symfony/cache/Tests/Fixtures/index.php b/vendor/symfony/cache/Tests/Fixtures/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/cache/Tests/Fixtures/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/cache/Tests/Simple/AbstractRedisCacheTest.php b/vendor/symfony/cache/Tests/Simple/AbstractRedisCacheTest.php index 0dc78c2dc..d6cf38604 100644 --- a/vendor/symfony/cache/Tests/Simple/AbstractRedisCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/AbstractRedisCacheTest.php @@ -10,22 +10,28 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple; +use _PhpScoper5ea00cc67502b\Redis; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\RedisCache; -abstract class AbstractRedisCacheTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple\CacheTestCase +use function error_get_last; +use function extension_loaded; +use function getenv; +use function str_replace; + +abstract class AbstractRedisCacheTest extends CacheTestCase { protected $skippedTests = ['testSetTtl' => 'Testing expiration slows down the test suite', 'testSetMultipleTtl' => 'Testing expiration slows down the test suite', 'testDefaultLifeTime' => 'Testing expiration slows down the test suite']; protected static $redis; public function createSimpleCache($defaultLifetime = 0) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\RedisCache(self::$redis, \str_replace('\\', '.', __CLASS__), $defaultLifetime); + return new RedisCache(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime); } public static function setUpBeforeClass() { - if (!\extension_loaded('redis')) { + if (!extension_loaded('redis')) { self::markTestSkipped('Extension redis required.'); } - if (!@(new \_PhpScoper5ea00cc67502b\Redis())->connect(\getenv('REDIS_HOST'))) { - $e = \error_get_last(); + if (!@(new Redis())->connect(getenv('REDIS_HOST'))) { + $e = error_get_last(); self::markTestSkipped($e['message']); } } diff --git a/vendor/symfony/cache/Tests/Simple/ApcuCacheTest.php b/vendor/symfony/cache/Tests/Simple/ApcuCacheTest.php index 86a2654e4..920d3e296 100644 --- a/vendor/symfony/cache/Tests/Simple/ApcuCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/ApcuCacheTest.php @@ -11,17 +11,25 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\ApcuCache; -class ApcuCacheTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple\CacheTestCase +use function filter_var; +use function function_exists; +use function ini_get; +use function str_replace; +use const DIRECTORY_SEPARATOR; +use const FILTER_VALIDATE_BOOLEAN; +use const PHP_SAPI; + +class ApcuCacheTest extends CacheTestCase { protected $skippedTests = ['testSetTtl' => 'Testing expiration slows down the test suite', 'testSetMultipleTtl' => 'Testing expiration slows down the test suite', 'testDefaultLifeTime' => 'Testing expiration slows down the test suite']; public function createSimpleCache($defaultLifetime = 0) { - if (!\function_exists('_PhpScoper5ea00cc67502b\\apcu_fetch') || !\filter_var(\ini_get('apc.enabled'), \FILTER_VALIDATE_BOOLEAN) || 'cli' === \PHP_SAPI && !\filter_var(\ini_get('apc.enable_cli'), \FILTER_VALIDATE_BOOLEAN)) { + if (!function_exists('_PhpScoper5ea00cc67502b\\apcu_fetch') || !filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) || 'cli' === PHP_SAPI && !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) { $this->markTestSkipped('APCu extension is required.'); } - if ('\\' === \DIRECTORY_SEPARATOR) { + if ('\\' === DIRECTORY_SEPARATOR) { $this->markTestSkipped('Fails transiently on Windows.'); } - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\ApcuCache(\str_replace('\\', '.', __CLASS__), $defaultLifetime); + return new ApcuCache(str_replace('\\', '.', __CLASS__), $defaultLifetime); } } diff --git a/vendor/symfony/cache/Tests/Simple/ArrayCacheTest.php b/vendor/symfony/cache/Tests/Simple/ArrayCacheTest.php index acd91a81a..f2928f5f7 100644 --- a/vendor/symfony/cache/Tests/Simple/ArrayCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/ArrayCacheTest.php @@ -14,10 +14,10 @@ /** * @group time-sensitive */ -class ArrayCacheTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple\CacheTestCase +class ArrayCacheTest extends CacheTestCase { public function createSimpleCache($defaultLifetime = 0) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\ArrayCache($defaultLifetime); + return new ArrayCache($defaultLifetime); } } diff --git a/vendor/symfony/cache/Tests/Simple/CacheTestCase.php b/vendor/symfony/cache/Tests/Simple/CacheTestCase.php index 87e201254..4ff1808ff 100644 --- a/vendor/symfony/cache/Tests/Simple/CacheTestCase.php +++ b/vendor/symfony/cache/Tests/Simple/CacheTestCase.php @@ -13,21 +13,31 @@ use _PhpScoper5ea00cc67502b\Cache\IntegrationTests\SimpleCacheTest; use _PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface; -abstract class CacheTestCase extends \_PhpScoper5ea00cc67502b\Cache\IntegrationTests\SimpleCacheTest +use DateInterval; +use Exception; +use Serializable; +use function array_key_exists; +use function array_merge; +use function defined; +use function method_exists; +use function serialize; +use function sleep; + +abstract class CacheTestCase extends SimpleCacheTest { protected function setUp() { parent::setUp(); - if (!\array_key_exists('testPrune', $this->skippedTests) && !$this->createSimpleCache() instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface) { + if (!array_key_exists('testPrune', $this->skippedTests) && !$this->createSimpleCache() instanceof PruneableInterface) { $this->skippedTests['testPrune'] = 'Not a pruneable cache pool.'; } } public static function validKeys() { - if (\defined('HHVM_VERSION')) { + if (defined('HHVM_VERSION')) { return parent::validKeys(); } - return \array_merge(parent::validKeys(), [["a\0b"]]); + return array_merge(parent::validKeys(), [["a\0b"]]); } public function testDefaultLifeTime() { @@ -37,9 +47,9 @@ public function testDefaultLifeTime() $cache = $this->createSimpleCache(2); $cache->clear(); $cache->set('key.dlt', 'value'); - \sleep(1); + sleep(1); $this->assertSame('value', $cache->get('key.dlt')); - \sleep(2); + sleep(2); $this->assertNull($cache->get('key.dlt')); $cache->clear(); } @@ -50,9 +60,9 @@ public function testNotUnserializable() } $cache = $this->createSimpleCache(); $cache->clear(); - $cache->set('foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple\NotUnserializable()); + $cache->set('foo', new NotUnserializable()); $this->assertNull($cache->get('foo')); - $cache->setMultiple(['foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple\NotUnserializable()]); + $cache->setMultiple(['foo' => new NotUnserializable()]); foreach ($cache->getMultiple(['foo']) as $value) { } $this->assertNull($value); @@ -63,57 +73,57 @@ public function testPrune() if (isset($this->skippedTests[__FUNCTION__])) { $this->markTestSkipped($this->skippedTests[__FUNCTION__]); } - if (!\method_exists($this, 'isPruned')) { + if (!method_exists($this, 'isPruned')) { $this->fail('Test classes for pruneable caches must implement `isPruned($cache, $name)` method.'); } /** @var PruneableInterface|CacheInterface $cache */ $cache = $this->createSimpleCache(); $cache->clear(); - $cache->set('foo', 'foo-val', new \DateInterval('PT05S')); - $cache->set('bar', 'bar-val', new \DateInterval('PT10S')); - $cache->set('baz', 'baz-val', new \DateInterval('PT15S')); - $cache->set('qux', 'qux-val', new \DateInterval('PT20S')); - \sleep(30); + $cache->set('foo', 'foo-val', new DateInterval('PT05S')); + $cache->set('bar', 'bar-val', new DateInterval('PT10S')); + $cache->set('baz', 'baz-val', new DateInterval('PT15S')); + $cache->set('qux', 'qux-val', new DateInterval('PT20S')); + sleep(30); $cache->prune(); $this->assertTrue($this->isPruned($cache, 'foo')); $this->assertTrue($this->isPruned($cache, 'bar')); $this->assertTrue($this->isPruned($cache, 'baz')); $this->assertTrue($this->isPruned($cache, 'qux')); $cache->set('foo', 'foo-val'); - $cache->set('bar', 'bar-val', new \DateInterval('PT20S')); - $cache->set('baz', 'baz-val', new \DateInterval('PT40S')); - $cache->set('qux', 'qux-val', new \DateInterval('PT80S')); + $cache->set('bar', 'bar-val', new DateInterval('PT20S')); + $cache->set('baz', 'baz-val', new DateInterval('PT40S')); + $cache->set('qux', 'qux-val', new DateInterval('PT80S')); $cache->prune(); $this->assertFalse($this->isPruned($cache, 'foo')); $this->assertFalse($this->isPruned($cache, 'bar')); $this->assertFalse($this->isPruned($cache, 'baz')); $this->assertFalse($this->isPruned($cache, 'qux')); - \sleep(30); + sleep(30); $cache->prune(); $this->assertFalse($this->isPruned($cache, 'foo')); $this->assertTrue($this->isPruned($cache, 'bar')); $this->assertFalse($this->isPruned($cache, 'baz')); $this->assertFalse($this->isPruned($cache, 'qux')); - \sleep(30); + sleep(30); $cache->prune(); $this->assertFalse($this->isPruned($cache, 'foo')); $this->assertTrue($this->isPruned($cache, 'baz')); $this->assertFalse($this->isPruned($cache, 'qux')); - \sleep(30); + sleep(30); $cache->prune(); $this->assertFalse($this->isPruned($cache, 'foo')); $this->assertTrue($this->isPruned($cache, 'qux')); $cache->clear(); } } -class NotUnserializable implements \Serializable +class NotUnserializable implements Serializable { public function serialize() { - return \serialize(123); + return serialize(123); } public function unserialize($ser) { - throw new \Exception(__CLASS__); + throw new Exception(__CLASS__); } } diff --git a/vendor/symfony/cache/Tests/Simple/ChainCacheTest.php b/vendor/symfony/cache/Tests/Simple/ChainCacheTest.php index 701cc29ee..9846f55e4 100644 --- a/vendor/symfony/cache/Tests/Simple/ChainCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/ChainCacheTest.php @@ -16,35 +16,37 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\ArrayCache; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\ChainCache; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\FilesystemCache; +use stdClass; + /** * @group time-sensitive */ -class ChainCacheTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple\CacheTestCase +class ChainCacheTest extends CacheTestCase { public function createSimpleCache($defaultLifetime = 0) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\ChainCache([new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\ArrayCache($defaultLifetime), new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\FilesystemCache('', $defaultLifetime)], $defaultLifetime); + return new ChainCache([new ArrayCache($defaultLifetime), new FilesystemCache('', $defaultLifetime)], $defaultLifetime); } public function testEmptyCachesException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Cache\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('At least one cache must be specified.'); - new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\ChainCache([]); + new ChainCache([]); } public function testInvalidCacheException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Cache\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('The class "stdClass" does not implement'); - new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\ChainCache([new \stdClass()]); + new ChainCache([new stdClass()]); } public function testPrune() { if (isset($this->skippedTests[__FUNCTION__])) { $this->markTestSkipped($this->skippedTests[__FUNCTION__]); } - $cache = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\ChainCache([$this->getPruneableMock(), $this->getNonPruneableMock(), $this->getPruneableMock()]); + $cache = new ChainCache([$this->getPruneableMock(), $this->getNonPruneableMock(), $this->getPruneableMock()]); $this->assertTrue($cache->prune()); - $cache = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\ChainCache([$this->getPruneableMock(), $this->getFailingPruneableMock(), $this->getPruneableMock()]); + $cache = new ChainCache([$this->getPruneableMock(), $this->getFailingPruneableMock(), $this->getPruneableMock()]); $this->assertFalse($cache->prune()); } /** @@ -52,8 +54,8 @@ public function testPrune() */ private function getPruneableMock() { - $pruneable = $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple\PruneableCacheInterface::class)->getMock(); - $pruneable->expects($this->atLeastOnce())->method('prune')->willReturn(\true); + $pruneable = $this->getMockBuilder(PruneableCacheInterface::class)->getMock(); + $pruneable->expects($this->atLeastOnce())->method('prune')->willReturn(true); return $pruneable; } /** @@ -61,8 +63,8 @@ private function getPruneableMock() */ private function getFailingPruneableMock() { - $pruneable = $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple\PruneableCacheInterface::class)->getMock(); - $pruneable->expects($this->atLeastOnce())->method('prune')->willReturn(\false); + $pruneable = $this->getMockBuilder(PruneableCacheInterface::class)->getMock(); + $pruneable->expects($this->atLeastOnce())->method('prune')->willReturn(false); return $pruneable; } /** @@ -70,9 +72,9 @@ private function getFailingPruneableMock() */ private function getNonPruneableMock() { - return $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheInterface::class)->getMock(); + return $this->getMockBuilder(CacheInterface::class)->getMock(); } } -interface PruneableCacheInterface extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface, \_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheInterface +interface PruneableCacheInterface extends PruneableInterface, CacheInterface { } diff --git a/vendor/symfony/cache/Tests/Simple/DoctrineCacheTest.php b/vendor/symfony/cache/Tests/Simple/DoctrineCacheTest.php index 515c84ec7..73ddc171b 100644 --- a/vendor/symfony/cache/Tests/Simple/DoctrineCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/DoctrineCacheTest.php @@ -15,11 +15,11 @@ /** * @group time-sensitive */ -class DoctrineCacheTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple\CacheTestCase +class DoctrineCacheTest extends CacheTestCase { protected $skippedTests = ['testObjectDoesNotChangeInCache' => 'ArrayCache does not use serialize/unserialize', 'testNotUnserializable' => 'ArrayCache does not use serialize/unserialize']; public function createSimpleCache($defaultLifetime = 0) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\DoctrineCache(new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Fixtures\ArrayCache($defaultLifetime), '', $defaultLifetime); + return new DoctrineCache(new ArrayCache($defaultLifetime), '', $defaultLifetime); } } diff --git a/vendor/symfony/cache/Tests/Simple/FilesystemCacheTest.php b/vendor/symfony/cache/Tests/Simple/FilesystemCacheTest.php index 7eb4d3c4d..cdbc09bf0 100644 --- a/vendor/symfony/cache/Tests/Simple/FilesystemCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/FilesystemCacheTest.php @@ -12,19 +12,22 @@ use _PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\FilesystemCache; +use ReflectionObject; +use function file_exists; + /** * @group time-sensitive */ -class FilesystemCacheTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple\CacheTestCase +class FilesystemCacheTest extends CacheTestCase { public function createSimpleCache($defaultLifetime = 0) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\FilesystemCache('', $defaultLifetime); + return new FilesystemCache('', $defaultLifetime); } - protected function isPruned(\_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheInterface $cache, $name) + protected function isPruned(CacheInterface $cache, $name) { - $getFileMethod = (new \ReflectionObject($cache))->getMethod('getFile'); - $getFileMethod->setAccessible(\true); - return !\file_exists($getFileMethod->invoke($cache, $name)); + $getFileMethod = (new ReflectionObject($cache))->getMethod('getFile'); + $getFileMethod->setAccessible(true); + return !file_exists($getFileMethod->invoke($cache, $name)); } } diff --git a/vendor/symfony/cache/Tests/Simple/MemcachedCacheTest.php b/vendor/symfony/cache/Tests/Simple/MemcachedCacheTest.php index f72bd7a6d..418643246 100644 --- a/vendor/symfony/cache/Tests/Simple/MemcachedCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/MemcachedCacheTest.php @@ -10,44 +10,53 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple; +use _PhpScoper5ea00cc67502b\Memcached; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AbstractAdapter; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\MemcachedCache; -class MemcachedCacheTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple\CacheTestCase +use function array_map; +use function filter_var; +use function getenv; +use function ini_get; +use function str_replace; +use function strtolower; +use const FILTER_VALIDATE_BOOLEAN; + +class MemcachedCacheTest extends CacheTestCase { protected $skippedTests = ['testSetTtl' => 'Testing expiration slows down the test suite', 'testSetMultipleTtl' => 'Testing expiration slows down the test suite', 'testDefaultLifeTime' => 'Testing expiration slows down the test suite']; protected static $client; public static function setUpBeforeClass() { - if (!\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\MemcachedCache::isSupported()) { + if (!MemcachedCache::isSupported()) { self::markTestSkipped('Extension memcached >=2.2.0 required.'); } - self::$client = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AbstractAdapter::createConnection('memcached://' . \getenv('MEMCACHED_HOST')); + self::$client = AbstractAdapter::createConnection('memcached://' . getenv('MEMCACHED_HOST')); self::$client->get('foo'); $code = self::$client->getResultCode(); - if (\_PhpScoper5ea00cc67502b\Memcached::RES_SUCCESS !== $code && \_PhpScoper5ea00cc67502b\Memcached::RES_NOTFOUND !== $code) { - self::markTestSkipped('Memcached error: ' . \strtolower(self::$client->getResultMessage())); + if (Memcached::RES_SUCCESS !== $code && Memcached::RES_NOTFOUND !== $code) { + self::markTestSkipped('Memcached error: ' . strtolower(self::$client->getResultMessage())); } } public function createSimpleCache($defaultLifetime = 0) { - $client = $defaultLifetime ? \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AbstractAdapter::createConnection('memcached://' . \getenv('MEMCACHED_HOST'), ['binary_protocol' => \false]) : self::$client; - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\MemcachedCache($client, \str_replace('\\', '.', __CLASS__), $defaultLifetime); + $client = $defaultLifetime ? AbstractAdapter::createConnection('memcached://' . getenv('MEMCACHED_HOST'), ['binary_protocol' => false]) : self::$client; + return new MemcachedCache($client, str_replace('\\', '.', __CLASS__), $defaultLifetime); } public function testCreatePersistentConnectionShouldNotDupServerList() { - $instance = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\MemcachedCache::createConnection('memcached://' . \getenv('MEMCACHED_HOST'), ['persistent_id' => 'persistent']); + $instance = MemcachedCache::createConnection('memcached://' . getenv('MEMCACHED_HOST'), ['persistent_id' => 'persistent']); $this->assertCount(1, $instance->getServerList()); - $instance = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\MemcachedCache::createConnection('memcached://' . \getenv('MEMCACHED_HOST'), ['persistent_id' => 'persistent']); + $instance = MemcachedCache::createConnection('memcached://' . getenv('MEMCACHED_HOST'), ['persistent_id' => 'persistent']); $this->assertCount(1, $instance->getServerList()); } public function testOptions() { - $client = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\MemcachedCache::createConnection([], ['libketama_compatible' => \false, 'distribution' => 'modula', 'compression' => \true, 'serializer' => 'php', 'hash' => 'md5']); - $this->assertSame(\_PhpScoper5ea00cc67502b\Memcached::SERIALIZER_PHP, $client->getOption(\_PhpScoper5ea00cc67502b\Memcached::OPT_SERIALIZER)); - $this->assertSame(\_PhpScoper5ea00cc67502b\Memcached::HASH_MD5, $client->getOption(\_PhpScoper5ea00cc67502b\Memcached::OPT_HASH)); - $this->assertTrue($client->getOption(\_PhpScoper5ea00cc67502b\Memcached::OPT_COMPRESSION)); - $this->assertSame(0, $client->getOption(\_PhpScoper5ea00cc67502b\Memcached::OPT_LIBKETAMA_COMPATIBLE)); - $this->assertSame(\_PhpScoper5ea00cc67502b\Memcached::DISTRIBUTION_MODULA, $client->getOption(\_PhpScoper5ea00cc67502b\Memcached::OPT_DISTRIBUTION)); + $client = MemcachedCache::createConnection([], ['libketama_compatible' => false, 'distribution' => 'modula', 'compression' => true, 'serializer' => 'php', 'hash' => 'md5']); + $this->assertSame(Memcached::SERIALIZER_PHP, $client->getOption(Memcached::OPT_SERIALIZER)); + $this->assertSame(Memcached::HASH_MD5, $client->getOption(Memcached::OPT_HASH)); + $this->assertTrue($client->getOption(Memcached::OPT_COMPRESSION)); + $this->assertSame(0, $client->getOption(Memcached::OPT_LIBKETAMA_COMPATIBLE)); + $this->assertSame(Memcached::DISTRIBUTION_MODULA, $client->getOption(Memcached::OPT_DISTRIBUTION)); } /** * @dataProvider provideBadOptions @@ -56,7 +65,7 @@ public function testBadOptions($name, $value) { $this->expectException('ErrorException'); $this->expectExceptionMessage('constant(): Couldn\'t find constant Memcached::'); - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\MemcachedCache::createConnection([], [$name => $value]); + MemcachedCache::createConnection([], [$name => $value]); } public function provideBadOptions() { @@ -64,47 +73,47 @@ public function provideBadOptions() } public function testDefaultOptions() { - $this->assertTrue(\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\MemcachedCache::isSupported()); - $client = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\MemcachedCache::createConnection([]); - $this->assertTrue($client->getOption(\_PhpScoper5ea00cc67502b\Memcached::OPT_COMPRESSION)); - $this->assertSame(1, $client->getOption(\_PhpScoper5ea00cc67502b\Memcached::OPT_BINARY_PROTOCOL)); - $this->assertSame(1, $client->getOption(\_PhpScoper5ea00cc67502b\Memcached::OPT_LIBKETAMA_COMPATIBLE)); + $this->assertTrue(MemcachedCache::isSupported()); + $client = MemcachedCache::createConnection([]); + $this->assertTrue($client->getOption(Memcached::OPT_COMPRESSION)); + $this->assertSame(1, $client->getOption(Memcached::OPT_BINARY_PROTOCOL)); + $this->assertSame(1, $client->getOption(Memcached::OPT_LIBKETAMA_COMPATIBLE)); } public function testOptionSerializer() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Cache\\Exception\\CacheException'); $this->expectExceptionMessage('MemcachedAdapter: "serializer" option must be "php" or "igbinary".'); - if (!\_PhpScoper5ea00cc67502b\Memcached::HAVE_JSON) { + if (!Memcached::HAVE_JSON) { $this->markTestSkipped('Memcached::HAVE_JSON required'); } - new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\MemcachedCache(\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\MemcachedCache::createConnection([], ['serializer' => 'json'])); + new MemcachedCache(MemcachedCache::createConnection([], ['serializer' => 'json'])); } /** * @dataProvider provideServersSetting */ public function testServersSetting($dsn, $host, $port) { - $client1 = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\MemcachedCache::createConnection($dsn); - $client2 = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\MemcachedCache::createConnection([$dsn]); - $client3 = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\MemcachedCache::createConnection([[$host, $port]]); + $client1 = MemcachedCache::createConnection($dsn); + $client2 = MemcachedCache::createConnection([$dsn]); + $client3 = MemcachedCache::createConnection([[$host, $port]]); $expect = ['host' => $host, 'port' => $port]; $f = function ($s) { return ['host' => $s['host'], 'port' => $s['port']]; }; - $this->assertSame([$expect], \array_map($f, $client1->getServerList())); - $this->assertSame([$expect], \array_map($f, $client2->getServerList())); - $this->assertSame([$expect], \array_map($f, $client3->getServerList())); + $this->assertSame([$expect], array_map($f, $client1->getServerList())); + $this->assertSame([$expect], array_map($f, $client2->getServerList())); + $this->assertSame([$expect], array_map($f, $client3->getServerList())); } public function provideServersSetting() { (yield ['memcached://127.0.0.1/50', '127.0.0.1', 11211]); (yield ['memcached://localhost:11222?weight=25', 'localhost', 11222]); - if (\filter_var(\ini_get('memcached.use_sasl'), \FILTER_VALIDATE_BOOLEAN)) { + if (filter_var(ini_get('memcached.use_sasl'), FILTER_VALIDATE_BOOLEAN)) { (yield ['memcached://user:password@127.0.0.1?weight=50', '127.0.0.1', 11211]); } (yield ['memcached:///var/run/memcached.sock?weight=25', '/var/run/memcached.sock', 0]); (yield ['memcached:///var/local/run/memcached.socket?weight=25', '/var/local/run/memcached.socket', 0]); - if (\filter_var(\ini_get('memcached.use_sasl'), \FILTER_VALIDATE_BOOLEAN)) { + if (filter_var(ini_get('memcached.use_sasl'), FILTER_VALIDATE_BOOLEAN)) { (yield ['memcached://user:password@/var/local/run/memcached.socket?weight=25', '/var/local/run/memcached.socket', 0]); } } diff --git a/vendor/symfony/cache/Tests/Simple/MemcachedCacheTextModeTest.php b/vendor/symfony/cache/Tests/Simple/MemcachedCacheTextModeTest.php index 3305e4e32..97cdbfa90 100644 --- a/vendor/symfony/cache/Tests/Simple/MemcachedCacheTextModeTest.php +++ b/vendor/symfony/cache/Tests/Simple/MemcachedCacheTextModeTest.php @@ -12,11 +12,14 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AbstractAdapter; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\MemcachedCache; -class MemcachedCacheTextModeTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple\MemcachedCacheTest +use function getenv; +use function str_replace; + +class MemcachedCacheTextModeTest extends MemcachedCacheTest { public function createSimpleCache($defaultLifetime = 0) { - $client = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\AbstractAdapter::createConnection('memcached://' . \getenv('MEMCACHED_HOST'), ['binary_protocol' => \false]); - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\MemcachedCache($client, \str_replace('\\', '.', __CLASS__), $defaultLifetime); + $client = AbstractAdapter::createConnection('memcached://' . getenv('MEMCACHED_HOST'), ['binary_protocol' => false]); + return new MemcachedCache($client, str_replace('\\', '.', __CLASS__), $defaultLifetime); } } diff --git a/vendor/symfony/cache/Tests/Simple/NullCacheTest.php b/vendor/symfony/cache/Tests/Simple/NullCacheTest.php index 22365de83..2eca07483 100644 --- a/vendor/symfony/cache/Tests/Simple/NullCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/NullCacheTest.php @@ -12,14 +12,16 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\NullCache; +use stdClass; + /** * @group time-sensitive */ -class NullCacheTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class NullCacheTest extends TestCase { public function createCachePool() { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\NullCache(); + return new NullCache(); } public function testGetItem() { @@ -34,7 +36,7 @@ public function testGetMultiple() { $cache = $this->createCachePool(); $keys = ['foo', 'bar', 'baz', 'biz']; - $default = new \stdClass(); + $default = new stdClass(); $items = $cache->getMultiple($keys, $default); $count = 0; foreach ($items as $key => $item) { diff --git a/vendor/symfony/cache/Tests/Simple/PdoCacheTest.php b/vendor/symfony/cache/Tests/Simple/PdoCacheTest.php index 1bebfd10c..36c1dd7ea 100644 --- a/vendor/symfony/cache/Tests/Simple/PdoCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/PdoCacheTest.php @@ -12,28 +12,33 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\PdoCache; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Traits\PdoPruneableTrait; +use function extension_loaded; +use function sys_get_temp_dir; +use function tempnam; +use function unlink; + /** * @group time-sensitive */ -class PdoCacheTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple\CacheTestCase +class PdoCacheTest extends CacheTestCase { use PdoPruneableTrait; protected static $dbFile; public static function setUpBeforeClass() { - if (!\extension_loaded('pdo_sqlite')) { + if (!extension_loaded('pdo_sqlite')) { self::markTestSkipped('Extension pdo_sqlite required.'); } - self::$dbFile = \tempnam(\sys_get_temp_dir(), 'sf_sqlite_cache'); - $pool = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\PdoCache('sqlite:' . self::$dbFile); + self::$dbFile = tempnam(sys_get_temp_dir(), 'sf_sqlite_cache'); + $pool = new PdoCache('sqlite:' . self::$dbFile); $pool->createTable(); } public static function tearDownAfterClass() { - @\unlink(self::$dbFile); + @unlink(self::$dbFile); } public function createSimpleCache($defaultLifetime = 0) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\PdoCache('sqlite:' . self::$dbFile, 'ns', $defaultLifetime); + return new PdoCache('sqlite:' . self::$dbFile, 'ns', $defaultLifetime); } } diff --git a/vendor/symfony/cache/Tests/Simple/PdoDbalCacheTest.php b/vendor/symfony/cache/Tests/Simple/PdoDbalCacheTest.php index b80bb6d4b..816aa397e 100644 --- a/vendor/symfony/cache/Tests/Simple/PdoDbalCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/PdoDbalCacheTest.php @@ -13,28 +13,33 @@ use _PhpScoper5ea00cc67502b\Doctrine\DBAL\DriverManager; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\PdoCache; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Traits\PdoPruneableTrait; +use function extension_loaded; +use function sys_get_temp_dir; +use function tempnam; +use function unlink; + /** * @group time-sensitive */ -class PdoDbalCacheTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple\CacheTestCase +class PdoDbalCacheTest extends CacheTestCase { use PdoPruneableTrait; protected static $dbFile; public static function setUpBeforeClass() { - if (!\extension_loaded('pdo_sqlite')) { + if (!extension_loaded('pdo_sqlite')) { self::markTestSkipped('Extension pdo_sqlite required.'); } - self::$dbFile = \tempnam(\sys_get_temp_dir(), 'sf_sqlite_cache'); - $pool = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\PdoCache(\_PhpScoper5ea00cc67502b\Doctrine\DBAL\DriverManager::getConnection(['driver' => 'pdo_sqlite', 'path' => self::$dbFile])); + self::$dbFile = tempnam(sys_get_temp_dir(), 'sf_sqlite_cache'); + $pool = new PdoCache(DriverManager::getConnection(['driver' => 'pdo_sqlite', 'path' => self::$dbFile])); $pool->createTable(); } public static function tearDownAfterClass() { - @\unlink(self::$dbFile); + @unlink(self::$dbFile); } public function createSimpleCache($defaultLifetime = 0) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\PdoCache(\_PhpScoper5ea00cc67502b\Doctrine\DBAL\DriverManager::getConnection(['driver' => 'pdo_sqlite', 'path' => self::$dbFile]), '', $defaultLifetime); + return new PdoCache(DriverManager::getConnection(['driver' => 'pdo_sqlite', 'path' => self::$dbFile]), '', $defaultLifetime); } } diff --git a/vendor/symfony/cache/Tests/Simple/PhpArrayCacheTest.php b/vendor/symfony/cache/Tests/Simple/PhpArrayCacheTest.php index 4cecea6d5..c3bf0f283 100644 --- a/vendor/symfony/cache/Tests/Simple/PhpArrayCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/PhpArrayCacheTest.php @@ -13,27 +13,37 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\NullCache; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\PhpArrayCache; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\FilesystemAdapterTest; +use Closure; +use Traversable; +use function call_user_func; +use function file_exists; +use function file_get_contents; +use function is_array; +use function serialize; +use function substr; +use function sys_get_temp_dir; + /** * @group time-sensitive */ -class PhpArrayCacheTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple\CacheTestCase +class PhpArrayCacheTest extends CacheTestCase { protected $skippedTests = ['testBasicUsageWithLongKey' => 'PhpArrayCache does no writes', 'testDelete' => 'PhpArrayCache does no writes', 'testDeleteMultiple' => 'PhpArrayCache does no writes', 'testDeleteMultipleGenerator' => 'PhpArrayCache does no writes', 'testSetTtl' => 'PhpArrayCache does no expiration', 'testSetMultipleTtl' => 'PhpArrayCache does no expiration', 'testSetExpiredTtl' => 'PhpArrayCache does no expiration', 'testSetMultipleExpiredTtl' => 'PhpArrayCache does no expiration', 'testGetInvalidKeys' => 'PhpArrayCache does no validation', 'testGetMultipleInvalidKeys' => 'PhpArrayCache does no validation', 'testSetInvalidKeys' => 'PhpArrayCache does no validation', 'testDeleteInvalidKeys' => 'PhpArrayCache does no validation', 'testDeleteMultipleInvalidKeys' => 'PhpArrayCache does no validation', 'testSetInvalidTtl' => 'PhpArrayCache does no validation', 'testSetMultipleInvalidKeys' => 'PhpArrayCache does no validation', 'testSetMultipleInvalidTtl' => 'PhpArrayCache does no validation', 'testHasInvalidKeys' => 'PhpArrayCache does no validation', 'testSetValidData' => 'PhpArrayCache does no validation', 'testDefaultLifeTime' => 'PhpArrayCache does not allow configuring a default lifetime.', 'testPrune' => 'PhpArrayCache just proxies']; protected static $file; public static function setUpBeforeClass() { - self::$file = \sys_get_temp_dir() . '/symfony-cache/php-array-adapter-test.php'; + self::$file = sys_get_temp_dir() . '/symfony-cache/php-array-adapter-test.php'; } protected function tearDown() { $this->createSimpleCache()->clear(); - if (\file_exists(\sys_get_temp_dir() . '/symfony-cache')) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\FilesystemAdapterTest::rmdir(\sys_get_temp_dir() . '/symfony-cache'); + if (file_exists(sys_get_temp_dir() . '/symfony-cache')) { + FilesystemAdapterTest::rmdir(sys_get_temp_dir() . '/symfony-cache'); } } public function createSimpleCache() { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple\PhpArrayCacheWrapper(self::$file, new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\NullCache()); + return new PhpArrayCacheWrapper(self::$file, new NullCache()); } public function testStore() { @@ -41,45 +51,45 @@ public function testStore() $arrayWithRefs[0] = 123; $arrayWithRefs[1] =& $arrayWithRefs[0]; $object = (object) ['foo' => 'bar', 'foo2' => 'bar2']; - $expected = ['null' => null, 'serializedString' => \serialize($object), 'arrayWithRefs' => $arrayWithRefs, 'object' => $object, 'arrayWithObject' => ['bar' => $object]]; - $cache = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\PhpArrayCache(self::$file, new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\NullCache()); + $expected = ['null' => null, 'serializedString' => serialize($object), 'arrayWithRefs' => $arrayWithRefs, 'object' => $object, 'arrayWithObject' => ['bar' => $object]]; + $cache = new PhpArrayCache(self::$file, new NullCache()); $cache->warmUp($expected); foreach ($expected as $key => $value) { - $this->assertSame(\serialize($value), \serialize($cache->get($key)), 'Warm up should create a PHP file that OPCache can load in memory'); + $this->assertSame(serialize($value), serialize($cache->get($key)), 'Warm up should create a PHP file that OPCache can load in memory'); } } public function testStoredFile() { - $expected = ['integer' => 42, 'float' => 42.42, 'boolean' => \true, 'array_simple' => ['foo', 'bar'], 'array_associative' => ['foo' => 'bar', 'foo2' => 'bar2']]; - $cache = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\PhpArrayCache(self::$file, new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\NullCache()); + $expected = ['integer' => 42, 'float' => 42.42, 'boolean' => true, 'array_simple' => ['foo', 'bar'], 'array_associative' => ['foo' => 'bar', 'foo2' => 'bar2']]; + $cache = new PhpArrayCache(self::$file, new NullCache()); $cache->warmUp($expected); - $values = eval(\substr(\file_get_contents(self::$file), 6)); + $values = eval(substr(file_get_contents(self::$file), 6)); $this->assertSame($expected, $values, 'Warm up should create a PHP file that OPCache can load in memory'); } } -class PhpArrayCacheWrapper extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\PhpArrayCache +class PhpArrayCacheWrapper extends PhpArrayCache { public function set($key, $value, $ttl = null) { - \call_user_func(\Closure::bind(function () use($key, $value) { + call_user_func(Closure::bind(function () use($key, $value) { $this->values[$key] = $value; $this->warmUp($this->values); - $this->values = eval(\substr(\file_get_contents($this->file), 6)); - }, $this, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\PhpArrayCache::class)); - return \true; + $this->values = eval(substr(file_get_contents($this->file), 6)); + }, $this, PhpArrayCache::class)); + return true; } public function setMultiple($values, $ttl = null) { - if (!\is_array($values) && !$values instanceof \Traversable) { + if (!is_array($values) && !$values instanceof Traversable) { return parent::setMultiple($values, $ttl); } - \call_user_func(\Closure::bind(function () use($values) { + call_user_func(Closure::bind(function () use($values) { foreach ($values as $key => $value) { $this->values[$key] = $value; } $this->warmUp($this->values); - $this->values = eval(\substr(\file_get_contents($this->file), 6)); - }, $this, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\PhpArrayCache::class)); - return \true; + $this->values = eval(substr(file_get_contents($this->file), 6)); + }, $this, PhpArrayCache::class)); + return true; } } diff --git a/vendor/symfony/cache/Tests/Simple/PhpArrayCacheWithFallbackTest.php b/vendor/symfony/cache/Tests/Simple/PhpArrayCacheWithFallbackTest.php index 487c6b9b4..6e4326f99 100644 --- a/vendor/symfony/cache/Tests/Simple/PhpArrayCacheWithFallbackTest.php +++ b/vendor/symfony/cache/Tests/Simple/PhpArrayCacheWithFallbackTest.php @@ -13,10 +13,13 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\FilesystemCache; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\PhpArrayCache; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\FilesystemAdapterTest; +use function file_exists; +use function sys_get_temp_dir; + /** * @group time-sensitive */ -class PhpArrayCacheWithFallbackTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple\CacheTestCase +class PhpArrayCacheWithFallbackTest extends CacheTestCase { protected $skippedTests = [ 'testGetInvalidKeys' => 'PhpArrayCache does no validation', @@ -34,17 +37,17 @@ class PhpArrayCacheWithFallbackTest extends \_PhpScoper5ea00cc67502b\Symfony\Com protected static $file; public static function setUpBeforeClass() { - self::$file = \sys_get_temp_dir() . '/symfony-cache/php-array-adapter-test.php'; + self::$file = sys_get_temp_dir() . '/symfony-cache/php-array-adapter-test.php'; } protected function tearDown() { $this->createSimpleCache()->clear(); - if (\file_exists(\sys_get_temp_dir() . '/symfony-cache')) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Adapter\FilesystemAdapterTest::rmdir(\sys_get_temp_dir() . '/symfony-cache'); + if (file_exists(sys_get_temp_dir() . '/symfony-cache')) { + FilesystemAdapterTest::rmdir(sys_get_temp_dir() . '/symfony-cache'); } } public function createSimpleCache($defaultLifetime = 0) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\PhpArrayCache(self::$file, new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\FilesystemCache('php-array-fallback', $defaultLifetime)); + return new PhpArrayCache(self::$file, new FilesystemCache('php-array-fallback', $defaultLifetime)); } } diff --git a/vendor/symfony/cache/Tests/Simple/PhpFilesCacheTest.php b/vendor/symfony/cache/Tests/Simple/PhpFilesCacheTest.php index 5d5ca4afd..015c9981c 100644 --- a/vendor/symfony/cache/Tests/Simple/PhpFilesCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/PhpFilesCacheTest.php @@ -12,23 +12,26 @@ use _PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\PhpFilesCache; +use ReflectionObject; +use function file_exists; + /** * @group time-sensitive */ -class PhpFilesCacheTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple\CacheTestCase +class PhpFilesCacheTest extends CacheTestCase { protected $skippedTests = ['testDefaultLifeTime' => 'PhpFilesCache does not allow configuring a default lifetime.']; public function createSimpleCache() { - if (!\_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\PhpFilesCache::isSupported()) { + if (!PhpFilesCache::isSupported()) { $this->markTestSkipped('OPcache extension is not enabled.'); } - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\PhpFilesCache('sf-cache'); + return new PhpFilesCache('sf-cache'); } - protected function isPruned(\_PhpScoper5ea00cc67502b\Psr\SimpleCache\CacheInterface $cache, $name) + protected function isPruned(CacheInterface $cache, $name) { - $getFileMethod = (new \ReflectionObject($cache))->getMethod('getFile'); - $getFileMethod->setAccessible(\true); - return !\file_exists($getFileMethod->invoke($cache, $name)); + $getFileMethod = (new ReflectionObject($cache))->getMethod('getFile'); + $getFileMethod->setAccessible(true); + return !file_exists($getFileMethod->invoke($cache, $name)); } } diff --git a/vendor/symfony/cache/Tests/Simple/Psr6CacheTest.php b/vendor/symfony/cache/Tests/Simple/Psr6CacheTest.php index 981331201..5b9f3986b 100644 --- a/vendor/symfony/cache/Tests/Simple/Psr6CacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/Psr6CacheTest.php @@ -15,11 +15,11 @@ /** * @group time-sensitive */ -class Psr6CacheTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple\CacheTestCase +class Psr6CacheTest extends CacheTestCase { protected $skippedTests = ['testPrune' => 'Psr6Cache just proxies']; public function createSimpleCache($defaultLifetime = 0) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\Psr6Cache(new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\FilesystemAdapter('', $defaultLifetime)); + return new Psr6Cache(new FilesystemAdapter('', $defaultLifetime)); } } diff --git a/vendor/symfony/cache/Tests/Simple/RedisArrayCacheTest.php b/vendor/symfony/cache/Tests/Simple/RedisArrayCacheTest.php index e77b592a9..905256ec2 100644 --- a/vendor/symfony/cache/Tests/Simple/RedisArrayCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/RedisArrayCacheTest.php @@ -10,14 +10,18 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple; -class RedisArrayCacheTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple\AbstractRedisCacheTest +use _PhpScoper5ea00cc67502b\RedisArray; +use function class_exists; +use function getenv; + +class RedisArrayCacheTest extends AbstractRedisCacheTest { public static function setUpBeforeClass() { parent::setupBeforeClass(); - if (!\class_exists('_PhpScoper5ea00cc67502b\\RedisArray')) { + if (!class_exists('_PhpScoper5ea00cc67502b\\RedisArray')) { self::markTestSkipped('The RedisArray class is required.'); } - self::$redis = new \_PhpScoper5ea00cc67502b\RedisArray([\getenv('REDIS_HOST')], ['lazy_connect' => \true]); + self::$redis = new RedisArray([getenv('REDIS_HOST')], ['lazy_connect' => true]); } } diff --git a/vendor/symfony/cache/Tests/Simple/RedisCacheTest.php b/vendor/symfony/cache/Tests/Simple/RedisCacheTest.php index bdb18d0d3..c42a06971 100644 --- a/vendor/symfony/cache/Tests/Simple/RedisCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/RedisCacheTest.php @@ -10,28 +10,31 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple; +use _PhpScoper5ea00cc67502b\Redis; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\RedisCache; -class RedisCacheTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple\AbstractRedisCacheTest +use function getenv; + +class RedisCacheTest extends AbstractRedisCacheTest { public static function setUpBeforeClass() { parent::setupBeforeClass(); - self::$redis = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\RedisCache::createConnection('redis://' . \getenv('REDIS_HOST')); + self::$redis = RedisCache::createConnection('redis://' . getenv('REDIS_HOST')); } public function testCreateConnection() { - $redisHost = \getenv('REDIS_HOST'); - $redis = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\RedisCache::createConnection('redis://' . $redisHost); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Redis::class, $redis); + $redisHost = getenv('REDIS_HOST'); + $redis = RedisCache::createConnection('redis://' . $redisHost); + $this->assertInstanceOf(Redis::class, $redis); $this->assertTrue($redis->isConnected()); $this->assertSame(0, $redis->getDbNum()); - $redis = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\RedisCache::createConnection('redis://' . $redisHost . '/2'); + $redis = RedisCache::createConnection('redis://' . $redisHost . '/2'); $this->assertSame(2, $redis->getDbNum()); - $redis = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\RedisCache::createConnection('redis://' . $redisHost, ['timeout' => 3]); + $redis = RedisCache::createConnection('redis://' . $redisHost, ['timeout' => 3]); $this->assertEquals(3, $redis->getTimeout()); - $redis = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\RedisCache::createConnection('redis://' . $redisHost . '?timeout=4'); + $redis = RedisCache::createConnection('redis://' . $redisHost . '?timeout=4'); $this->assertEquals(4, $redis->getTimeout()); - $redis = \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\RedisCache::createConnection('redis://' . $redisHost, ['read_timeout' => 5]); + $redis = RedisCache::createConnection('redis://' . $redisHost, ['read_timeout' => 5]); $this->assertEquals(5, $redis->getReadTimeout()); } /** @@ -41,7 +44,7 @@ public function testFailedCreateConnection($dsn) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Cache\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('Redis connection failed'); - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\RedisCache::createConnection($dsn); + RedisCache::createConnection($dsn); } public function provideFailedCreateConnection() { @@ -54,7 +57,7 @@ public function testInvalidCreateConnection($dsn) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Cache\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('Invalid Redis DSN'); - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\RedisCache::createConnection($dsn); + RedisCache::createConnection($dsn); } public function provideInvalidCreateConnection() { diff --git a/vendor/symfony/cache/Tests/Simple/RedisClusterCacheTest.php b/vendor/symfony/cache/Tests/Simple/RedisClusterCacheTest.php index d1ed14f41..504a6d4be 100644 --- a/vendor/symfony/cache/Tests/Simple/RedisClusterCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/RedisClusterCacheTest.php @@ -10,16 +10,21 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple; -class RedisClusterCacheTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple\AbstractRedisCacheTest +use _PhpScoper5ea00cc67502b\RedisCluster; +use function class_exists; +use function explode; +use function getenv; + +class RedisClusterCacheTest extends AbstractRedisCacheTest { public static function setUpBeforeClass() { - if (!\class_exists('_PhpScoper5ea00cc67502b\\RedisCluster')) { + if (!class_exists('_PhpScoper5ea00cc67502b\\RedisCluster')) { self::markTestSkipped('The RedisCluster class is required.'); } - if (!($hosts = \getenv('REDIS_CLUSTER_HOSTS'))) { + if (!($hosts = getenv('REDIS_CLUSTER_HOSTS'))) { self::markTestSkipped('REDIS_CLUSTER_HOSTS env var is not defined.'); } - self::$redis = new \_PhpScoper5ea00cc67502b\RedisCluster(null, \explode(' ', $hosts)); + self::$redis = new RedisCluster(null, explode(' ', $hosts)); } } diff --git a/vendor/symfony/cache/Tests/Simple/TraceableCacheTest.php b/vendor/symfony/cache/Tests/Simple/TraceableCacheTest.php index ba6afe009..5c60631ff 100644 --- a/vendor/symfony/cache/Tests/Simple/TraceableCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/TraceableCacheTest.php @@ -15,12 +15,12 @@ /** * @group time-sensitive */ -class TraceableCacheTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Simple\CacheTestCase +class TraceableCacheTest extends CacheTestCase { protected $skippedTests = ['testPrune' => 'TraceableCache just proxies']; public function createSimpleCache($defaultLifetime = 0) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\TraceableCache(new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Simple\FilesystemCache('', $defaultLifetime)); + return new TraceableCache(new FilesystemCache('', $defaultLifetime)); } public function testGetMissTrace() { @@ -30,7 +30,7 @@ public function testGetMissTrace() $this->assertCount(1, $calls); $call = $calls[0]; $this->assertSame('get', $call->name); - $this->assertSame(['k' => \false], $call->result); + $this->assertSame(['k' => false], $call->result); $this->assertSame(0, $call->hits); $this->assertSame(1, $call->misses); $this->assertNotEmpty($call->start); @@ -58,7 +58,7 @@ public function testGetMultipleMissTrace() $this->assertCount(2, $calls); $call = $calls[1]; $this->assertSame('getMultiple', $call->name); - $this->assertSame(['k1' => \true, 'k0' => \false], $call->result); + $this->assertSame(['k1' => true, 'k0' => false], $call->result); $this->assertSame(1, $call->misses); $this->assertNotEmpty($call->start); $this->assertNotEmpty($call->end); @@ -71,7 +71,7 @@ public function testHasMissTrace() $this->assertCount(1, $calls); $call = $calls[0]; $this->assertSame('has', $call->name); - $this->assertSame(['k' => \false], $call->result); + $this->assertSame(['k' => false], $call->result); $this->assertNotEmpty($call->start); $this->assertNotEmpty($call->end); } @@ -84,7 +84,7 @@ public function testHasHitTrace() $this->assertCount(2, $calls); $call = $calls[1]; $this->assertSame('has', $call->name); - $this->assertSame(['k' => \true], $call->result); + $this->assertSame(['k' => true], $call->result); $this->assertNotEmpty($call->start); $this->assertNotEmpty($call->end); } @@ -96,7 +96,7 @@ public function testDeleteTrace() $this->assertCount(1, $calls); $call = $calls[0]; $this->assertSame('delete', $call->name); - $this->assertSame(['k' => \true], $call->result); + $this->assertSame(['k' => true], $call->result); $this->assertSame(0, $call->hits); $this->assertSame(0, $call->misses); $this->assertNotEmpty($call->start); @@ -111,7 +111,7 @@ public function testDeleteMultipleTrace() $this->assertCount(1, $calls); $call = $calls[0]; $this->assertSame('deleteMultiple', $call->name); - $this->assertSame(['keys' => $arg, 'result' => \true], $call->result); + $this->assertSame(['keys' => $arg, 'result' => true], $call->result); $this->assertSame(0, $call->hits); $this->assertSame(0, $call->misses); $this->assertNotEmpty($call->start); @@ -125,7 +125,7 @@ public function testTraceSetTrace() $this->assertCount(1, $calls); $call = $calls[0]; $this->assertSame('set', $call->name); - $this->assertSame(['k' => \true], $call->result); + $this->assertSame(['k' => true], $call->result); $this->assertSame(0, $call->hits); $this->assertSame(0, $call->misses); $this->assertNotEmpty($call->start); @@ -139,7 +139,7 @@ public function testSetMultipleTrace() $this->assertCount(1, $calls); $call = $calls[0]; $this->assertSame('setMultiple', $call->name); - $this->assertSame(['keys' => ['k'], 'result' => \true], $call->result); + $this->assertSame(['keys' => ['k'], 'result' => true], $call->result); $this->assertSame(0, $call->hits); $this->assertSame(0, $call->misses); $this->assertNotEmpty($call->start); diff --git a/vendor/symfony/cache/Tests/Simple/index.php b/vendor/symfony/cache/Tests/Simple/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/cache/Tests/Simple/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/cache/Tests/Traits/PdoPruneableTrait.php b/vendor/symfony/cache/Tests/Traits/PdoPruneableTrait.php index 064f352b2..1f59d4589 100644 --- a/vendor/symfony/cache/Tests/Traits/PdoPruneableTrait.php +++ b/vendor/symfony/cache/Tests/Traits/PdoPruneableTrait.php @@ -10,20 +10,26 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Tests\Traits; +use Doctrine\DBAL\Statement; +use PDO; +use ReflectionObject; +use function count; +use function sprintf; + trait PdoPruneableTrait { protected function isPruned($cache, $name) { - $o = new \ReflectionObject($cache); + $o = new ReflectionObject($cache); if (!$o->hasMethod('getConnection')) { self::fail('Cache does not have "getConnection()" method.'); } $getPdoConn = $o->getMethod('getConnection'); - $getPdoConn->setAccessible(\true); - /** @var \Doctrine\DBAL\Statement $select */ + $getPdoConn->setAccessible(true); + /** @var Statement $select */ $select = $getPdoConn->invoke($cache)->prepare('SELECT 1 FROM cache_items WHERE item_id LIKE :id'); - $select->bindValue(':id', \sprintf('%%%s', $name)); + $select->bindValue(':id', sprintf('%%%s', $name)); $select->execute(); - return 0 === \count($select->fetchAll(\PDO::FETCH_COLUMN)); + return 0 === count($select->fetchAll(PDO::FETCH_COLUMN)); } } diff --git a/vendor/symfony/cache/Tests/Traits/index.php b/vendor/symfony/cache/Tests/Traits/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/cache/Tests/Traits/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/cache/Tests/index.php b/vendor/symfony/cache/Tests/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/cache/Tests/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/cache/Traits/AbstractTrait.php b/vendor/symfony/cache/Traits/AbstractTrait.php index 2adb1f16c..b3861ec62 100644 --- a/vendor/symfony/cache/Traits/AbstractTrait.php +++ b/vendor/symfony/cache/Traits/AbstractTrait.php @@ -12,6 +12,22 @@ use _PhpScoper5ea00cc67502b\Psr\Log\LoggerAwareTrait; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem; +use DomainException; +use Error; +use ErrorException; +use Exception; +use Traversable; +use function base64_encode; +use function hash; +use function ini_set; +use function mt_rand; +use function pack; +use function strlen; +use function substr_replace; +use function time; +use function unserialize; +use const E_ERROR; + /** * @author Nicolas Grekas * @@ -22,7 +38,7 @@ trait AbstractTrait use LoggerAwareTrait; private $namespace; private $namespaceVersion = ''; - private $versioningIsEnabled = \false; + private $versioningIsEnabled = false; private $deferred = []; /** * @var int|null The maximum length to enforce for identifiers or null when no limit applies @@ -33,7 +49,7 @@ trait AbstractTrait * * @param array $ids The cache identifiers to fetch * - * @return array|\Traversable The corresponding values found in the cache + * @return array|Traversable The corresponding values found in the cache */ protected abstract function doFetch(array $ids); /** @@ -80,9 +96,9 @@ public function hasItem($key) } try { return $this->doHave($id); - } catch (\Exception $e) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::log($this->logger, 'Failed to check if key "{key}" is cached', ['key' => $key, 'exception' => $e]); - return \false; + } catch (Exception $e) { + CacheItem::log($this->logger, 'Failed to check if key "{key}" is cached', ['key' => $key, 'exception' => $e]); + return false; } } /** @@ -92,21 +108,21 @@ public function clear() { $this->deferred = []; if ($cleared = $this->versioningIsEnabled) { - $namespaceVersion = \substr_replace(\base64_encode(\pack('V', \mt_rand())), static::NS_SEPARATOR, 5); + $namespaceVersion = substr_replace(base64_encode(pack('V', mt_rand())), static::NS_SEPARATOR, 5); try { $cleared = $this->doSave([static::NS_SEPARATOR . $this->namespace => $namespaceVersion], 0); - } catch (\Exception $e) { - $cleared = \false; + } catch (Exception $e) { + $cleared = false; } - if ($cleared = \true === $cleared || [] === $cleared) { + if ($cleared = true === $cleared || [] === $cleared) { $this->namespaceVersion = $namespaceVersion; } } try { return $this->doClear($this->namespace) || $cleared; - } catch (\Exception $e) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::log($this->logger, 'Failed to clear the cache', ['exception' => $e]); - return \false; + } catch (Exception $e) { + CacheItem::log($this->logger, 'Failed to clear the cache', ['exception' => $e]); + return false; } } /** @@ -128,11 +144,11 @@ public function deleteItems(array $keys) } try { if ($this->doDelete($ids)) { - return \true; + return true; } - } catch (\Exception $e) { + } catch (Exception $e) { } - $ok = \true; + $ok = true; // When bulk-delete failed, retry each item individually foreach ($ids as $key => $id) { try { @@ -140,10 +156,10 @@ public function deleteItems(array $keys) if ($this->doDelete([$id])) { continue; } - } catch (\Exception $e) { + } catch (Exception $e) { } - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::log($this->logger, 'Failed to delete key "{key}"', ['key' => $key, 'exception' => $e]); - $ok = \false; + CacheItem::log($this->logger, 'Failed to delete key "{key}"', ['key' => $key, 'exception' => $e]); + $ok = false; } return $ok; } @@ -159,7 +175,7 @@ public function deleteItems(array $keys) * * @return bool the previous state of versioning */ - public function enableVersioning($enable = \true) + public function enableVersioning($enable = true) { $wasEnabled = $this->versioningIsEnabled; $this->versioningIsEnabled = (bool) $enable; @@ -183,28 +199,28 @@ public function reset() * * @return mixed * - * @throws \Exception + * @throws Exception */ protected static function unserialize($value) { if ('b:0;' === $value) { - return \false; + return false; } - $unserializeCallbackHandler = \ini_set('unserialize_callback_func', __CLASS__ . '::handleUnserializeCallback'); + $unserializeCallbackHandler = ini_set('unserialize_callback_func', __CLASS__ . '::handleUnserializeCallback'); try { - if (\false !== ($value = \unserialize($value))) { + if (false !== ($value = unserialize($value))) { return $value; } - throw new \DomainException('Failed to unserialize cached value.'); - } catch (\Error $e) { - throw new \ErrorException($e->getMessage(), $e->getCode(), \E_ERROR, $e->getFile(), $e->getLine()); + throw new DomainException('Failed to unserialize cached value.'); + } catch (Error $e) { + throw new ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); } finally { - \ini_set('unserialize_callback_func', $unserializeCallbackHandler); + ini_set('unserialize_callback_func', $unserializeCallbackHandler); } } private function getId($key) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::validateKey($key); + CacheItem::validateKey($key); if ($this->versioningIsEnabled && '' === $this->namespaceVersion) { $this->namespaceVersion = '1' . static::NS_SEPARATOR; try { @@ -212,17 +228,17 @@ private function getId($key) $this->namespaceVersion = $v; } if ('1' . static::NS_SEPARATOR === $this->namespaceVersion) { - $this->namespaceVersion = \substr_replace(\base64_encode(\pack('V', \time())), static::NS_SEPARATOR, 5); + $this->namespaceVersion = substr_replace(base64_encode(pack('V', time())), static::NS_SEPARATOR, 5); $this->doSave([static::NS_SEPARATOR . $this->namespace => $this->namespaceVersion], 0); } - } catch (\Exception $e) { + } catch (Exception $e) { } } if (null === $this->maxIdLength) { return $this->namespace . $this->namespaceVersion . $key; } - if (\strlen($id = $this->namespace . $this->namespaceVersion . $key) > $this->maxIdLength) { - $id = $this->namespace . $this->namespaceVersion . \substr_replace(\base64_encode(\hash('sha256', $key, \true)), static::NS_SEPARATOR, -(\strlen($this->namespaceVersion) + 22)); + if (strlen($id = $this->namespace . $this->namespaceVersion . $key) > $this->maxIdLength) { + $id = $this->namespace . $this->namespaceVersion . substr_replace(base64_encode(hash('sha256', $key, true)), static::NS_SEPARATOR, -(strlen($this->namespaceVersion) + 22)); } return $id; } @@ -231,6 +247,6 @@ private function getId($key) */ public static function handleUnserializeCallback($class) { - throw new \DomainException('Class not found: ' . $class); + throw new DomainException('Class not found: ' . $class); } } diff --git a/vendor/symfony/cache/Traits/ApcuTrait.php b/vendor/symfony/cache/Traits/ApcuTrait.php index 4f1337ca8..844b98e8f 100644 --- a/vendor/symfony/cache/Traits/ApcuTrait.php +++ b/vendor/symfony/cache/Traits/ApcuTrait.php @@ -1,4 +1,37 @@ + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ /* * This file is part of the Symfony package. @@ -10,8 +43,26 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits; +use _PhpScoper5ea00cc67502b\APCuIterator; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\CacheException; +use Error; +use ErrorException; +use Exception; +use function array_keys; +use function class_exists; +use function count; +use function filter_var; +use function function_exists; +use function ini_get; +use function ini_set; +use function key; +use function preg_quote; +use function sprintf; +use const E_ERROR; +use const FILTER_VALIDATE_BOOLEAN; +use const PHP_SAPI; + /** * @author Nicolas Grekas * @@ -21,19 +72,19 @@ trait ApcuTrait { public static function isSupported() { - return \function_exists('_PhpScoper5ea00cc67502b\\apcu_fetch') && \filter_var(\ini_get('apc.enabled'), \FILTER_VALIDATE_BOOLEAN); + return function_exists('_PhpScoper5ea00cc67502b\\apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN); } private function init($namespace, $defaultLifetime, $version) { if (!static::isSupported()) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\CacheException('APCu is not enabled.'); + throw new CacheException('APCu is not enabled.'); } - if ('cli' === \PHP_SAPI) { - \ini_set('apc.use_request_time', 0); + if ('cli' === PHP_SAPI) { + ini_set('apc.use_request_time', 0); } parent::__construct($namespace, $defaultLifetime); if (null !== $version) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::validateKey($version); + CacheItem::validateKey($version); if (!apcu_exists($version . '@' . $namespace)) { $this->doClear($namespace); apcu_add($version . '@' . $namespace, null); @@ -51,8 +102,8 @@ protected function doFetch(array $ids) (yield $k => $v); } } - } catch (\Error $e) { - throw new \ErrorException($e->getMessage(), $e->getCode(), \E_ERROR, $e->getFile(), $e->getLine()); + } catch (Error $e) { + throw new ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); } } /** @@ -67,7 +118,7 @@ protected function doHave($id) */ protected function doClear($namespace) { - return isset($namespace[0]) && \class_exists('_PhpScoper5ea00cc67502b\\APCuIterator', \false) && ('cli' !== \PHP_SAPI || \filter_var(\ini_get('apc.enable_cli'), \FILTER_VALIDATE_BOOLEAN)) ? apcu_delete(new \_PhpScoper5ea00cc67502b\APCuIterator(\sprintf('/^%s/', \preg_quote($namespace, '/')), APC_ITER_KEY)) : apcu_clear_cache(); + return isset($namespace[0]) && class_exists('_PhpScoper5ea00cc67502b\\APCuIterator', false) && ('cli' !== PHP_SAPI || filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) ? apcu_delete(new APCuIterator(sprintf('/^%s/', preg_quote($namespace, '/')), APC_ITER_KEY)) : apcu_clear_cache(); } /** * {@inheritdoc} @@ -77,7 +128,7 @@ protected function doDelete(array $ids) foreach ($ids as $id) { apcu_delete($id); } - return \true; + return true; } /** * {@inheritdoc} @@ -85,16 +136,16 @@ protected function doDelete(array $ids) protected function doSave(array $values, $lifetime) { try { - if (\false === ($failures = apcu_store($values, null, $lifetime))) { + if (false === ($failures = apcu_store($values, null, $lifetime))) { $failures = $values; } - return \array_keys($failures); - } catch (\Error $e) { - } catch (\Exception $e) { + return array_keys($failures); + } catch (Error $e) { + } catch (Exception $e) { } - if (1 === \count($values)) { + if (1 === count($values)) { // Workaround https://github.com/krakjoe/apcu/issues/170 - apcu_delete(\key($values)); + apcu_delete(key($values)); } throw $e; } diff --git a/vendor/symfony/cache/Traits/ArrayTrait.php b/vendor/symfony/cache/Traits/ArrayTrait.php index 7abec1cd0..1076642e8 100644 --- a/vendor/symfony/cache/Traits/ArrayTrait.php +++ b/vendor/symfony/cache/Traits/ArrayTrait.php @@ -12,6 +12,10 @@ use _PhpScoper5ea00cc67502b\Psr\Log\LoggerAwareTrait; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem; +use Exception; +use function time; +use function unserialize; + /** * @author Nicolas Grekas * @@ -37,8 +41,8 @@ public function getValues() */ public function hasItem($key) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::validateKey($key); - return isset($this->expiries[$key]) && ($this->expiries[$key] > \time() || !$this->deleteItem($key)); + CacheItem::validateKey($key); + return isset($this->expiries[$key]) && ($this->expiries[$key] > time() || !$this->deleteItem($key)); } /** * {@inheritdoc} @@ -46,16 +50,16 @@ public function hasItem($key) public function clear() { $this->values = $this->expiries = []; - return \true; + return true; } /** * {@inheritdoc} */ public function deleteItem($key) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::validateKey($key); + CacheItem::validateKey($key); unset($this->values[$key], $this->expiries[$key]); - return \true; + return true; } /** * {@inheritdoc} @@ -73,21 +77,21 @@ private function generateItems(array $keys, $now, $f) } elseif (!$this->storeSerialized) { $value = $this->values[$key]; } elseif ('b:0;' === ($value = $this->values[$key])) { - $value = \false; - } elseif (\false === ($value = \unserialize($value))) { + $value = false; + } elseif (false === ($value = unserialize($value))) { $this->values[$key] = $value = null; - $isHit = \false; + $isHit = false; } - } catch (\Exception $e) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::log($this->logger, 'Failed to unserialize key "{key}"', ['key' => $key, 'exception' => $e]); + } catch (Exception $e) { + CacheItem::log($this->logger, 'Failed to unserialize key "{key}"', ['key' => $key, 'exception' => $e]); $this->values[$key] = $value = null; - $isHit = \false; + $isHit = false; } unset($keys[$i]); (yield $key => $f($key, $value, $isHit)); } foreach ($keys as $key) { - (yield $key => $f($key, null, \false)); + (yield $key => $f($key, null, false)); } } } diff --git a/vendor/symfony/cache/Traits/DoctrineTrait.php b/vendor/symfony/cache/Traits/DoctrineTrait.php index 49a445891..9f03421a0 100644 --- a/vendor/symfony/cache/Traits/DoctrineTrait.php +++ b/vendor/symfony/cache/Traits/DoctrineTrait.php @@ -10,6 +10,11 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits; +use Error; +use ErrorException; +use function ini_set; +use const E_ERROR; + /** * @author Nicolas Grekas * @@ -31,22 +36,22 @@ public function reset() */ protected function doFetch(array $ids) { - $unserializeCallbackHandler = \ini_set('unserialize_callback_func', parent::class . '::handleUnserializeCallback'); + $unserializeCallbackHandler = ini_set('unserialize_callback_func', parent::class . '::handleUnserializeCallback'); try { return $this->provider->fetchMultiple($ids); - } catch (\Error $e) { + } catch (Error $e) { $trace = $e->getTrace(); if (isset($trace[0]['function']) && !isset($trace[0]['class'])) { switch ($trace[0]['function']) { case 'unserialize': case 'apcu_fetch': case 'apc_fetch': - throw new \ErrorException($e->getMessage(), $e->getCode(), \E_ERROR, $e->getFile(), $e->getLine()); + throw new ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); } } throw $e; } finally { - \ini_set('unserialize_callback_func', $unserializeCallbackHandler); + ini_set('unserialize_callback_func', $unserializeCallbackHandler); } } /** @@ -69,7 +74,7 @@ protected function doClear($namespace) */ protected function doDelete(array $ids) { - $ok = \true; + $ok = true; foreach ($ids as $id) { $ok = $this->provider->delete($id) && $ok; } diff --git a/vendor/symfony/cache/Traits/FilesystemCommonTrait.php b/vendor/symfony/cache/Traits/FilesystemCommonTrait.php index f68752942..0de80d563 100644 --- a/vendor/symfony/cache/Traits/FilesystemCommonTrait.php +++ b/vendor/symfony/cache/Traits/FilesystemCommonTrait.php @@ -11,6 +11,33 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException; +use BadMethodCallException; +use ErrorException; +use FilesystemIterator; +use RecursiveDirectoryIterator; +use RecursiveIteratorIterator; +use function base64_encode; +use function file_exists; +use function file_put_contents; +use function hash; +use function method_exists; +use function mkdir; +use function preg_match; +use function realpath; +use function rename; +use function restore_error_handler; +use function set_error_handler; +use function sprintf; +use function str_replace; +use function strlen; +use function strtoupper; +use function substr; +use function sys_get_temp_dir; +use function touch; +use function uniqid; +use function unlink; +use const DIRECTORY_SEPARATOR; + /** * @author Nicolas Grekas * @@ -23,23 +50,23 @@ trait FilesystemCommonTrait private function init($namespace, $directory) { if (!isset($directory[0])) { - $directory = \sys_get_temp_dir() . '/symfony-cache'; + $directory = sys_get_temp_dir() . '/symfony-cache'; } else { - $directory = \realpath($directory) ?: $directory; + $directory = realpath($directory) ?: $directory; } if (isset($namespace[0])) { - if (\preg_match('#[^-+_.A-Za-z0-9]#', $namespace, $match)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Namespace contains "%s" but only characters in [-+_.A-Za-z0-9] are allowed.', $match[0])); + if (preg_match('#[^-+_.A-Za-z0-9]#', $namespace, $match)) { + throw new InvalidArgumentException(sprintf('Namespace contains "%s" but only characters in [-+_.A-Za-z0-9] are allowed.', $match[0])); } - $directory .= \DIRECTORY_SEPARATOR . $namespace; + $directory .= DIRECTORY_SEPARATOR . $namespace; } - if (!\file_exists($directory)) { - @\mkdir($directory, 0777, \true); + if (!file_exists($directory)) { + @mkdir($directory, 0777, true); } - $directory .= \DIRECTORY_SEPARATOR; + $directory .= DIRECTORY_SEPARATOR; // On Windows the whole path is limited to 258 chars - if ('\\' === \DIRECTORY_SEPARATOR && \strlen($directory) > 234) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache directory too long (%s).', $directory)); + if ('\\' === DIRECTORY_SEPARATOR && strlen($directory) > 234) { + throw new InvalidArgumentException(sprintf('Cache directory too long (%s).', $directory)); } $this->directory = $directory; } @@ -48,9 +75,9 @@ private function init($namespace, $directory) */ protected function doClear($namespace) { - $ok = \true; - foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->directory, \FilesystemIterator::SKIP_DOTS)) as $file) { - $ok = ($file->isDir() || @\unlink($file) || !\file_exists($file)) && $ok; + $ok = true; + foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->directory, FilesystemIterator::SKIP_DOTS)) as $file) { + $ok = ($file->isDir() || @unlink($file) || !file_exists($file)) && $ok; } return $ok; } @@ -59,60 +86,60 @@ protected function doClear($namespace) */ protected function doDelete(array $ids) { - $ok = \true; + $ok = true; foreach ($ids as $id) { $file = $this->getFile($id); - $ok = (!\file_exists($file) || @\unlink($file) || !\file_exists($file)) && $ok; + $ok = (!file_exists($file) || @unlink($file) || !file_exists($file)) && $ok; } return $ok; } private function write($file, $data, $expiresAt = null) { - \set_error_handler(__CLASS__ . '::throwError'); + set_error_handler(__CLASS__ . '::throwError'); try { if (null === $this->tmp) { - $this->tmp = $this->directory . \uniqid('', \true); + $this->tmp = $this->directory . uniqid('', true); } - \file_put_contents($this->tmp, $data); + file_put_contents($this->tmp, $data); if (null !== $expiresAt) { - \touch($this->tmp, $expiresAt); + touch($this->tmp, $expiresAt); } - return \rename($this->tmp, $file); + return rename($this->tmp, $file); } finally { - \restore_error_handler(); + restore_error_handler(); } } - private function getFile($id, $mkdir = \false) + private function getFile($id, $mkdir = false) { - $hash = \str_replace('/', '-', \base64_encode(\hash('sha256', static::class . $id, \true))); - $dir = $this->directory . \strtoupper($hash[0] . \DIRECTORY_SEPARATOR . $hash[1] . \DIRECTORY_SEPARATOR); - if ($mkdir && !\file_exists($dir)) { - @\mkdir($dir, 0777, \true); + $hash = str_replace('/', '-', base64_encode(hash('sha256', static::class . $id, true))); + $dir = $this->directory . strtoupper($hash[0] . DIRECTORY_SEPARATOR . $hash[1] . DIRECTORY_SEPARATOR); + if ($mkdir && !file_exists($dir)) { + @mkdir($dir, 0777, true); } - return $dir . \substr($hash, 2, 20); + return $dir . substr($hash, 2, 20); } /** * @internal */ public static function throwError($type, $message, $file, $line) { - throw new \ErrorException($message, 0, $type, $file, $line); + throw new ErrorException($message, 0, $type, $file, $line); } public function __sleep() { - throw new \BadMethodCallException('Cannot serialize ' . __CLASS__); + throw new BadMethodCallException('Cannot serialize ' . __CLASS__); } public function __wakeup() { - throw new \BadMethodCallException('Cannot unserialize ' . __CLASS__); + throw new BadMethodCallException('Cannot unserialize ' . __CLASS__); } public function __destruct() { - if (\method_exists(parent::class, '__destruct')) { + if (method_exists(parent::class, '__destruct')) { parent::__destruct(); } - if (null !== $this->tmp && \file_exists($this->tmp)) { - \unlink($this->tmp); + if (null !== $this->tmp && file_exists($this->tmp)) { + unlink($this->tmp); } } } diff --git a/vendor/symfony/cache/Traits/FilesystemTrait.php b/vendor/symfony/cache/Traits/FilesystemTrait.php index 3afc5ea16..3bf17df04 100644 --- a/vendor/symfony/cache/Traits/FilesystemTrait.php +++ b/vendor/symfony/cache/Traits/FilesystemTrait.php @@ -11,6 +11,24 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\CacheException; +use FilesystemIterator; +use RecursiveDirectoryIterator; +use RecursiveIteratorIterator; +use function fclose; +use function fgets; +use function file_exists; +use function filemtime; +use function fopen; +use function is_writable; +use function rawurldecode; +use function rawurlencode; +use function rtrim; +use function serialize; +use function sprintf; +use function stream_get_contents; +use function time; +use function unlink; + /** * @author Nicolas Grekas * @author Rob Frawley 2nd @@ -25,17 +43,17 @@ trait FilesystemTrait */ public function prune() { - $time = \time(); - $pruned = \true; - foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->directory, \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { - if (!($h = @\fopen($file, 'rb'))) { + $time = time(); + $pruned = true; + foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->directory, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::LEAVES_ONLY) as $file) { + if (!($h = @fopen($file, 'rb'))) { continue; } - if (($expiresAt = (int) \fgets($h)) && $time >= $expiresAt) { - \fclose($h); - $pruned = @\unlink($file) && !\file_exists($file) && $pruned; + if (($expiresAt = (int) fgets($h)) && $time >= $expiresAt) { + fclose($h); + $pruned = @unlink($file) && !file_exists($file) && $pruned; } else { - \fclose($h); + fclose($h); } } return $pruned; @@ -46,19 +64,19 @@ public function prune() protected function doFetch(array $ids) { $values = []; - $now = \time(); + $now = time(); foreach ($ids as $id) { $file = $this->getFile($id); - if (!\file_exists($file) || !($h = @\fopen($file, 'rb'))) { + if (!file_exists($file) || !($h = @fopen($file, 'rb'))) { continue; } - if (($expiresAt = (int) \fgets($h)) && $now >= $expiresAt) { - \fclose($h); - @\unlink($file); + if (($expiresAt = (int) fgets($h)) && $now >= $expiresAt) { + fclose($h); + @unlink($file); } else { - $i = \rawurldecode(\rtrim(\fgets($h))); - $value = \stream_get_contents($h); - \fclose($h); + $i = rawurldecode(rtrim(fgets($h))); + $value = stream_get_contents($h); + fclose($h); if ($i === $id) { $values[$id] = parent::unserialize($value); } @@ -72,20 +90,20 @@ protected function doFetch(array $ids) protected function doHave($id) { $file = $this->getFile($id); - return \file_exists($file) && (@\filemtime($file) > \time() || $this->doFetch([$id])); + return file_exists($file) && (@filemtime($file) > time() || $this->doFetch([$id])); } /** * {@inheritdoc} */ protected function doSave(array $values, $lifetime) { - $ok = \true; - $expiresAt = $lifetime ? \time() + $lifetime : 0; + $ok = true; + $expiresAt = $lifetime ? time() + $lifetime : 0; foreach ($values as $id => $value) { - $ok = $this->write($this->getFile($id, \true), $expiresAt . "\n" . \rawurlencode($id) . "\n" . \serialize($value), $expiresAt) && $ok; + $ok = $this->write($this->getFile($id, true), $expiresAt . "\n" . rawurlencode($id) . "\n" . serialize($value), $expiresAt) && $ok; } - if (!$ok && !\is_writable($this->directory)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\CacheException(\sprintf('Cache directory is not writable (%s).', $this->directory)); + if (!$ok && !is_writable($this->directory)) { + throw new CacheException(sprintf('Cache directory is not writable (%s).', $this->directory)); } return $ok; } diff --git a/vendor/symfony/cache/Traits/MemcachedTrait.php b/vendor/symfony/cache/Traits/MemcachedTrait.php index e0d6ee0e5..36ea4f22a 100644 --- a/vendor/symfony/cache/Traits/MemcachedTrait.php +++ b/vendor/symfony/cache/Traits/MemcachedTrait.php @@ -10,8 +10,47 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits; +use _PhpScoper5ea00cc67502b\Memcached; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\CacheException; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException; +use Error; +use ErrorException; +use function array_change_key_case; +use function array_key_exists; +use function array_map; +use function array_values; +use function constant; +use function count; +use function explode; +use function extension_loaded; +use function get_class; +use function gettype; +use function ini_set; +use function is_array; +use function is_int; +use function is_string; +use function method_exists; +use function parse_str; +use function parse_url; +use function phpversion; +use function preg_match; +use function preg_replace_callback; +use function rawurldecode; +use function rawurlencode; +use function restore_error_handler; +use function set_error_handler; +use function sprintf; +use function strlen; +use function strpos; +use function strtolower; +use function strtoupper; +use function substr; +use function time; +use function trigger_error; +use function version_compare; +use const CASE_UPPER; +use const E_ERROR; + /** * @author Rob Frawley 2nd * @author Nicolas Grekas @@ -20,24 +59,24 @@ */ trait MemcachedTrait { - private static $defaultClientOptions = ['persistent_id' => null, 'username' => null, 'password' => null, \_PhpScoper5ea00cc67502b\Memcached::OPT_SERIALIZER => \_PhpScoper5ea00cc67502b\Memcached::SERIALIZER_PHP]; + private static $defaultClientOptions = ['persistent_id' => null, 'username' => null, 'password' => null, Memcached::OPT_SERIALIZER => Memcached::SERIALIZER_PHP]; private $client; private $lazyClient; public static function isSupported() { - return \extension_loaded('memcached') && \version_compare(\phpversion('memcached'), '2.2.0', '>='); + return extension_loaded('memcached') && version_compare(phpversion('memcached'), '2.2.0', '>='); } - private function init(\_PhpScoper5ea00cc67502b\Memcached $client, $namespace, $defaultLifetime) + private function init(Memcached $client, $namespace, $defaultLifetime) { if (!static::isSupported()) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\CacheException('Memcached >= 2.2.0 is required.'); + throw new CacheException('Memcached >= 2.2.0 is required.'); } - if ('Memcached' === \get_class($client)) { - $opt = $client->getOption(\_PhpScoper5ea00cc67502b\Memcached::OPT_SERIALIZER); - if (\_PhpScoper5ea00cc67502b\Memcached::SERIALIZER_PHP !== $opt && \_PhpScoper5ea00cc67502b\Memcached::SERIALIZER_IGBINARY !== $opt) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\CacheException('MemcachedAdapter: "serializer" option must be "php" or "igbinary".'); + if ('Memcached' === get_class($client)) { + $opt = $client->getOption(Memcached::OPT_SERIALIZER); + if (Memcached::SERIALIZER_PHP !== $opt && Memcached::SERIALIZER_IGBINARY !== $opt) { + throw new CacheException('MemcachedAdapter: "serializer" option must be "php" or "igbinary".'); } - $this->maxIdLength -= \strlen($client->getOption(\_PhpScoper5ea00cc67502b\Memcached::OPT_PREFIX_KEY)); + $this->maxIdLength -= strlen($client->getOption(Memcached::OPT_PREFIX_KEY)); $this->client = $client; } else { $this->lazyClient = $client; @@ -59,53 +98,53 @@ private function init(\_PhpScoper5ea00cc67502b\Memcached $client, $namespace, $d * * @return \Memcached * - * @throws \ErrorException When invalid options or servers are provided + * @throws ErrorException When invalid options or servers are provided */ public static function createConnection($servers, array $options = []) { - if (\is_string($servers)) { + if (is_string($servers)) { $servers = [$servers]; - } elseif (!\is_array($servers)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('MemcachedAdapter::createClient() expects array or string as first argument, "%s" given.', \gettype($servers))); + } elseif (!is_array($servers)) { + throw new InvalidArgumentException(sprintf('MemcachedAdapter::createClient() expects array or string as first argument, "%s" given.', gettype($servers))); } if (!static::isSupported()) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\CacheException('Memcached >= 2.2.0 is required.'); + throw new CacheException('Memcached >= 2.2.0 is required.'); } - \set_error_handler(function ($type, $msg, $file, $line) { - throw new \ErrorException($msg, 0, $type, $file, $line); + set_error_handler(function ($type, $msg, $file, $line) { + throw new ErrorException($msg, 0, $type, $file, $line); }); try { $options += static::$defaultClientOptions; - $client = new \_PhpScoper5ea00cc67502b\Memcached($options['persistent_id']); + $client = new Memcached($options['persistent_id']); $username = $options['username']; $password = $options['password']; // parse any DSN in $servers foreach ($servers as $i => $dsn) { - if (\is_array($dsn)) { + if (is_array($dsn)) { continue; } - if (0 !== \strpos($dsn, 'memcached://')) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Invalid Memcached DSN: "%s" does not start with "memcached://".', $dsn)); + if (0 !== strpos($dsn, 'memcached://')) { + throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: "%s" does not start with "memcached://".', $dsn)); } - $params = \preg_replace_callback('#^memcached://(?:([^@]*+)@)?#', function ($m) use(&$username, &$password) { + $params = preg_replace_callback('#^memcached://(?:([^@]*+)@)?#', function ($m) use(&$username, &$password) { if (!empty($m[1])) { - list($username, $password) = \explode(':', $m[1], 2) + [1 => null]; + [$username, $password] = explode(':', $m[1], 2) + [1 => null]; } return 'file://'; }, $dsn); - if (\false === ($params = \parse_url($params))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Invalid Memcached DSN: "%s".', $dsn)); + if (false === ($params = parse_url($params))) { + throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: "%s".', $dsn)); } if (!isset($params['host']) && !isset($params['path'])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Invalid Memcached DSN: "%s".', $dsn)); + throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: "%s".', $dsn)); } - if (isset($params['path']) && \preg_match('#/(\\d+)$#', $params['path'], $m)) { + if (isset($params['path']) && preg_match('#/(\\d+)$#', $params['path'], $m)) { $params['weight'] = $m[1]; - $params['path'] = \substr($params['path'], 0, -\strlen($m[0])); + $params['path'] = substr($params['path'], 0, -strlen($m[0])); } $params += ['host' => isset($params['host']) ? $params['host'] : $params['path'], 'port' => isset($params['host']) ? 11211 : null, 'weight' => 0]; if (isset($params['query'])) { - \parse_str($params['query'], $query); + parse_str($params['query'], $query); $params += $query; $options = $query + $options; } @@ -113,21 +152,21 @@ public static function createConnection($servers, array $options = []) } // set client's options unset($options['persistent_id'], $options['username'], $options['password'], $options['weight'], $options['lazy']); - $options = \array_change_key_case($options, \CASE_UPPER); - $client->setOption(\_PhpScoper5ea00cc67502b\Memcached::OPT_BINARY_PROTOCOL, \true); - $client->setOption(\_PhpScoper5ea00cc67502b\Memcached::OPT_NO_BLOCK, \true); - $client->setOption(\_PhpScoper5ea00cc67502b\Memcached::OPT_TCP_NODELAY, \true); - if (!\array_key_exists('LIBKETAMA_COMPATIBLE', $options) && !\array_key_exists(\_PhpScoper5ea00cc67502b\Memcached::OPT_LIBKETAMA_COMPATIBLE, $options)) { - $client->setOption(\_PhpScoper5ea00cc67502b\Memcached::OPT_LIBKETAMA_COMPATIBLE, \true); + $options = array_change_key_case($options, CASE_UPPER); + $client->setOption(Memcached::OPT_BINARY_PROTOCOL, true); + $client->setOption(Memcached::OPT_NO_BLOCK, true); + $client->setOption(Memcached::OPT_TCP_NODELAY, true); + if (!array_key_exists('LIBKETAMA_COMPATIBLE', $options) && !array_key_exists(Memcached::OPT_LIBKETAMA_COMPATIBLE, $options)) { + $client->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true); } foreach ($options as $name => $value) { - if (\is_int($name)) { + if (is_int($name)) { continue; } if ('HASH' === $name || 'SERIALIZER' === $name || 'DISTRIBUTION' === $name) { - $value = \constant('Memcached::' . $name . '_' . \strtoupper($value)); + $value = constant('Memcached::' . $name . '_' . strtoupper($value)); } - $opt = \constant('Memcached::OPT_' . $name); + $opt = constant('Memcached::OPT_' . $name); unset($options[$name]); $options[$opt] = $value; } @@ -140,8 +179,8 @@ public static function createConnection($servers, array $options = []) } $newServers = []; foreach ($servers as $server) { - if (1 < \count($server)) { - $server = \array_values($server); + if (1 < count($server)) { + $server = array_values($server); unset($server[2]); $server[1] = (int) $server[1]; } @@ -155,14 +194,14 @@ public static function createConnection($servers, array $options = []) $client->addServers($servers); } if (null !== $username || null !== $password) { - if (!\method_exists($client, 'setSaslAuthData')) { - \trigger_error('Missing SASL support: the memcached extension must be compiled with --enable-memcached-sasl.'); + if (!method_exists($client, 'setSaslAuthData')) { + trigger_error('Missing SASL support: the memcached extension must be compiled with --enable-memcached-sasl.'); } $client->setSaslAuthData($username, $password); } return $client; } finally { - \restore_error_handler(); + restore_error_handler(); } } /** @@ -171,11 +210,11 @@ public static function createConnection($servers, array $options = []) protected function doSave(array $values, $lifetime) { if ($lifetime && $lifetime > 30 * 86400) { - $lifetime += \time(); + $lifetime += time(); } $encodedValues = []; foreach ($values as $key => $value) { - $encodedValues[\rawurlencode($key)] = $value; + $encodedValues[rawurlencode($key)] = $value; } return $this->checkResultCode($this->getClient()->setMulti($encodedValues, $lifetime)); } @@ -184,19 +223,19 @@ protected function doSave(array $values, $lifetime) */ protected function doFetch(array $ids) { - $unserializeCallbackHandler = \ini_set('unserialize_callback_func', __CLASS__ . '::handleUnserializeCallback'); + $unserializeCallbackHandler = ini_set('unserialize_callback_func', __CLASS__ . '::handleUnserializeCallback'); try { - $encodedIds = \array_map('rawurlencode', $ids); + $encodedIds = array_map('rawurlencode', $ids); $encodedResult = $this->checkResultCode($this->getClient()->getMulti($encodedIds)); $result = []; foreach ($encodedResult as $key => $value) { - $result[\rawurldecode($key)] = $value; + $result[rawurldecode($key)] = $value; } return $result; - } catch (\Error $e) { - throw new \ErrorException($e->getMessage(), $e->getCode(), \E_ERROR, $e->getFile(), $e->getLine()); + } catch (Error $e) { + throw new ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); } finally { - \ini_set('unserialize_callback_func', $unserializeCallbackHandler); + ini_set('unserialize_callback_func', $unserializeCallbackHandler); } } /** @@ -204,18 +243,18 @@ protected function doFetch(array $ids) */ protected function doHave($id) { - return \false !== $this->getClient()->get(\rawurlencode($id)) || $this->checkResultCode(\_PhpScoper5ea00cc67502b\Memcached::RES_SUCCESS === $this->client->getResultCode()); + return false !== $this->getClient()->get(rawurlencode($id)) || $this->checkResultCode(Memcached::RES_SUCCESS === $this->client->getResultCode()); } /** * {@inheritdoc} */ protected function doDelete(array $ids) { - $ok = \true; - $encodedIds = \array_map('rawurlencode', $ids); + $ok = true; + $encodedIds = array_map('rawurlencode', $ids); foreach ($this->checkResultCode($this->getClient()->deleteMulti($encodedIds)) as $result) { - if (\_PhpScoper5ea00cc67502b\Memcached::RES_SUCCESS !== $result && \_PhpScoper5ea00cc67502b\Memcached::RES_NOTFOUND !== $result) { - $ok = \false; + if (Memcached::RES_SUCCESS !== $result && Memcached::RES_NOTFOUND !== $result) { + $ok = false; break; } } @@ -231,10 +270,10 @@ protected function doClear($namespace) private function checkResultCode($result) { $code = $this->client->getResultCode(); - if (\_PhpScoper5ea00cc67502b\Memcached::RES_SUCCESS === $code || \_PhpScoper5ea00cc67502b\Memcached::RES_NOTFOUND === $code) { + if (Memcached::RES_SUCCESS === $code || Memcached::RES_NOTFOUND === $code) { return $result; } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\CacheException(\sprintf('MemcachedAdapter client error: %s.', \strtolower($this->client->getResultMessage()))); + throw new CacheException(sprintf('MemcachedAdapter client error: %s.', strtolower($this->client->getResultMessage()))); } /** * @return \Memcached @@ -244,12 +283,12 @@ private function getClient() if ($this->client) { return $this->client; } - $opt = $this->lazyClient->getOption(\_PhpScoper5ea00cc67502b\Memcached::OPT_SERIALIZER); - if (\_PhpScoper5ea00cc67502b\Memcached::SERIALIZER_PHP !== $opt && \_PhpScoper5ea00cc67502b\Memcached::SERIALIZER_IGBINARY !== $opt) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\CacheException('MemcachedAdapter: "serializer" option must be "php" or "igbinary".'); + $opt = $this->lazyClient->getOption(Memcached::OPT_SERIALIZER); + if (Memcached::SERIALIZER_PHP !== $opt && Memcached::SERIALIZER_IGBINARY !== $opt) { + throw new CacheException('MemcachedAdapter: "serializer" option must be "php" or "igbinary".'); } - if ('' !== ($prefix = (string) $this->lazyClient->getOption(\_PhpScoper5ea00cc67502b\Memcached::OPT_PREFIX_KEY))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\CacheException(\sprintf('MemcachedAdapter: "prefix_key" option must be empty when using proxified connections, "%s" given.', $prefix)); + if ('' !== ($prefix = (string) $this->lazyClient->getOption(Memcached::OPT_PREFIX_KEY))) { + throw new CacheException(sprintf('MemcachedAdapter: "prefix_key" option must be empty when using proxified connections, "%s" given.', $prefix)); } return $this->client = $this->lazyClient; } diff --git a/vendor/symfony/cache/Traits/PdoTrait.php b/vendor/symfony/cache/Traits/PdoTrait.php index 89c98afce..6ead5b6f6 100644 --- a/vendor/symfony/cache/Traits/PdoTrait.php +++ b/vendor/symfony/cache/Traits/PdoTrait.php @@ -15,6 +15,26 @@ use _PhpScoper5ea00cc67502b\Doctrine\DBAL\Driver\ServerInfoAwareConnection; use _PhpScoper5ea00cc67502b\Doctrine\DBAL\Schema\Schema; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException; +use DomainException; +use Exception; +use PDO; +use PDOException; +use function array_values; +use function count; +use function get_class; +use function gettype; +use function is_object; +use function is_resource; +use function is_string; +use function preg_match; +use function serialize; +use function sprintf; +use function str_pad; +use function stream_get_contents; +use function substr; +use function time; +use function version_compare; + /** * @internal */ @@ -35,20 +55,20 @@ trait PdoTrait private $namespace; private function init($connOrDsn, $namespace, $defaultLifetime, array $options) { - if (isset($namespace[0]) && \preg_match('#[^-+.A-Za-z0-9]#', $namespace, $match)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Namespace contains "%s" but only characters in [-+.A-Za-z0-9] are allowed.', $match[0])); + if (isset($namespace[0]) && preg_match('#[^-+.A-Za-z0-9]#', $namespace, $match)) { + throw new InvalidArgumentException(sprintf('Namespace contains "%s" but only characters in [-+.A-Za-z0-9] are allowed.', $match[0])); } - if ($connOrDsn instanceof \PDO) { - if (\PDO::ERRMODE_EXCEPTION !== $connOrDsn->getAttribute(\PDO::ATTR_ERRMODE)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('"%s" requires PDO error mode attribute be set to throw Exceptions (i.e. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION)).', __CLASS__)); + if ($connOrDsn instanceof PDO) { + if (PDO::ERRMODE_EXCEPTION !== $connOrDsn->getAttribute(PDO::ATTR_ERRMODE)) { + throw new InvalidArgumentException(sprintf('"%s" requires PDO error mode attribute be set to throw Exceptions (i.e. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION)).', __CLASS__)); } $this->conn = $connOrDsn; - } elseif ($connOrDsn instanceof \_PhpScoper5ea00cc67502b\Doctrine\DBAL\Connection) { + } elseif ($connOrDsn instanceof Connection) { $this->conn = $connOrDsn; - } elseif (\is_string($connOrDsn)) { + } elseif (is_string($connOrDsn)) { $this->dsn = $connOrDsn; } else { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('"%s" requires PDO or Doctrine\\DBAL\\Connection instance or DSN string as first argument, "%s" given.', __CLASS__, \is_object($connOrDsn) ? \get_class($connOrDsn) : \gettype($connOrDsn))); + throw new InvalidArgumentException(sprintf('"%s" requires PDO or Doctrine\\DBAL\\Connection instance or DSN string as first argument, "%s" given.', __CLASS__, is_object($connOrDsn) ? get_class($connOrDsn) : gettype($connOrDsn))); } $this->table = isset($options['db_table']) ? $options['db_table'] : $this->table; $this->idCol = isset($options['db_id_col']) ? $options['db_id_col'] : $this->idCol; @@ -67,25 +87,25 @@ private function init($connOrDsn, $namespace, $defaultLifetime, array $options) * Cache ID are saved in a column of maximum length 255. Cache data is * saved in a BLOB. * - * @throws \PDOException When the table already exists + * @throws PDOException When the table already exists * @throws DBALException When the table already exists - * @throws \DomainException When an unsupported PDO driver is used + * @throws DomainException When an unsupported PDO driver is used */ public function createTable() { // connect if we are not yet $conn = $this->getConnection(); - if ($conn instanceof \_PhpScoper5ea00cc67502b\Doctrine\DBAL\Connection) { + if ($conn instanceof Connection) { $types = ['mysql' => 'binary', 'sqlite' => 'text', 'pgsql' => 'string', 'oci' => 'string', 'sqlsrv' => 'string']; if (!isset($types[$this->driver])) { - throw new \DomainException(\sprintf('Creating the cache table is currently not implemented for PDO driver "%s".', $this->driver)); + throw new DomainException(sprintf('Creating the cache table is currently not implemented for PDO driver "%s".', $this->driver)); } - $schema = new \_PhpScoper5ea00cc67502b\Doctrine\DBAL\Schema\Schema(); + $schema = new Schema(); $table = $schema->createTable($this->table); $table->addColumn($this->idCol, $types[$this->driver], ['length' => 255]); $table->addColumn($this->dataCol, 'blob', ['length' => 16777215]); - $table->addColumn($this->lifetimeCol, 'integer', ['unsigned' => \true, 'notnull' => \false]); - $table->addColumn($this->timeCol, 'integer', ['unsigned' => \true]); + $table->addColumn($this->lifetimeCol, 'integer', ['unsigned' => true, 'notnull' => false]); + $table->addColumn($this->timeCol, 'integer', ['unsigned' => true]); $table->setPrimaryKey([$this->idCol]); foreach ($schema->toSql($conn->getDatabasePlatform()) as $sql) { $conn->exec($sql); @@ -114,7 +134,7 @@ public function createTable() $sql = "CREATE TABLE {$this->table} ({$this->idCol} VARCHAR(255) NOT NULL PRIMARY KEY, {$this->dataCol} VARBINARY(MAX) NOT NULL, {$this->lifetimeCol} INTEGER, {$this->timeCol} INTEGER NOT NULL)"; break; default: - throw new \DomainException(\sprintf('Creating the cache table is currently not implemented for PDO driver "%s".', $this->driver)); + throw new DomainException(sprintf('Creating the cache table is currently not implemented for PDO driver "%s".', $this->driver)); } $conn->exec($sql); } @@ -128,9 +148,9 @@ public function prune() $deleteSql .= " AND {$this->idCol} LIKE :namespace"; } $delete = $this->getConnection()->prepare($deleteSql); - $delete->bindValue(':time', \time(), \PDO::PARAM_INT); + $delete->bindValue(':time', time(), PDO::PARAM_INT); if ('' !== $this->namespace) { - $delete->bindValue(':namespace', \sprintf('%s%%', $this->namespace), \PDO::PARAM_STR); + $delete->bindValue(':namespace', sprintf('%s%%', $this->namespace), PDO::PARAM_STR); } return $delete->execute(); } @@ -139,28 +159,28 @@ public function prune() */ protected function doFetch(array $ids) { - $now = \time(); + $now = time(); $expired = []; - $sql = \str_pad('', (\count($ids) << 1) - 1, '?,'); + $sql = str_pad('', (count($ids) << 1) - 1, '?,'); $sql = "SELECT {$this->idCol}, CASE WHEN {$this->lifetimeCol} IS NULL OR {$this->lifetimeCol} + {$this->timeCol} > ? THEN {$this->dataCol} ELSE NULL END FROM {$this->table} WHERE {$this->idCol} IN ({$sql})"; $stmt = $this->getConnection()->prepare($sql); - $stmt->bindValue($i = 1, $now, \PDO::PARAM_INT); + $stmt->bindValue($i = 1, $now, PDO::PARAM_INT); foreach ($ids as $id) { $stmt->bindValue(++$i, $id); } $stmt->execute(); - while ($row = $stmt->fetch(\PDO::FETCH_NUM)) { + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { if (null === $row[1]) { $expired[] = $row[0]; } else { - (yield $row[0] => parent::unserialize(\is_resource($row[1]) ? \stream_get_contents($row[1]) : $row[1])); + (yield $row[0] => parent::unserialize(is_resource($row[1]) ? stream_get_contents($row[1]) : $row[1])); } } if ($expired) { - $sql = \str_pad('', (\count($expired) << 1) - 1, '?,'); + $sql = str_pad('', (count($expired) << 1) - 1, '?,'); $sql = "DELETE FROM {$this->table} WHERE {$this->lifetimeCol} + {$this->timeCol} <= ? AND {$this->idCol} IN ({$sql})"; $stmt = $this->getConnection()->prepare($sql); - $stmt->bindValue($i = 1, $now, \PDO::PARAM_INT); + $stmt->bindValue($i = 1, $now, PDO::PARAM_INT); foreach ($expired as $id) { $stmt->bindValue(++$i, $id); } @@ -175,7 +195,7 @@ protected function doHave($id) $sql = "SELECT 1 FROM {$this->table} WHERE {$this->idCol} = :id AND ({$this->lifetimeCol} IS NULL OR {$this->lifetimeCol} + {$this->timeCol} > :time)"; $stmt = $this->getConnection()->prepare($sql); $stmt->bindValue(':id', $id); - $stmt->bindValue(':time', \time(), \PDO::PARAM_INT); + $stmt->bindValue(':time', time(), PDO::PARAM_INT); $stmt->execute(); return (bool) $stmt->fetchColumn(); } @@ -195,18 +215,18 @@ protected function doClear($namespace) $sql = "DELETE FROM {$this->table} WHERE {$this->idCol} LIKE '{$namespace}%'"; } $conn->exec($sql); - return \true; + return true; } /** * {@inheritdoc} */ protected function doDelete(array $ids) { - $sql = \str_pad('', (\count($ids) << 1) - 1, '?,'); + $sql = str_pad('', (count($ids) << 1) - 1, '?,'); $sql = "DELETE FROM {$this->table} WHERE {$this->idCol} IN ({$sql})"; $stmt = $this->getConnection()->prepare($sql); - $stmt->execute(\array_values($ids)); - return \true; + $stmt->execute(array_values($ids)); + return true; } /** * {@inheritdoc} @@ -217,8 +237,8 @@ protected function doSave(array $values, $lifetime) $failed = []; foreach ($values as $id => $value) { try { - $serialized[$id] = \serialize($value); - } catch (\Exception $e) { + $serialized[$id] = serialize($value); + } catch (Exception $e) { $failed[] = $id; } } @@ -228,7 +248,7 @@ protected function doSave(array $values, $lifetime) $conn = $this->getConnection(); $driver = $this->driver; $insertSql = "INSERT INTO {$this->table} ({$this->idCol}, {$this->dataCol}, {$this->lifetimeCol}, {$this->timeCol}) VALUES (:id, :data, :lifetime, :time)"; - switch (\true) { + switch (true) { case 'mysql' === $driver: $sql = $insertSql . " ON DUPLICATE KEY UPDATE {$this->dataCol} = VALUES({$this->dataCol}), {$this->lifetimeCol} = VALUES({$this->lifetimeCol}), {$this->timeCol} = VALUES({$this->timeCol})"; break; @@ -236,15 +256,15 @@ protected function doSave(array $values, $lifetime) // DUAL is Oracle specific dummy table $sql = "MERGE INTO {$this->table} USING DUAL ON ({$this->idCol} = ?) " . "WHEN NOT MATCHED THEN INSERT ({$this->idCol}, {$this->dataCol}, {$this->lifetimeCol}, {$this->timeCol}) VALUES (?, ?, ?, ?) " . "WHEN MATCHED THEN UPDATE SET {$this->dataCol} = ?, {$this->lifetimeCol} = ?, {$this->timeCol} = ?"; break; - case 'sqlsrv' === $driver && \version_compare($this->getServerVersion(), '10', '>='): + case 'sqlsrv' === $driver && version_compare($this->getServerVersion(), '10', '>='): // MERGE is only available since SQL Server 2008 and must be terminated by semicolon // It also requires HOLDLOCK according to http://weblogs.sqlteam.com/dang/archive/2009/01/31/UPSERT-Race-Condition-With-MERGE.aspx $sql = "MERGE INTO {$this->table} WITH (HOLDLOCK) USING (SELECT 1 AS dummy) AS src ON ({$this->idCol} = ?) " . "WHEN NOT MATCHED THEN INSERT ({$this->idCol}, {$this->dataCol}, {$this->lifetimeCol}, {$this->timeCol}) VALUES (?, ?, ?, ?) " . "WHEN MATCHED THEN UPDATE SET {$this->dataCol} = ?, {$this->lifetimeCol} = ?, {$this->timeCol} = ?;"; break; case 'sqlite' === $driver: - $sql = 'INSERT OR REPLACE' . \substr($insertSql, 6); + $sql = 'INSERT OR REPLACE' . substr($insertSql, 6); break; - case 'pgsql' === $driver && \version_compare($this->getServerVersion(), '9.5', '>='): + case 'pgsql' === $driver && version_compare($this->getServerVersion(), '9.5', '>='): $sql = $insertSql . " ON CONFLICT ({$this->idCol}) DO UPDATE SET ({$this->dataCol}, {$this->lifetimeCol}, {$this->timeCol}) = (EXCLUDED.{$this->dataCol}, EXCLUDED.{$this->lifetimeCol}, EXCLUDED.{$this->timeCol})"; break; default: @@ -252,38 +272,38 @@ protected function doSave(array $values, $lifetime) $sql = "UPDATE {$this->table} SET {$this->dataCol} = :data, {$this->lifetimeCol} = :lifetime, {$this->timeCol} = :time WHERE {$this->idCol} = :id"; break; } - $now = \time(); + $now = time(); $lifetime = $lifetime ?: null; $stmt = $conn->prepare($sql); if ('sqlsrv' === $driver || 'oci' === $driver) { $stmt->bindParam(1, $id); $stmt->bindParam(2, $id); - $stmt->bindParam(3, $data, \PDO::PARAM_LOB); - $stmt->bindValue(4, $lifetime, \PDO::PARAM_INT); - $stmt->bindValue(5, $now, \PDO::PARAM_INT); - $stmt->bindParam(6, $data, \PDO::PARAM_LOB); - $stmt->bindValue(7, $lifetime, \PDO::PARAM_INT); - $stmt->bindValue(8, $now, \PDO::PARAM_INT); + $stmt->bindParam(3, $data, PDO::PARAM_LOB); + $stmt->bindValue(4, $lifetime, PDO::PARAM_INT); + $stmt->bindValue(5, $now, PDO::PARAM_INT); + $stmt->bindParam(6, $data, PDO::PARAM_LOB); + $stmt->bindValue(7, $lifetime, PDO::PARAM_INT); + $stmt->bindValue(8, $now, PDO::PARAM_INT); } else { $stmt->bindParam(':id', $id); - $stmt->bindParam(':data', $data, \PDO::PARAM_LOB); - $stmt->bindValue(':lifetime', $lifetime, \PDO::PARAM_INT); - $stmt->bindValue(':time', $now, \PDO::PARAM_INT); + $stmt->bindParam(':data', $data, PDO::PARAM_LOB); + $stmt->bindValue(':lifetime', $lifetime, PDO::PARAM_INT); + $stmt->bindValue(':time', $now, PDO::PARAM_INT); } if (null === $driver) { $insertStmt = $conn->prepare($insertSql); $insertStmt->bindParam(':id', $id); - $insertStmt->bindParam(':data', $data, \PDO::PARAM_LOB); - $insertStmt->bindValue(':lifetime', $lifetime, \PDO::PARAM_INT); - $insertStmt->bindValue(':time', $now, \PDO::PARAM_INT); + $insertStmt->bindParam(':data', $data, PDO::PARAM_LOB); + $insertStmt->bindValue(':lifetime', $lifetime, PDO::PARAM_INT); + $insertStmt->bindValue(':time', $now, PDO::PARAM_INT); } foreach ($serialized as $id => $data) { $stmt->execute(); if (null === $driver && !$stmt->rowCount()) { try { $insertStmt->execute(); - } catch (\_PhpScoper5ea00cc67502b\Doctrine\DBAL\DBALException $e) { - } catch (\PDOException $e) { + } catch (DBALException $e) { + } catch (PDOException $e) { // A concurrent write won, let it be } } @@ -291,17 +311,17 @@ protected function doSave(array $values, $lifetime) return $failed; } /** - * @return \PDO|Connection + * @return PDO|Connection */ private function getConnection() { if (null === $this->conn) { - $this->conn = new \PDO($this->dsn, $this->username, $this->password, $this->connectionOptions); - $this->conn->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); + $this->conn = new PDO($this->dsn, $this->username, $this->password, $this->connectionOptions); + $this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } if (null === $this->driver) { - if ($this->conn instanceof \PDO) { - $this->driver = $this->conn->getAttribute(\PDO::ATTR_DRIVER_NAME); + if ($this->conn instanceof PDO) { + $this->driver = $this->conn->getAttribute(PDO::ATTR_DRIVER_NAME); } else { switch ($this->driver = $this->conn->getDriver()->getName()) { case 'mysqli': @@ -333,10 +353,10 @@ private function getConnection() private function getServerVersion() { if (null === $this->serverVersion) { - $conn = $this->conn instanceof \PDO ? $this->conn : $this->conn->getWrappedConnection(); - if ($conn instanceof \PDO) { - $this->serverVersion = $conn->getAttribute(\PDO::ATTR_SERVER_VERSION); - } elseif ($conn instanceof \_PhpScoper5ea00cc67502b\Doctrine\DBAL\Driver\ServerInfoAwareConnection) { + $conn = $this->conn instanceof PDO ? $this->conn : $this->conn->getWrappedConnection(); + if ($conn instanceof PDO) { + $this->serverVersion = $conn->getAttribute(PDO::ATTR_SERVER_VERSION); + } elseif ($conn instanceof ServerInfoAwareConnection) { $this->serverVersion = $conn->getServerVersion(); } else { $this->serverVersion = '0'; diff --git a/vendor/symfony/cache/Traits/PhpArrayTrait.php b/vendor/symfony/cache/Traits/PhpArrayTrait.php index 314392b5b..d9be07853 100644 --- a/vendor/symfony/cache/Traits/PhpArrayTrait.php +++ b/vendor/symfony/cache/Traits/PhpArrayTrait.php @@ -12,6 +12,35 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException; +use Exception; +use function chmod; +use function dirname; +use function file_exists; +use function file_put_contents; +use function get_class; +use function gettype; +use function ini_set; +use function is_array; +use function is_dir; +use function is_file; +use function is_int; +use function is_object; +use function is_scalar; +use function is_string; +use function is_writable; +use function mkdir; +use function preg_match; +use function rename; +use function serialize; +use function sprintf; +use function str_replace; +use function strpos; +use function umask; +use function uniqid; +use function unlink; +use function unserialize; +use function var_export; + /** * @author Titouan Galopin * @author Nicolas Grekas @@ -32,20 +61,20 @@ trait PhpArrayTrait */ public function warmUp(array $values) { - if (\file_exists($this->file)) { - if (!\is_file($this->file)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache path exists and is not a file: "%s".', $this->file)); + if (file_exists($this->file)) { + if (!is_file($this->file)) { + throw new InvalidArgumentException(sprintf('Cache path exists and is not a file: "%s".', $this->file)); } - if (!\is_writable($this->file)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache file is not writable: "%s".', $this->file)); + if (!is_writable($this->file)) { + throw new InvalidArgumentException(sprintf('Cache file is not writable: "%s".', $this->file)); } } else { - $directory = \dirname($this->file); - if (!\is_dir($directory) && !@\mkdir($directory, 0777, \true)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache directory does not exist and cannot be created: "%s".', $directory)); + $directory = dirname($this->file); + if (!is_dir($directory) && !@mkdir($directory, 0777, true)) { + throw new InvalidArgumentException(sprintf('Cache directory does not exist and cannot be created: "%s".', $directory)); } - if (!\is_writable($directory)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache directory is not writable: "%s".', $directory)); + if (!is_writable($directory)) { + throw new InvalidArgumentException(sprintf('Cache directory is not writable: "%s".', $directory)); } } $dump = <<<'EOF' @@ -58,41 +87,41 @@ public function warmUp(array $values) EOF; foreach ($values as $key => $value) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::validateKey(\is_int($key) ? (string) $key : $key); - if (null === $value || \is_object($value)) { + CacheItem::validateKey(is_int($key) ? (string) $key : $key); + if (null === $value || is_object($value)) { try { - $value = \serialize($value); - } catch (\Exception $e) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache key "%s" has non-serializable "%s" value.', $key, \get_class($value)), 0, $e); + $value = serialize($value); + } catch (Exception $e) { + throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable "%s" value.', $key, get_class($value)), 0, $e); } - } elseif (\is_array($value)) { + } elseif (is_array($value)) { try { - $serialized = \serialize($value); - $unserialized = \unserialize($serialized); - } catch (\Exception $e) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache key "%s" has non-serializable array value.', $key), 0, $e); + $serialized = serialize($value); + $unserialized = unserialize($serialized); + } catch (Exception $e) { + throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable array value.', $key), 0, $e); } // Store arrays serialized if they contain any objects or references - if ($unserialized !== $value || \false !== \strpos($serialized, ';R:') && \preg_match('/;R:[1-9]/', $serialized)) { + if ($unserialized !== $value || false !== strpos($serialized, ';R:') && preg_match('/;R:[1-9]/', $serialized)) { $value = $serialized; } - } elseif (\is_string($value)) { + } elseif (is_string($value)) { // Serialize strings if they could be confused with serialized objects or arrays if ('N;' === $value || isset($value[2]) && ':' === $value[1]) { - $value = \serialize($value); + $value = serialize($value); } - } elseif (!\is_scalar($value)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache key "%s" has non-serializable "%s" value.', $key, \gettype($value))); + } elseif (!is_scalar($value)) { + throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable "%s" value.', $key, gettype($value))); } - $dump .= \var_export($key, \true) . ' => ' . \var_export($value, \true) . ",\n"; + $dump .= var_export($key, true) . ' => ' . var_export($value, true) . ",\n"; } $dump .= "\n];\n"; - $dump = \str_replace("' . \"\\0\" . '", "\0", $dump); - $tmpFile = \uniqid($this->file, \true); - \file_put_contents($tmpFile, $dump); - @\chmod($tmpFile, 0666 & ~\umask()); + $dump = str_replace("' . \"\\0\" . '", "\0", $dump); + $tmpFile = uniqid($this->file, true); + file_put_contents($tmpFile, $dump); + @chmod($tmpFile, 0666 & ~umask()); unset($serialized, $unserialized, $value, $dump); - @\rename($tmpFile, $this->file); + @rename($tmpFile, $this->file); unset(self::$valuesCache[$this->file]); $this->initialize(); } @@ -102,7 +131,7 @@ public function warmUp(array $values) public function clear() { $this->values = []; - $cleared = @\unlink($this->file) || !\file_exists($this->file); + $cleared = @unlink($this->file) || !file_exists($this->file); unset(self::$valuesCache[$this->file]); return $this->pool->clear() && $cleared; } @@ -116,13 +145,13 @@ private function initialize() return; } if ($this->zendDetectUnicode) { - $zmb = \ini_set('zend.detect_unicode', 0); + $zmb = ini_set('zend.detect_unicode', 0); } try { - $this->values = self::$valuesCache[$this->file] = \file_exists($this->file) ? include $this->file ?: [] : []; + $this->values = self::$valuesCache[$this->file] = file_exists($this->file) ? include $this->file ?: [] : []; } finally { if ($this->zendDetectUnicode) { - \ini_set('zend.detect_unicode', $zmb); + ini_set('zend.detect_unicode', $zmb); } } } diff --git a/vendor/symfony/cache/Traits/PhpFilesTrait.php b/vendor/symfony/cache/Traits/PhpFilesTrait.php index bbd2276a5..722463e11 100644 --- a/vendor/symfony/cache/Traits/PhpFilesTrait.php +++ b/vendor/symfony/cache/Traits/PhpFilesTrait.php @@ -12,6 +12,35 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\CacheException; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException; +use Exception; +use FilesystemIterator; +use RecursiveDirectoryIterator; +use RecursiveIteratorIterator; +use function file_exists; +use function filter_var; +use function function_exists; +use function gettype; +use function ini_get; +use function ini_set; +use function is_array; +use function is_object; +use function is_scalar; +use function is_string; +use function is_writable; +use function opcache_invalidate; +use function preg_match; +use function restore_error_handler; +use function serialize; +use function set_error_handler; +use function sprintf; +use function strpos; +use function time; +use function unlink; +use function var_export; +use const FILTER_VALIDATE_BOOLEAN; +use const PHP_INT_MAX; +use const PHP_SAPI; + /** * @author Piotr Stankowski * @author Nicolas Grekas @@ -26,29 +55,29 @@ trait PhpFilesTrait private $zendDetectUnicode; public static function isSupported() { - return \function_exists('opcache_invalidate') && \filter_var(\ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN); + return function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN); } /** * @return bool */ public function prune() { - $time = \time(); - $pruned = \true; - $allowCompile = 'cli' !== \PHP_SAPI || \filter_var(\ini_get('opcache.enable_cli'), \FILTER_VALIDATE_BOOLEAN); - \set_error_handler($this->includeHandler); + $time = time(); + $pruned = true; + $allowCompile = 'cli' !== PHP_SAPI || filter_var(ini_get('opcache.enable_cli'), FILTER_VALIDATE_BOOLEAN); + set_error_handler($this->includeHandler); try { - foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->directory, \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { - list($expiresAt) = (include $file); + foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->directory, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::LEAVES_ONLY) as $file) { + [$expiresAt] = (include $file); if ($time >= $expiresAt) { - $pruned = @\unlink($file) && !\file_exists($file) && $pruned; + $pruned = @unlink($file) && !file_exists($file) && $pruned; if ($allowCompile) { - @\opcache_invalidate($file, \true); + @opcache_invalidate($file, true); } } } } finally { - \restore_error_handler(); + restore_error_handler(); } return $pruned; } @@ -58,33 +87,33 @@ public function prune() protected function doFetch(array $ids) { $values = []; - $now = \time(); + $now = time(); if ($this->zendDetectUnicode) { - $zmb = \ini_set('zend.detect_unicode', 0); + $zmb = ini_set('zend.detect_unicode', 0); } - \set_error_handler($this->includeHandler); + set_error_handler($this->includeHandler); try { foreach ($ids as $id) { try { $file = $this->getFile($id); - list($expiresAt, $values[$id]) = (include $file); + [$expiresAt, $values[$id]] = (include $file); if ($now >= $expiresAt) { unset($values[$id]); } - } catch (\Exception $e) { + } catch (Exception $e) { continue; } } } finally { - \restore_error_handler(); + restore_error_handler(); if ($this->zendDetectUnicode) { - \ini_set('zend.detect_unicode', $zmb); + ini_set('zend.detect_unicode', $zmb); } } foreach ($values as $id => $value) { if ('N;' === $value) { $values[$id] = null; - } elseif (\is_string($value) && isset($value[2]) && ':' === $value[1]) { + } elseif (is_string($value) && isset($value[2]) && ':' === $value[1]) { $values[$id] = parent::unserialize($value); } } @@ -102,36 +131,36 @@ protected function doHave($id) */ protected function doSave(array $values, $lifetime) { - $ok = \true; - $data = [$lifetime ? \time() + $lifetime : \PHP_INT_MAX, '']; - $allowCompile = 'cli' !== \PHP_SAPI || \filter_var(\ini_get('opcache.enable_cli'), \FILTER_VALIDATE_BOOLEAN); + $ok = true; + $data = [$lifetime ? time() + $lifetime : PHP_INT_MAX, '']; + $allowCompile = 'cli' !== PHP_SAPI || filter_var(ini_get('opcache.enable_cli'), FILTER_VALIDATE_BOOLEAN); foreach ($values as $key => $value) { - if (null === $value || \is_object($value)) { - $value = \serialize($value); - } elseif (\is_array($value)) { - $serialized = \serialize($value); + if (null === $value || is_object($value)) { + $value = serialize($value); + } elseif (is_array($value)) { + $serialized = serialize($value); $unserialized = parent::unserialize($serialized); // Store arrays serialized if they contain any objects or references - if ($unserialized !== $value || \false !== \strpos($serialized, ';R:') && \preg_match('/;R:[1-9]/', $serialized)) { + if ($unserialized !== $value || false !== strpos($serialized, ';R:') && preg_match('/;R:[1-9]/', $serialized)) { $value = $serialized; } - } elseif (\is_string($value)) { + } elseif (is_string($value)) { // Serialize strings if they could be confused with serialized objects or arrays if ('N;' === $value || isset($value[2]) && ':' === $value[1]) { - $value = \serialize($value); + $value = serialize($value); } - } elseif (!\is_scalar($value)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Cache key "%s" has non-serializable "%s" value.', $key, \gettype($value))); + } elseif (!is_scalar($value)) { + throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable "%s" value.', $key, gettype($value))); } $data[1] = $value; - $file = $this->getFile($key, \true); - $ok = $this->write($file, 'getFile($key, true); + $ok = $this->write($file, 'directory)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\CacheException(\sprintf('Cache directory is not writable (%s).', $this->directory)); + if (!$ok && !is_writable($this->directory)) { + throw new CacheException(sprintf('Cache directory is not writable (%s).', $this->directory)); } return $ok; } diff --git a/vendor/symfony/cache/Traits/ProxyTrait.php b/vendor/symfony/cache/Traits/ProxyTrait.php index d11047857..08733b6a4 100644 --- a/vendor/symfony/cache/Traits/ProxyTrait.php +++ b/vendor/symfony/cache/Traits/ProxyTrait.php @@ -25,14 +25,14 @@ trait ProxyTrait */ public function prune() { - return $this->pool instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\PruneableInterface && $this->pool->prune(); + return $this->pool instanceof PruneableInterface && $this->pool->prune(); } /** * {@inheritdoc} */ public function reset() { - if ($this->pool instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\ResettableInterface) { + if ($this->pool instanceof ResettableInterface) { $this->pool->reset(); } } diff --git a/vendor/symfony/cache/Traits/RedisProxy.php b/vendor/symfony/cache/Traits/RedisProxy.php index 045e018bb..ef331a594 100644 --- a/vendor/symfony/cache/Traits/RedisProxy.php +++ b/vendor/symfony/cache/Traits/RedisProxy.php @@ -10,6 +10,10 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits; +use _PhpScoper5ea00cc67502b\Redis; +use Closure; +use function call_user_func_array; + /** * @author Nicolas Grekas * @@ -19,8 +23,8 @@ class RedisProxy { private $redis; private $initializer; - private $ready = \false; - public function __construct(\_PhpScoper5ea00cc67502b\Redis $redis, \Closure $initializer) + private $ready = false; + public function __construct(Redis $redis, Closure $initializer) { $this->redis = $redis; $this->initializer = $initializer; @@ -28,7 +32,7 @@ public function __construct(\_PhpScoper5ea00cc67502b\Redis $redis, \Closure $ini public function __call($method, array $args) { $this->ready ?: ($this->ready = $this->initializer->__invoke($this->redis)); - return \call_user_func_array([$this->redis, $method], $args); + return call_user_func_array([$this->redis, $method], $args); } public function hscan($strKey, &$iIterator, $strPattern = null, $iCount = null) { diff --git a/vendor/symfony/cache/Traits/RedisTrait.php b/vendor/symfony/cache/Traits/RedisTrait.php index 812929b34..dbd6c47b0 100644 --- a/vendor/symfony/cache/Traits/RedisTrait.php +++ b/vendor/symfony/cache/Traits/RedisTrait.php @@ -10,12 +10,43 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits; +use _PhpScoper5ea00cc67502b\Predis\Client; use _PhpScoper5ea00cc67502b\Predis\Connection\Aggregate\ClusterInterface; use _PhpScoper5ea00cc67502b\Predis\Connection\Aggregate\RedisCluster; use _PhpScoper5ea00cc67502b\Predis\Connection\Factory; use _PhpScoper5ea00cc67502b\Predis\Response\Status; +use _PhpScoper5ea00cc67502b\Redis; +use _PhpScoper5ea00cc67502b\RedisArray; +use _PhpScoper5ea00cc67502b\RedisException; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\CacheException; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException; +use Closure; +use Exception; +use Traversable; +use function array_combine; +use function call_user_func_array; +use function class_exists; +use function count; +use function extension_loaded; +use function get_class; +use function gettype; +use function is_a; +use function is_array; +use function is_object; +use function parse_str; +use function parse_url; +use function preg_match; +use function preg_replace; +use function preg_replace_callback; +use function restore_error_handler; +use function serialize; +use function set_error_handler; +use function sprintf; +use function strlen; +use function strpos; +use function substr; +use function version_compare; + /** * @author Aurimas Niekis * @author Nicolas Grekas @@ -24,7 +55,7 @@ */ trait RedisTrait { - private static $defaultConnectionOptions = ['class' => null, 'persistent' => 0, 'persistent_id' => null, 'timeout' => 30, 'read_timeout' => 0, 'retry_interval' => 0, 'lazy' => \false]; + private static $defaultConnectionOptions = ['class' => null, 'persistent' => 0, 'persistent_id' => null, 'timeout' => 30, 'read_timeout' => 0, 'retry_interval' => 0, 'lazy' => false]; private $redis; /** * @param \Redis|\RedisArray|\RedisCluster|\Predis\Client $redisClient @@ -32,11 +63,11 @@ trait RedisTrait private function init($redisClient, $namespace = '', $defaultLifetime = 0) { parent::__construct($namespace, $defaultLifetime); - if (\preg_match('#[^-+_.A-Za-z0-9]#', $namespace, $match)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('RedisAdapter namespace contains "%s" but only characters in [-+_.A-Za-z0-9] are allowed.', $match[0])); + if (preg_match('#[^-+_.A-Za-z0-9]#', $namespace, $match)) { + throw new InvalidArgumentException(sprintf('RedisAdapter namespace contains "%s" but only characters in [-+_.A-Za-z0-9] are allowed.', $match[0])); } - if (!$redisClient instanceof \_PhpScoper5ea00cc67502b\Redis && !$redisClient instanceof \_PhpScoper5ea00cc67502b\RedisArray && !$redisClient instanceof \_PhpScoper5ea00cc67502b\RedisCluster && !$redisClient instanceof \_PhpScoper5ea00cc67502b\Predis\Client && !$redisClient instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\RedisProxy) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('"%s()" expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\\Client, "%s" given.', __METHOD__, \is_object($redisClient) ? \get_class($redisClient) : \gettype($redisClient))); + if (!$redisClient instanceof Redis && !$redisClient instanceof RedisArray && !$redisClient instanceof \_PhpScoper5ea00cc67502b\RedisCluster && !$redisClient instanceof Client && !$redisClient instanceof RedisProxy) { + throw new InvalidArgumentException(sprintf('"%s()" expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\\Client, "%s" given.', __METHOD__, is_object($redisClient) ? get_class($redisClient) : gettype($redisClient))); } $this->redis = $redisClient; } @@ -59,24 +90,24 @@ private function init($redisClient, $namespace = '', $defaultLifetime = 0) */ public static function createConnection($dsn, array $options = []) { - if (0 !== \strpos($dsn, 'redis://')) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Invalid Redis DSN: "%s" does not start with "redis://".', $dsn)); + if (0 !== strpos($dsn, 'redis://')) { + throw new InvalidArgumentException(sprintf('Invalid Redis DSN: "%s" does not start with "redis://".', $dsn)); } - $params = \preg_replace_callback('#^redis://(?:(?:[^:@]*+:)?([^@]*+)@)?#', function ($m) use(&$auth) { + $params = preg_replace_callback('#^redis://(?:(?:[^:@]*+:)?([^@]*+)@)?#', function ($m) use(&$auth) { if (isset($m[1])) { $auth = $m[1]; } return 'file://'; }, $dsn); - if (\false === ($params = \parse_url($params))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Invalid Redis DSN: "%s".', $dsn)); + if (false === ($params = parse_url($params))) { + throw new InvalidArgumentException(sprintf('Invalid Redis DSN: "%s".', $dsn)); } if (!isset($params['host']) && !isset($params['path'])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Invalid Redis DSN: "%s".', $dsn)); + throw new InvalidArgumentException(sprintf('Invalid Redis DSN: "%s".', $dsn)); } - if (isset($params['path']) && \preg_match('#/(\\d+)$#', $params['path'], $m)) { + if (isset($params['path']) && preg_match('#/(\\d+)$#', $params['path'], $m)) { $params['dbindex'] = $m[1]; - $params['path'] = \substr($params['path'], 0, -\strlen($m[0])); + $params['path'] = substr($params['path'], 0, -strlen($m[0])); } if (isset($params['host'])) { $scheme = 'tcp'; @@ -85,52 +116,52 @@ public static function createConnection($dsn, array $options = []) } $params += ['host' => isset($params['host']) ? $params['host'] : $params['path'], 'port' => isset($params['host']) ? 6379 : null, 'dbindex' => 0]; if (isset($params['query'])) { - \parse_str($params['query'], $query); + parse_str($params['query'], $query); $params += $query; } $params += $options + self::$defaultConnectionOptions; - if (null === $params['class'] && !\extension_loaded('redis') && !\class_exists(\_PhpScoper5ea00cc67502b\Predis\Client::class)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\CacheException(\sprintf('Cannot find the "redis" extension, and "predis/predis" is not installed: "%s".', $dsn)); + if (null === $params['class'] && !extension_loaded('redis') && !class_exists(Client::class)) { + throw new CacheException(sprintf('Cannot find the "redis" extension, and "predis/predis" is not installed: "%s".', $dsn)); } - $class = null === $params['class'] ? \extension_loaded('redis') ? \_PhpScoper5ea00cc67502b\Redis::class : \_PhpScoper5ea00cc67502b\Predis\Client::class : $params['class']; - if (\is_a($class, \_PhpScoper5ea00cc67502b\Redis::class, \true)) { + $class = null === $params['class'] ? extension_loaded('redis') ? Redis::class : Client::class : $params['class']; + if (is_a($class, Redis::class, true)) { $connect = $params['persistent'] || $params['persistent_id'] ? 'pconnect' : 'connect'; $redis = new $class(); $initializer = function ($redis) use($connect, $params, $dsn, $auth) { try { @$redis->{$connect}($params['host'], $params['port'], $params['timeout'], $params['persistent_id'], $params['retry_interval']); - } catch (\_PhpScoper5ea00cc67502b\RedisException $e) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Redis connection failed (%s): "%s".', $e->getMessage(), $dsn)); + } catch (RedisException $e) { + throw new InvalidArgumentException(sprintf('Redis connection failed (%s): "%s".', $e->getMessage(), $dsn)); } - \set_error_handler(function ($type, $msg) use(&$error) { + set_error_handler(function ($type, $msg) use(&$error) { $error = $msg; }); $isConnected = $redis->isConnected(); - \restore_error_handler(); + restore_error_handler(); if (!$isConnected) { - $error = \preg_match('/^Redis::p?connect\\(\\): (.*)/', $error, $error) ? \sprintf(' (%s)', $error[1]) : ''; - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Redis connection failed%s: "%s".', $error, $dsn)); + $error = preg_match('/^Redis::p?connect\\(\\): (.*)/', $error, $error) ? sprintf(' (%s)', $error[1]) : ''; + throw new InvalidArgumentException(sprintf('Redis connection failed%s: "%s".', $error, $dsn)); } - if (null !== $auth && !$redis->auth($auth) || $params['dbindex'] && !$redis->select($params['dbindex']) || $params['read_timeout'] && !$redis->setOption(\_PhpScoper5ea00cc67502b\Redis::OPT_READ_TIMEOUT, $params['read_timeout'])) { - $e = \preg_replace('/^ERR /', '', $redis->getLastError()); - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Redis connection failed (%s): "%s".', $e, $dsn)); + if (null !== $auth && !$redis->auth($auth) || $params['dbindex'] && !$redis->select($params['dbindex']) || $params['read_timeout'] && !$redis->setOption(Redis::OPT_READ_TIMEOUT, $params['read_timeout'])) { + $e = preg_replace('/^ERR /', '', $redis->getLastError()); + throw new InvalidArgumentException(sprintf('Redis connection failed (%s): "%s".', $e, $dsn)); } - return \true; + return true; }; if ($params['lazy']) { - $redis = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Traits\RedisProxy($redis, $initializer); + $redis = new RedisProxy($redis, $initializer); } else { $initializer($redis); } - } elseif (\is_a($class, \_PhpScoper5ea00cc67502b\Predis\Client::class, \true)) { + } elseif (is_a($class, Client::class, true)) { $params['scheme'] = $scheme; $params['database'] = $params['dbindex'] ?: null; $params['password'] = $auth; - $redis = new $class((new \_PhpScoper5ea00cc67502b\Predis\Connection\Factory())->create($params)); - } elseif (\class_exists($class, \false)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('"%s" is not a subclass of "Redis" or "Predis\\Client".', $class)); + $redis = new $class((new Factory())->create($params)); + } elseif (class_exists($class, false)) { + throw new InvalidArgumentException(sprintf('"%s" is not a subclass of "Redis" or "Predis\\Client".', $class)); } else { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Exception\InvalidArgumentException(\sprintf('Class "%s" does not exist.', $class)); + throw new InvalidArgumentException(sprintf('Class "%s" does not exist.', $class)); } return $redis; } @@ -143,7 +174,7 @@ protected function doFetch(array $ids) return []; } $result = []; - if ($this->redis instanceof \_PhpScoper5ea00cc67502b\Predis\Client && $this->redis->getConnection() instanceof \_PhpScoper5ea00cc67502b\Predis\Connection\Aggregate\ClusterInterface) { + if ($this->redis instanceof Client && $this->redis->getConnection() instanceof ClusterInterface) { $values = $this->pipeline(function () use($ids) { foreach ($ids as $id) { (yield 'get' => [$id]); @@ -151,10 +182,10 @@ protected function doFetch(array $ids) }); } else { $values = $this->redis->mget($ids); - if (!\is_array($values) || \count($values) !== \count($ids)) { + if (!is_array($values) || count($values) !== count($ids)) { return []; } - $values = \array_combine($ids, $values); + $values = array_combine($ids, $values); } foreach ($values as $id => $v) { if ($v) { @@ -175,19 +206,19 @@ protected function doHave($id) */ protected function doClear($namespace) { - $cleared = \true; + $cleared = true; $hosts = [$this->redis]; $evalArgs = [[$namespace], 0]; - if ($this->redis instanceof \_PhpScoper5ea00cc67502b\Predis\Client) { + if ($this->redis instanceof Client) { $evalArgs = [0, $namespace]; $connection = $this->redis->getConnection(); - if ($connection instanceof \_PhpScoper5ea00cc67502b\Predis\Connection\Aggregate\ClusterInterface && $connection instanceof \Traversable) { + if ($connection instanceof ClusterInterface && $connection instanceof Traversable) { $hosts = []; foreach ($connection as $c) { - $hosts[] = new \_PhpScoper5ea00cc67502b\Predis\Client($c); + $hosts[] = new Client($c); } } - } elseif ($this->redis instanceof \_PhpScoper5ea00cc67502b\RedisArray) { + } elseif ($this->redis instanceof RedisArray) { $hosts = []; foreach ($this->redis->_hosts() as $host) { $hosts[] = $this->redis->_instance($host); @@ -195,7 +226,7 @@ protected function doClear($namespace) } elseif ($this->redis instanceof \_PhpScoper5ea00cc67502b\RedisCluster) { $hosts = []; foreach ($this->redis->_masters() as $host) { - $hosts[] = $h = new \_PhpScoper5ea00cc67502b\Redis(); + $hosts[] = $h = new Redis(); $h->connect($host[0], $host[1]); } } @@ -206,7 +237,7 @@ protected function doClear($namespace) } $info = $host->info('Server'); $info = isset($info['Server']) ? $info['Server'] : $info; - if (!\version_compare($info['redis_version'], '2.8', '>=')) { + if (!version_compare($info['redis_version'], '2.8', '>=')) { // As documented in Redis documentation (http://redis.io/commands/keys) using KEYS // can hang your server when it is executed against large databases (millions of items). // Whenever you hit this scale, you should really consider upgrading to Redis 2.8 or above. @@ -215,8 +246,8 @@ protected function doClear($namespace) } $cursor = null; do { - $keys = $host instanceof \_PhpScoper5ea00cc67502b\Predis\Client ? $host->scan($cursor, 'MATCH', $namespace . '*', 'COUNT', 1000) : $host->scan($cursor, $namespace . '*', 1000); - if (isset($keys[1]) && \is_array($keys[1])) { + $keys = $host instanceof Client ? $host->scan($cursor, 'MATCH', $namespace . '*', 'COUNT', 1000) : $host->scan($cursor, $namespace . '*', 1000); + if (isset($keys[1]) && is_array($keys[1])) { $cursor = $keys[0]; $keys = $keys[1]; } @@ -233,9 +264,9 @@ protected function doClear($namespace) protected function doDelete(array $ids) { if (!$ids) { - return \true; + return true; } - if ($this->redis instanceof \_PhpScoper5ea00cc67502b\Predis\Client && $this->redis->getConnection() instanceof \_PhpScoper5ea00cc67502b\Predis\Connection\Aggregate\ClusterInterface) { + if ($this->redis instanceof Client && $this->redis->getConnection() instanceof ClusterInterface) { $this->pipeline(function () use($ids) { foreach ($ids as $id) { (yield 'del' => [$id]); @@ -244,7 +275,7 @@ protected function doDelete(array $ids) } else { $this->redis->del($ids); } - return \true; + return true; } /** * {@inheritdoc} @@ -255,8 +286,8 @@ protected function doSave(array $values, $lifetime) $failed = []; foreach ($values as $id => $value) { try { - $serialized[$id] = \serialize($value); - } catch (\Exception $e) { + $serialized[$id] = serialize($value); + } catch (Exception $e) { $failed[] = $id; } } @@ -273,52 +304,52 @@ protected function doSave(array $values, $lifetime) } }); foreach ($results as $id => $result) { - if (\true !== $result && (!$result instanceof \_PhpScoper5ea00cc67502b\Predis\Response\Status || $result !== \_PhpScoper5ea00cc67502b\Predis\Response\Status::get('OK'))) { + if (true !== $result && (!$result instanceof Status || $result !== Status::get('OK'))) { $failed[] = $id; } } return $failed; } - private function pipeline(\Closure $generator) + private function pipeline(Closure $generator) { $ids = []; - if ($this->redis instanceof \_PhpScoper5ea00cc67502b\RedisCluster || $this->redis instanceof \_PhpScoper5ea00cc67502b\Predis\Client && $this->redis->getConnection() instanceof \_PhpScoper5ea00cc67502b\Predis\Connection\Aggregate\RedisCluster) { + if ($this->redis instanceof \_PhpScoper5ea00cc67502b\RedisCluster || $this->redis instanceof Client && $this->redis->getConnection() instanceof RedisCluster) { // phpredis & predis don't support pipelining with RedisCluster // see https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#pipelining // see https://github.com/nrk/predis/issues/267#issuecomment-123781423 $results = []; foreach ($generator() as $command => $args) { - $results[] = \call_user_func_array([$this->redis, $command], $args); + $results[] = call_user_func_array([$this->redis, $command], $args); $ids[] = $args[0]; } - } elseif ($this->redis instanceof \_PhpScoper5ea00cc67502b\Predis\Client) { + } elseif ($this->redis instanceof Client) { $results = $this->redis->pipeline(function ($redis) use($generator, &$ids) { foreach ($generator() as $command => $args) { - \call_user_func_array([$redis, $command], $args); + call_user_func_array([$redis, $command], $args); $ids[] = $args[0]; } }); - } elseif ($this->redis instanceof \_PhpScoper5ea00cc67502b\RedisArray) { + } elseif ($this->redis instanceof RedisArray) { $connections = $results = $ids = []; foreach ($generator() as $command => $args) { if (!isset($connections[$h = $this->redis->_target($args[0])])) { $connections[$h] = [$this->redis->_instance($h), -1]; - $connections[$h][0]->multi(\_PhpScoper5ea00cc67502b\Redis::PIPELINE); + $connections[$h][0]->multi(Redis::PIPELINE); } - \call_user_func_array([$connections[$h][0], $command], $args); + call_user_func_array([$connections[$h][0], $command], $args); $results[] = [$h, ++$connections[$h][1]]; $ids[] = $args[0]; } foreach ($connections as $h => $c) { $connections[$h] = $c[0]->exec(); } - foreach ($results as $k => list($h, $c)) { + foreach ($results as $k => [$h, $c]) { $results[$k] = $connections[$h][$c]; } } else { - $this->redis->multi(\_PhpScoper5ea00cc67502b\Redis::PIPELINE); + $this->redis->multi(Redis::PIPELINE); foreach ($generator() as $command => $args) { - \call_user_func_array([$this->redis, $command], $args); + call_user_func_array([$this->redis, $command], $args); $ids[] = $args[0]; } $results = $this->redis->exec(); diff --git a/vendor/symfony/cache/Traits/index.php b/vendor/symfony/cache/Traits/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/cache/Traits/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/cache/index.php b/vendor/symfony/cache/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/cache/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/config/ConfigCache.php b/vendor/symfony/config/ConfigCache.php index b02f637bc..59b29e295 100644 --- a/vendor/symfony/config/ConfigCache.php +++ b/vendor/symfony/config/ConfigCache.php @@ -11,6 +11,8 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Config; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\SelfCheckingResourceChecker; +use function is_file; + /** * ConfigCache caches arbitrary content in files on disk. * @@ -21,7 +23,7 @@ * @author Fabien Potencier * @author Matthias Pigulla */ -class ConfigCache extends \_PhpScoper5ea00cc67502b\Symfony\Component\Config\ResourceCheckerConfigCache +class ConfigCache extends ResourceCheckerConfigCache { private $debug; /** @@ -32,8 +34,8 @@ public function __construct($file, $debug) { $this->debug = (bool) $debug; $checkers = []; - if (\true === $this->debug) { - $checkers = [new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\SelfCheckingResourceChecker()]; + if (true === $this->debug) { + $checkers = [new SelfCheckingResourceChecker()]; } parent::__construct($file, $checkers); } @@ -47,8 +49,8 @@ public function __construct($file, $debug) */ public function isFresh() { - if (!$this->debug && \is_file($this->getPath())) { - return \true; + if (!$this->debug && is_file($this->getPath())) { + return true; } return parent::isFresh(); } diff --git a/vendor/symfony/config/ConfigCacheFactory.php b/vendor/symfony/config/ConfigCacheFactory.php index fed309378..1396eef53 100644 --- a/vendor/symfony/config/ConfigCacheFactory.php +++ b/vendor/symfony/config/ConfigCacheFactory.php @@ -10,6 +10,12 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Config; +use InvalidArgumentException; +use function call_user_func; +use function gettype; +use function is_callable; +use function sprintf; + /** * Basic implementation of ConfigCacheFactoryInterface that * creates an instance of the default ConfigCache. @@ -19,7 +25,7 @@ * * @author Matthias Pigulla */ -class ConfigCacheFactory implements \_PhpScoper5ea00cc67502b\Symfony\Component\Config\ConfigCacheFactoryInterface +class ConfigCacheFactory implements ConfigCacheFactoryInterface { private $debug; /** @@ -34,12 +40,12 @@ public function __construct($debug) */ public function cache($file, $callback) { - if (!\is_callable($callback)) { - throw new \InvalidArgumentException(\sprintf('Invalid type for callback argument. Expected callable, but got "%s".', \gettype($callback))); + if (!is_callable($callback)) { + throw new InvalidArgumentException(sprintf('Invalid type for callback argument. Expected callable, but got "%s".', gettype($callback))); } - $cache = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\ConfigCache($file, $this->debug); + $cache = new ConfigCache($file, $this->debug); if (!$cache->isFresh()) { - \call_user_func($callback, $cache); + call_user_func($callback, $cache); } return $cache; } diff --git a/vendor/symfony/config/ConfigCacheInterface.php b/vendor/symfony/config/ConfigCacheInterface.php index 61d5388b8..1433a1165 100644 --- a/vendor/symfony/config/ConfigCacheInterface.php +++ b/vendor/symfony/config/ConfigCacheInterface.php @@ -11,6 +11,8 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Config; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ResourceInterface; +use RuntimeException; + /** * Interface for ConfigCache. * @@ -39,7 +41,7 @@ public function isFresh(); * @param string $content The content to write into the cache * @param ResourceInterface[]|null $metadata An array of ResourceInterface instances * - * @throws \RuntimeException When the cache file cannot be written + * @throws RuntimeException When the cache file cannot be written */ public function write($content, array $metadata = null); } diff --git a/vendor/symfony/config/Definition/ArrayNode.php b/vendor/symfony/config/Definition/ArrayNode.php index 2bfe789c3..46c0c39b0 100644 --- a/vendor/symfony/config/Definition/ArrayNode.php +++ b/vendor/symfony/config/Definition/ArrayNode.php @@ -13,22 +13,38 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\InvalidTypeException; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\UnsetKeyException; +use InvalidArgumentException; +use RuntimeException; +use function array_key_exists; +use function array_keys; +use function count; +use function gettype; +use function implode; +use function is_array; +use function json_encode; +use function sprintf; +use function str_replace; +use function strlen; +use function strpos; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * Represents an Array node in the config tree. * * @author Johannes M. Schmitt */ -class ArrayNode extends \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\BaseNode implements \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\PrototypeNodeInterface +class ArrayNode extends BaseNode implements PrototypeNodeInterface { protected $xmlRemappings = []; protected $children = []; - protected $allowFalse = \false; - protected $allowNewKeys = \true; - protected $addIfNotSet = \false; - protected $performDeepMerging = \true; - protected $ignoreExtraKeys = \false; - protected $removeExtraKeys = \true; - protected $normalizeKeys = \true; + protected $allowFalse = false; + protected $allowNewKeys = true; + protected $addIfNotSet = false; + protected $performDeepMerging = true; + protected $ignoreExtraKeys = false; + protected $removeExtraKeys = true; + protected $normalizeKeys = true; public function setNormalizeKeys($normalizeKeys) { $this->normalizeKeys = (bool) $normalizeKeys; @@ -44,12 +60,12 @@ public function setNormalizeKeys($normalizeKeys) */ protected function preNormalize($value) { - if (!$this->normalizeKeys || !\is_array($value)) { + if (!$this->normalizeKeys || !is_array($value)) { return $value; } $normalized = []; foreach ($value as $k => $v) { - if (\false !== \strpos($k, '-') && \false === \strpos($k, '_') && !\array_key_exists($normalizedKey = \str_replace('-', '_', $k), $value)) { + if (false !== strpos($k, '-') && false === strpos($k, '_') && !array_key_exists($normalizedKey = str_replace('-', '_', $k), $value)) { $normalized[$normalizedKey] = $v; } else { $normalized[$k] = $v; @@ -127,7 +143,7 @@ public function setPerformDeepMerging($boolean) * @param bool $boolean To allow extra keys * @param bool $remove To remove extra keys */ - public function setIgnoreExtraKeys($boolean, $remove = \true) + public function setIgnoreExtraKeys($boolean, $remove = true) { $this->ignoreExtraKeys = (bool) $boolean; $this->removeExtraKeys = $this->ignoreExtraKeys && $remove; @@ -152,7 +168,7 @@ public function hasDefaultValue() public function getDefaultValue() { if (!$this->hasDefaultValue()) { - throw new \RuntimeException(\sprintf('The node at path "%s" has no default value.', $this->getPath())); + throw new RuntimeException(sprintf('The node at path "%s" has no default value.', $this->getPath())); } $defaults = []; foreach ($this->children as $name => $child) { @@ -165,17 +181,17 @@ public function getDefaultValue() /** * Adds a child node. * - * @throws \InvalidArgumentException when the child node has no name - * @throws \InvalidArgumentException when the child node's name is not unique + * @throws InvalidArgumentException when the child node has no name + * @throws InvalidArgumentException when the child node's name is not unique */ - public function addChild(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\NodeInterface $node) + public function addChild(NodeInterface $node) { $name = $node->getName(); - if (!\strlen($name)) { - throw new \InvalidArgumentException('Child nodes must be named.'); + if (!strlen($name)) { + throw new InvalidArgumentException('Child nodes must be named.'); } if (isset($this->children[$name])) { - throw new \InvalidArgumentException(\sprintf('A child node named "%s" already exists.', $name)); + throw new InvalidArgumentException(sprintf('A child node named "%s" already exists.', $name)); } $this->children[$name] = $node; } @@ -191,13 +207,13 @@ public function addChild(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Defin */ protected function finalizeValue($value) { - if (\false === $value) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\UnsetKeyException(\sprintf('Unsetting key for path "%s", value: "%s".', $this->getPath(), \json_encode($value))); + if (false === $value) { + throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: "%s".', $this->getPath(), json_encode($value))); } foreach ($this->children as $name => $child) { - if (!\array_key_exists($name, $value)) { + if (!array_key_exists($name, $value)) { if ($child->isRequired()) { - $ex = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException(\sprintf('The child node "%s" at path "%s" must be configured.', $name, $this->getPath())); + $ex = new InvalidConfigurationException(sprintf('The child node "%s" at path "%s" must be configured.', $name, $this->getPath())); $ex->setPath($this->getPath()); throw $ex; } @@ -207,11 +223,11 @@ protected function finalizeValue($value) continue; } if ($child->isDeprecated()) { - @\trigger_error($child->getDeprecationMessage($name, $this->getPath()), \E_USER_DEPRECATED); + @trigger_error($child->getDeprecationMessage($name, $this->getPath()), E_USER_DEPRECATED); } try { $value[$name] = $child->finalize($value[$name]); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\UnsetKeyException $e) { + } catch (UnsetKeyException $e) { unset($value[$name]); } } @@ -226,8 +242,8 @@ protected function finalizeValue($value) */ protected function validateType($value) { - if (!\is_array($value) && (!$this->allowFalse || \false !== $value)) { - $ex = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\InvalidTypeException(\sprintf('Invalid type for path "%s". Expected array, but got %s', $this->getPath(), \gettype($value))); + if (!is_array($value) && (!$this->allowFalse || false !== $value)) { + $ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected array, but got %s', $this->getPath(), gettype($value))); if ($hint = $this->getInfo()) { $ex->addHint($hint); } @@ -246,7 +262,7 @@ protected function validateType($value) */ protected function normalizeValue($value) { - if (\false === $value) { + if (false === $value) { return $value; } $value = $this->remapXml($value); @@ -255,7 +271,7 @@ protected function normalizeValue($value) if (isset($this->children[$name])) { try { $normalized[$name] = $this->children[$name]->normalize($val); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\UnsetKeyException $e) { + } catch (UnsetKeyException $e) { } unset($value[$name]); } elseif (!$this->removeExtraKeys) { @@ -263,8 +279,8 @@ protected function normalizeValue($value) } } // if extra fields are present, throw exception - if (\count($value) && !$this->ignoreExtraKeys) { - $ex = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException(\sprintf('Unrecognized option%s "%s" under "%s"', 1 === \count($value) ? '' : 's', \implode(', ', \array_keys($value)), $this->getPath())); + if (count($value) && !$this->ignoreExtraKeys) { + $ex = new InvalidConfigurationException(sprintf('Unrecognized option%s "%s" under "%s"', 1 === count($value) ? '' : 's', implode(', ', array_keys($value)), $this->getPath())); $ex->setPath($this->getPath()); throw $ex; } @@ -279,11 +295,11 @@ protected function normalizeValue($value) */ protected function remapXml($value) { - foreach ($this->xmlRemappings as list($singular, $plural)) { + foreach ($this->xmlRemappings as [$singular, $plural]) { if (!isset($value[$singular])) { continue; } - $value[$plural] = \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Processor::normalizeConfig($value, $singular, $plural); + $value[$plural] = Processor::normalizeConfig($value, $singular, $plural); unset($value[$singular]); } return $value; @@ -297,23 +313,23 @@ protected function remapXml($value) * @return mixed The merged values * * @throws InvalidConfigurationException - * @throws \RuntimeException + * @throws RuntimeException */ protected function mergeValues($leftSide, $rightSide) { - if (\false === $rightSide) { + if (false === $rightSide) { // if this is still false after the last config has been merged the // finalization pass will take care of removing this key entirely - return \false; + return false; } - if (\false === $leftSide || !$this->performDeepMerging) { + if (false === $leftSide || !$this->performDeepMerging) { return $rightSide; } foreach ($rightSide as $k => $v) { // no conflict - if (!\array_key_exists($k, $leftSide)) { + if (!array_key_exists($k, $leftSide)) { if (!$this->allowNewKeys) { - $ex = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException(\sprintf('You are not allowed to define new elements for path "%s". Please define all elements for this path in one config file. If you are trying to overwrite an element, make sure you redefine it with the same name.', $this->getPath())); + $ex = new InvalidConfigurationException(sprintf('You are not allowed to define new elements for path "%s". Please define all elements for this path in one config file. If you are trying to overwrite an element, make sure you redefine it with the same name.', $this->getPath())); $ex->setPath($this->getPath()); throw $ex; } @@ -321,7 +337,7 @@ protected function mergeValues($leftSide, $rightSide) continue; } if (!isset($this->children[$k])) { - throw new \RuntimeException('merge() expects a normalized config array.'); + throw new RuntimeException('merge() expects a normalized config array.'); } $leftSide[$k] = $this->children[$k]->merge($leftSide[$k], $v); } diff --git a/vendor/symfony/config/Definition/BaseNode.php b/vendor/symfony/config/Definition/BaseNode.php index fd662692e..00d63bf78 100644 --- a/vendor/symfony/config/Definition/BaseNode.php +++ b/vendor/symfony/config/Definition/BaseNode.php @@ -14,19 +14,25 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\ForbiddenOverwriteException; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\InvalidTypeException; +use Closure; +use InvalidArgumentException; +use function sprintf; +use function strpos; +use function strtr; + /** * The base node class. * * @author Johannes M. Schmitt */ -abstract class BaseNode implements \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\NodeInterface +abstract class BaseNode implements NodeInterface { protected $name; protected $parent; protected $normalizationClosures = []; protected $finalValidationClosures = []; - protected $allowOverwrite = \true; - protected $required = \false; + protected $allowOverwrite = true; + protected $required = false; protected $deprecationMessage = null; protected $equivalentValues = []; protected $attributes = []; @@ -34,12 +40,12 @@ abstract class BaseNode implements \_PhpScoper5ea00cc67502b\Symfony\Component\Co * @param string|null $name The name of the node * @param NodeInterface|null $parent The parent of this node * - * @throws \InvalidArgumentException if the name contains a period + * @throws InvalidArgumentException if the name contains a period */ - public function __construct($name, \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\NodeInterface $parent = null) + public function __construct($name, NodeInterface $parent = null) { - if (\false !== \strpos($name = (string) $name, '.')) { - throw new \InvalidArgumentException('The name must not contain ".".'); + if (false !== strpos($name = (string) $name, '.')) { + throw new InvalidArgumentException('The name must not contain ".".'); } $this->name = $name; $this->parent = $parent; @@ -166,7 +172,7 @@ public function setAllowOverwrite($allow) /** * Sets the closures used for normalization. * - * @param \Closure[] $closures An array of Closures used for normalization + * @param Closure[] $closures An array of Closures used for normalization */ public function setNormalizationClosures(array $closures) { @@ -175,7 +181,7 @@ public function setNormalizationClosures(array $closures) /** * Sets the closures used for final validation. * - * @param \Closure[] $closures An array of Closures used for final validation + * @param Closure[] $closures An array of Closures used for final validation */ public function setFinalValidationClosures(array $closures) { @@ -207,7 +213,7 @@ public function isDeprecated() */ public function getDeprecationMessage($node, $path) { - return \strtr($this->deprecationMessage, ['%node%' => $node, '%path%' => $path]); + return strtr($this->deprecationMessage, ['%node%' => $node, '%path%' => $path]); } /** * {@inheritdoc} @@ -233,7 +239,7 @@ public function getPath() public final function merge($leftSide, $rightSide) { if (!$this->allowOverwrite) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\ForbiddenOverwriteException(\sprintf('Configuration path "%s" cannot be overwritten. You have to define all options for this path, and any of its sub-paths in one configuration section.', $this->getPath())); + throw new ForbiddenOverwriteException(sprintf('Configuration path "%s" cannot be overwritten. You have to define all options for this path, and any of its sub-paths in one configuration section.', $this->getPath())); } $this->validateType($leftSide); $this->validateType($rightSide); @@ -292,10 +298,10 @@ public final function finalize($value) foreach ($this->finalValidationClosures as $closure) { try { $value = $closure($value); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\Exception $e) { + } catch (Exception $e) { throw $e; } catch (\Exception $e) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException(\sprintf('Invalid configuration for path "%s": %s.', $this->getPath(), $e->getMessage()), $e->getCode(), $e); + throw new InvalidConfigurationException(sprintf('Invalid configuration for path "%s": %s.', $this->getPath(), $e->getMessage()), $e->getCode(), $e); } } return $value; diff --git a/vendor/symfony/config/Definition/BooleanNode.php b/vendor/symfony/config/Definition/BooleanNode.php index 151a338ed..9b911fd77 100644 --- a/vendor/symfony/config/Definition/BooleanNode.php +++ b/vendor/symfony/config/Definition/BooleanNode.php @@ -11,20 +11,24 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\InvalidTypeException; +use function gettype; +use function is_bool; +use function sprintf; + /** * This node represents a Boolean value in the config tree. * * @author Johannes M. Schmitt */ -class BooleanNode extends \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ScalarNode +class BooleanNode extends ScalarNode { /** * {@inheritdoc} */ protected function validateType($value) { - if (!\is_bool($value)) { - $ex = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\InvalidTypeException(\sprintf('Invalid type for path "%s". Expected boolean, but got %s.', $this->getPath(), \gettype($value))); + if (!is_bool($value)) { + $ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected boolean, but got %s.', $this->getPath(), gettype($value))); if ($hint = $this->getInfo()) { $ex->addHint($hint); } @@ -38,6 +42,6 @@ protected function validateType($value) protected function isValueEmpty($value) { // a boolean value cannot be empty - return \false; + return false; } } diff --git a/vendor/symfony/config/Definition/Builder/ArrayNodeDefinition.php b/vendor/symfony/config/Definition/Builder/ArrayNodeDefinition.php index 145d615b2..4793a8e2b 100644 --- a/vendor/symfony/config/Definition/Builder/ArrayNodeDefinition.php +++ b/vendor/symfony/config/Definition/Builder/ArrayNodeDefinition.php @@ -13,30 +13,37 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ArrayNode; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\InvalidDefinitionException; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\PrototypedArrayNode; +use function is_array; +use function is_int; +use function is_string; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class provides a fluent interface for defining an array node. * * @author Johannes M. Schmitt */ -class ArrayNodeDefinition extends \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NodeDefinition implements \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\ParentNodeDefinitionInterface +class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinitionInterface { - protected $performDeepMerging = \true; - protected $ignoreExtraKeys = \false; - protected $removeExtraKeys = \true; + protected $performDeepMerging = true; + protected $ignoreExtraKeys = false; + protected $removeExtraKeys = true; protected $children = []; protected $prototype; - protected $atLeastOne = \false; - protected $allowNewKeys = \true; + protected $atLeastOne = false; + protected $allowNewKeys = true; protected $key; protected $removeKeyItem; - protected $addDefaults = \false; - protected $addDefaultChildren = \false; + protected $addDefaults = false; + protected $addDefaultChildren = false; protected $nodeBuilder; - protected $normalizeKeys = \true; + protected $normalizeKeys = true; /** * {@inheritdoc} */ - public function __construct($name, \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NodeParentInterface $parent = null) + public function __construct($name, NodeParentInterface $parent = null) { parent::__construct($name, $parent); $this->nullEquivalent = []; @@ -45,7 +52,7 @@ public function __construct($name, \_PhpScoper5ea00cc67502b\Symfony\Component\Co /** * {@inheritdoc} */ - public function setBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NodeBuilder $builder) + public function setBuilder(NodeBuilder $builder) { $this->nodeBuilder = $builder; } @@ -127,7 +134,7 @@ public function enumPrototype() */ public function addDefaultsIfNotSet() { - $this->addDefaults = \true; + $this->addDefaults = true; return $this; } /** @@ -153,7 +160,7 @@ public function addDefaultChildrenIfNoneSet($children = null) */ public function requiresAtLeastOneElement() { - $this->atLeastOne = \true; + $this->atLeastOne = true; return $this; } /** @@ -165,7 +172,7 @@ public function requiresAtLeastOneElement() */ public function disallowNewKeysInSubsequentConfigs() { - $this->allowNewKeys = \false; + $this->allowNewKeys = false; return $this; } /** @@ -209,7 +216,7 @@ public function fixXmlConfig($singular, $plural = null) * * @return $this */ - public function useAttributeAsKey($name, $removeKeyItem = \true) + public function useAttributeAsKey($name, $removeKeyItem = true) { $this->key = $name; $this->removeKeyItem = $removeKeyItem; @@ -222,7 +229,7 @@ public function useAttributeAsKey($name, $removeKeyItem = \true) * * @return $this */ - public function canBeUnset($allow = \true) + public function canBeUnset($allow = true) { $this->merge()->allowUnset($allow); return $this; @@ -244,8 +251,8 @@ public function canBeUnset($allow = \true) */ public function canBeEnabled() { - $this->addDefaultsIfNotSet()->treatFalseLike(['enabled' => \false])->treatTrueLike(['enabled' => \true])->treatNullLike(['enabled' => \true])->beforeNormalization()->ifArray()->then(function ($v) { - $v['enabled'] = isset($v['enabled']) ? $v['enabled'] : \true; + $this->addDefaultsIfNotSet()->treatFalseLike(['enabled' => false])->treatTrueLike(['enabled' => true])->treatNullLike(['enabled' => true])->beforeNormalization()->ifArray()->then(function ($v) { + $v['enabled'] = isset($v['enabled']) ? $v['enabled'] : true; return $v; })->end()->children()->booleanNode('enabled')->defaultFalse(); return $this; @@ -259,7 +266,7 @@ public function canBeEnabled() */ public function canBeDisabled() { - $this->addDefaultsIfNotSet()->treatFalseLike(['enabled' => \false])->treatTrueLike(['enabled' => \true])->treatNullLike(['enabled' => \true])->children()->booleanNode('enabled')->defaultTrue(); + $this->addDefaultsIfNotSet()->treatFalseLike(['enabled' => false])->treatTrueLike(['enabled' => true])->treatNullLike(['enabled' => true])->children()->booleanNode('enabled')->defaultTrue(); return $this; } /** @@ -269,7 +276,7 @@ public function canBeDisabled() */ public function performNoDeepMerging() { - $this->performDeepMerging = \false; + $this->performDeepMerging = false; return $this; } /** @@ -285,9 +292,9 @@ public function performNoDeepMerging() * * @return $this */ - public function ignoreExtraKeys($remove = \true) + public function ignoreExtraKeys($remove = true) { - $this->ignoreExtraKeys = \true; + $this->ignoreExtraKeys = true; $this->removeExtraKeys = $remove; return $this; } @@ -306,7 +313,7 @@ public function normalizeKeys($bool) /** * {@inheritdoc} */ - public function append(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NodeDefinition $node) + public function append(NodeDefinition $node) { $this->children[$node->name] = $node->setParent($this); return $this; @@ -319,7 +326,7 @@ public function append(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definit protected function getNodeBuilder() { if (null === $this->nodeBuilder) { - $this->nodeBuilder = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NodeBuilder(); + $this->nodeBuilder = new NodeBuilder(); } return $this->nodeBuilder->setParent($this); } @@ -329,7 +336,7 @@ protected function getNodeBuilder() protected function createNode() { if (null === $this->prototype) { - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ArrayNode($this->name, $this->parent); + $node = new ArrayNode($this->name, $this->parent); $this->validateConcreteNode($node); $node->setAddIfNotSet($this->addDefaults); foreach ($this->children as $child) { @@ -337,21 +344,21 @@ protected function createNode() $node->addChild($child->getNode()); } } else { - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\PrototypedArrayNode($this->name, $this->parent); + $node = new PrototypedArrayNode($this->name, $this->parent); $this->validatePrototypeNode($node); if (null !== $this->key) { $node->setKeyAttribute($this->key, $this->removeKeyItem); } - if (\false === $this->allowEmptyValue) { - @\trigger_error(\sprintf('Using %s::cannotBeEmpty() at path "%s" has no effect, consider requiresAtLeastOneElement() instead. In 4.0 both methods will behave the same.', __CLASS__, $node->getPath()), \E_USER_DEPRECATED); + if (false === $this->allowEmptyValue) { + @trigger_error(sprintf('Using %s::cannotBeEmpty() at path "%s" has no effect, consider requiresAtLeastOneElement() instead. In 4.0 both methods will behave the same.', __CLASS__, $node->getPath()), E_USER_DEPRECATED); } - if (\true === $this->atLeastOne) { + if (true === $this->atLeastOne) { $node->setMinNumberOfElements(1); } if ($this->default) { $node->setDefaultValue($this->defaultValue); } - if (\false !== $this->addDefaultChildren) { + if (false !== $this->addDefaultChildren) { $node->setAddChildrenIfNoneSet($this->addDefaultChildren); if ($this->prototype instanceof static && null === $this->prototype->prototype) { $this->prototype->addDefaultsIfNotSet(); @@ -362,8 +369,8 @@ protected function createNode() } $node->setAllowNewKeys($this->allowNewKeys); $node->addEquivalentValue(null, $this->nullEquivalent); - $node->addEquivalentValue(\true, $this->trueEquivalent); - $node->addEquivalentValue(\false, $this->falseEquivalent); + $node->addEquivalentValue(true, $this->trueEquivalent); + $node->addEquivalentValue(false, $this->falseEquivalent); $node->setPerformDeepMerging($this->performDeepMerging); $node->setRequired($this->required); $node->setDeprecated($this->deprecationMessage); @@ -387,23 +394,23 @@ protected function createNode() * * @throws InvalidDefinitionException */ - protected function validateConcreteNode(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ArrayNode $node) + protected function validateConcreteNode(ArrayNode $node) { $path = $node->getPath(); if (null !== $this->key) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\InvalidDefinitionException(\sprintf('->useAttributeAsKey() is not applicable to concrete nodes at path "%s".', $path)); + throw new InvalidDefinitionException(sprintf('->useAttributeAsKey() is not applicable to concrete nodes at path "%s".', $path)); } - if (\false === $this->allowEmptyValue) { - @\trigger_error(\sprintf('->cannotBeEmpty() is not applicable to concrete nodes at path "%s". In 4.0 it will throw an exception.', $path), \E_USER_DEPRECATED); + if (false === $this->allowEmptyValue) { + @trigger_error(sprintf('->cannotBeEmpty() is not applicable to concrete nodes at path "%s". In 4.0 it will throw an exception.', $path), E_USER_DEPRECATED); } - if (\true === $this->atLeastOne) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\InvalidDefinitionException(\sprintf('->requiresAtLeastOneElement() is not applicable to concrete nodes at path "%s".', $path)); + if (true === $this->atLeastOne) { + throw new InvalidDefinitionException(sprintf('->requiresAtLeastOneElement() is not applicable to concrete nodes at path "%s".', $path)); } if ($this->default) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\InvalidDefinitionException(\sprintf('->defaultValue() is not applicable to concrete nodes at path "%s".', $path)); + throw new InvalidDefinitionException(sprintf('->defaultValue() is not applicable to concrete nodes at path "%s".', $path)); } - if (\false !== $this->addDefaultChildren) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\InvalidDefinitionException(\sprintf('->addDefaultChildrenIfNoneSet() is not applicable to concrete nodes at path "%s".', $path)); + if (false !== $this->addDefaultChildren) { + throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() is not applicable to concrete nodes at path "%s".', $path)); } } /** @@ -411,21 +418,21 @@ protected function validateConcreteNode(\_PhpScoper5ea00cc67502b\Symfony\Compone * * @throws InvalidDefinitionException */ - protected function validatePrototypeNode(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\PrototypedArrayNode $node) + protected function validatePrototypeNode(PrototypedArrayNode $node) { $path = $node->getPath(); if ($this->addDefaults) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\InvalidDefinitionException(\sprintf('->addDefaultsIfNotSet() is not applicable to prototype nodes at path "%s".', $path)); + throw new InvalidDefinitionException(sprintf('->addDefaultsIfNotSet() is not applicable to prototype nodes at path "%s".', $path)); } - if (\false !== $this->addDefaultChildren) { + if (false !== $this->addDefaultChildren) { if ($this->default) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\InvalidDefinitionException(\sprintf('A default value and default children might not be used together at path "%s".', $path)); + throw new InvalidDefinitionException(sprintf('A default value and default children might not be used together at path "%s".', $path)); } - if (null !== $this->key && (null === $this->addDefaultChildren || \is_int($this->addDefaultChildren) && $this->addDefaultChildren > 0)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\InvalidDefinitionException(\sprintf('->addDefaultChildrenIfNoneSet() should set default children names as ->useAttributeAsKey() is used at path "%s".', $path)); + if (null !== $this->key && (null === $this->addDefaultChildren || is_int($this->addDefaultChildren) && $this->addDefaultChildren > 0)) { + throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() should set default children names as ->useAttributeAsKey() is used at path "%s".', $path)); } - if (null === $this->key && (\is_string($this->addDefaultChildren) || \is_array($this->addDefaultChildren))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\InvalidDefinitionException(\sprintf('->addDefaultChildrenIfNoneSet() might not set default children names as ->useAttributeAsKey() is not used at path "%s".', $path)); + if (null === $this->key && (is_string($this->addDefaultChildren) || is_array($this->addDefaultChildren))) { + throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() might not set default children names as ->useAttributeAsKey() is not used at path "%s".', $path)); } } } diff --git a/vendor/symfony/config/Definition/Builder/BooleanNodeDefinition.php b/vendor/symfony/config/Definition/Builder/BooleanNodeDefinition.php index 0ff95f86f..410087918 100644 --- a/vendor/symfony/config/Definition/Builder/BooleanNodeDefinition.php +++ b/vendor/symfony/config/Definition/Builder/BooleanNodeDefinition.php @@ -17,15 +17,15 @@ * * @author Johannes M. Schmitt */ -class BooleanNodeDefinition extends \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition +class BooleanNodeDefinition extends ScalarNodeDefinition { /** * {@inheritdoc} */ - public function __construct($name, \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NodeParentInterface $parent = null) + public function __construct($name, NodeParentInterface $parent = null) { parent::__construct($name, $parent); - $this->nullEquivalent = \true; + $this->nullEquivalent = true; } /** * Instantiate a Node. @@ -34,7 +34,7 @@ public function __construct($name, \_PhpScoper5ea00cc67502b\Symfony\Component\Co */ protected function instantiateNode() { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\BooleanNode($this->name, $this->parent); + return new BooleanNode($this->name, $this->parent); } /** * {@inheritdoc} @@ -43,6 +43,6 @@ protected function instantiateNode() */ public function cannotBeEmpty() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\InvalidDefinitionException('->cannotBeEmpty() is not applicable to BooleanNodeDefinition.'); + throw new InvalidDefinitionException('->cannotBeEmpty() is not applicable to BooleanNodeDefinition.'); } } diff --git a/vendor/symfony/config/Definition/Builder/EnumNodeDefinition.php b/vendor/symfony/config/Definition/Builder/EnumNodeDefinition.php index eda74aeef..c988a52fe 100644 --- a/vendor/symfony/config/Definition/Builder/EnumNodeDefinition.php +++ b/vendor/symfony/config/Definition/Builder/EnumNodeDefinition.php @@ -11,12 +11,16 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\EnumNode; +use InvalidArgumentException; +use RuntimeException; +use function array_unique; + /** * Enum Node Definition. * * @author Johannes M. Schmitt */ -class EnumNodeDefinition extends \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition +class EnumNodeDefinition extends ScalarNodeDefinition { private $values; /** @@ -24,9 +28,9 @@ class EnumNodeDefinition extends \_PhpScoper5ea00cc67502b\Symfony\Component\Conf */ public function values(array $values) { - $values = \array_unique($values); + $values = array_unique($values); if (empty($values)) { - throw new \InvalidArgumentException('->values() must be called with at least one value.'); + throw new InvalidArgumentException('->values() must be called with at least one value.'); } $this->values = $values; return $this; @@ -36,13 +40,13 @@ public function values(array $values) * * @return EnumNode The node * - * @throws \RuntimeException + * @throws RuntimeException */ protected function instantiateNode() { if (null === $this->values) { - throw new \RuntimeException('You must call ->values() on enum nodes.'); + throw new RuntimeException('You must call ->values() on enum nodes.'); } - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\EnumNode($this->name, $this->parent, $this->values); + return new EnumNode($this->name, $this->parent, $this->values); } } diff --git a/vendor/symfony/config/Definition/Builder/ExprBuilder.php b/vendor/symfony/config/Definition/Builder/ExprBuilder.php index 5805e193a..cdd633460 100644 --- a/vendor/symfony/config/Definition/Builder/ExprBuilder.php +++ b/vendor/symfony/config/Definition/Builder/ExprBuilder.php @@ -11,6 +11,15 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\UnsetKeyException; +use Closure; +use InvalidArgumentException; +use RuntimeException; +use function in_array; +use function is_array; +use function is_string; +use function json_encode; +use function sprintf; + /** * This class builds an if expression. * @@ -22,7 +31,7 @@ class ExprBuilder protected $node; public $ifPart; public $thenPart; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NodeDefinition $node) + public function __construct(NodeDefinition $node) { $this->node = $node; } @@ -31,10 +40,10 @@ public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\De * * @return $this */ - public function always(\Closure $then = null) + public function always(Closure $then = null) { $this->ifPart = function ($v) { - return \true; + return true; }; if (null !== $then) { $this->thenPart = $then; @@ -48,11 +57,11 @@ public function always(\Closure $then = null) * * @return $this */ - public function ifTrue(\Closure $closure = null) + public function ifTrue(Closure $closure = null) { if (null === $closure) { $closure = function ($v) { - return \true === $v; + return true === $v; }; } $this->ifPart = $closure; @@ -66,7 +75,7 @@ public function ifTrue(\Closure $closure = null) public function ifString() { $this->ifPart = function ($v) { - return \is_string($v); + return is_string($v); }; return $this; } @@ -102,7 +111,7 @@ public function ifEmpty() public function ifArray() { $this->ifPart = function ($v) { - return \is_array($v); + return is_array($v); }; return $this; } @@ -114,7 +123,7 @@ public function ifArray() public function ifInArray(array $array) { $this->ifPart = function ($v) use($array) { - return \in_array($v, $array, \true); + return in_array($v, $array, true); }; return $this; } @@ -126,7 +135,7 @@ public function ifInArray(array $array) public function ifNotInArray(array $array) { $this->ifPart = function ($v) use($array) { - return !\in_array($v, $array, \true); + return !in_array($v, $array, true); }; return $this; } @@ -138,7 +147,7 @@ public function ifNotInArray(array $array) public function castToArray() { $this->ifPart = function ($v) { - return !\is_array($v); + return !is_array($v); }; $this->thenPart = function ($v) { return [$v]; @@ -150,7 +159,7 @@ public function castToArray() * * @return $this */ - public function then(\Closure $closure) + public function then(Closure $closure) { $this->thenPart = $closure; return $this; @@ -176,12 +185,12 @@ public function thenEmptyArray() * * @return $this * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException */ public function thenInvalid($message) { $this->thenPart = function ($v) use($message) { - throw new \InvalidArgumentException(\sprintf($message, \json_encode($v))); + throw new InvalidArgumentException(sprintf($message, json_encode($v))); }; return $this; } @@ -195,7 +204,7 @@ public function thenInvalid($message) public function thenUnset() { $this->thenPart = function ($v) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\UnsetKeyException('Unsetting key.'); + throw new UnsetKeyException('Unsetting key.'); }; return $this; } @@ -204,15 +213,15 @@ public function thenUnset() * * @return NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition * - * @throws \RuntimeException + * @throws RuntimeException */ public function end() { if (null === $this->ifPart) { - throw new \RuntimeException('You must specify an if part.'); + throw new RuntimeException('You must specify an if part.'); } if (null === $this->thenPart) { - throw new \RuntimeException('You must specify a then part.'); + throw new RuntimeException('You must specify a then part.'); } return $this->node; } diff --git a/vendor/symfony/config/Definition/Builder/FloatNodeDefinition.php b/vendor/symfony/config/Definition/Builder/FloatNodeDefinition.php index cddf14843..220cbef0c 100644 --- a/vendor/symfony/config/Definition/Builder/FloatNodeDefinition.php +++ b/vendor/symfony/config/Definition/Builder/FloatNodeDefinition.php @@ -16,7 +16,7 @@ * * @author Jeanmonod David */ -class FloatNodeDefinition extends \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NumericNodeDefinition +class FloatNodeDefinition extends NumericNodeDefinition { /** * Instantiates a Node. @@ -25,6 +25,6 @@ class FloatNodeDefinition extends \_PhpScoper5ea00cc67502b\Symfony\Component\Con */ protected function instantiateNode() { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\FloatNode($this->name, $this->parent, $this->min, $this->max); + return new FloatNode($this->name, $this->parent, $this->min, $this->max); } } diff --git a/vendor/symfony/config/Definition/Builder/IntegerNodeDefinition.php b/vendor/symfony/config/Definition/Builder/IntegerNodeDefinition.php index 06591249d..5dbe5f7de 100644 --- a/vendor/symfony/config/Definition/Builder/IntegerNodeDefinition.php +++ b/vendor/symfony/config/Definition/Builder/IntegerNodeDefinition.php @@ -16,7 +16,7 @@ * * @author Jeanmonod David */ -class IntegerNodeDefinition extends \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NumericNodeDefinition +class IntegerNodeDefinition extends NumericNodeDefinition { /** * Instantiates a Node. @@ -25,6 +25,6 @@ class IntegerNodeDefinition extends \_PhpScoper5ea00cc67502b\Symfony\Component\C */ protected function instantiateNode() { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\IntegerNode($this->name, $this->parent, $this->min, $this->max); + return new IntegerNode($this->name, $this->parent, $this->min, $this->max); } } diff --git a/vendor/symfony/config/Definition/Builder/MergeBuilder.php b/vendor/symfony/config/Definition/Builder/MergeBuilder.php index 6c2623163..6b958cdb9 100644 --- a/vendor/symfony/config/Definition/Builder/MergeBuilder.php +++ b/vendor/symfony/config/Definition/Builder/MergeBuilder.php @@ -18,9 +18,9 @@ class MergeBuilder { protected $node; - public $allowFalse = \false; - public $allowOverwrite = \true; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NodeDefinition $node) + public $allowFalse = false; + public $allowOverwrite = true; + public function __construct(NodeDefinition $node) { $this->node = $node; } @@ -31,7 +31,7 @@ public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\De * * @return $this */ - public function allowUnset($allow = \true) + public function allowUnset($allow = true) { $this->allowFalse = $allow; return $this; @@ -43,7 +43,7 @@ public function allowUnset($allow = \true) * * @return $this */ - public function denyOverwrite($deny = \true) + public function denyOverwrite($deny = true) { $this->allowOverwrite = !$deny; return $this; diff --git a/vendor/symfony/config/Definition/Builder/NodeBuilder.php b/vendor/symfony/config/Definition/Builder/NodeBuilder.php index c5cfa11c1..449688fb9 100644 --- a/vendor/symfony/config/Definition/Builder/NodeBuilder.php +++ b/vendor/symfony/config/Definition/Builder/NodeBuilder.php @@ -10,25 +10,30 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder; +use RuntimeException; +use function class_exists; +use function sprintf; +use function strtolower; + /** * This class provides a fluent interface for building a node. * * @author Johannes M. Schmitt */ -class NodeBuilder implements \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NodeParentInterface +class NodeBuilder implements NodeParentInterface { protected $parent; protected $nodeMapping; public function __construct() { - $this->nodeMapping = ['variable' => \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\VariableNodeDefinition::class, 'scalar' => \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition::class, 'boolean' => \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\BooleanNodeDefinition::class, 'integer' => \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition::class, 'float' => \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\FloatNodeDefinition::class, 'array' => \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition::class, 'enum' => \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\EnumNodeDefinition::class]; + $this->nodeMapping = ['variable' => VariableNodeDefinition::class, 'scalar' => ScalarNodeDefinition::class, 'boolean' => BooleanNodeDefinition::class, 'integer' => IntegerNodeDefinition::class, 'float' => FloatNodeDefinition::class, 'array' => ArrayNodeDefinition::class, 'enum' => EnumNodeDefinition::class]; } /** * Set the parent node. * * @return $this */ - public function setParent(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\ParentNodeDefinitionInterface $parent = null) + public function setParent(ParentNodeDefinitionInterface $parent = null) { $this->parent = $parent; return $this; @@ -127,8 +132,8 @@ public function end() * * @return NodeDefinition The child node * - * @throws \RuntimeException When the node type is not registered - * @throws \RuntimeException When the node class is not found + * @throws RuntimeException When the node type is not registered + * @throws RuntimeException When the node class is not found */ public function node($name, $type) { @@ -152,9 +157,9 @@ public function node($name, $type) * * @return $this */ - public function append(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NodeDefinition $node) + public function append(NodeDefinition $node) { - if ($node instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\ParentNodeDefinitionInterface) { + if ($node instanceof ParentNodeDefinitionInterface) { $builder = clone $this; $builder->setParent(null); $node->setBuilder($builder); @@ -176,7 +181,7 @@ public function append(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definit */ public function setNodeClass($type, $class) { - $this->nodeMapping[\strtolower($type)] = $class; + $this->nodeMapping[strtolower($type)] = $class; return $this; } /** @@ -186,18 +191,18 @@ public function setNodeClass($type, $class) * * @return string The node definition class name * - * @throws \RuntimeException When the node type is not registered - * @throws \RuntimeException When the node class is not found + * @throws RuntimeException When the node type is not registered + * @throws RuntimeException When the node class is not found */ protected function getNodeClass($type) { - $type = \strtolower($type); + $type = strtolower($type); if (!isset($this->nodeMapping[$type])) { - throw new \RuntimeException(\sprintf('The node type "%s" is not registered.', $type)); + throw new RuntimeException(sprintf('The node type "%s" is not registered.', $type)); } $class = $this->nodeMapping[$type]; - if (!\class_exists($class)) { - throw new \RuntimeException(\sprintf('The node class "%s" does not exist.', $class)); + if (!class_exists($class)) { + throw new RuntimeException(sprintf('The node class "%s" does not exist.', $class)); } return $class; } diff --git a/vendor/symfony/config/Definition/Builder/NodeDefinition.php b/vendor/symfony/config/Definition/Builder/NodeDefinition.php index 44ee3faa6..d11cb6919 100644 --- a/vendor/symfony/config/Definition/Builder/NodeDefinition.php +++ b/vendor/symfony/config/Definition/Builder/NodeDefinition.php @@ -17,27 +17,27 @@ * * @author Johannes M. Schmitt */ -abstract class NodeDefinition implements \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NodeParentInterface +abstract class NodeDefinition implements NodeParentInterface { protected $name; protected $normalization; protected $validation; protected $defaultValue; - protected $default = \false; - protected $required = \false; + protected $default = false; + protected $required = false; protected $deprecationMessage = null; protected $merge; - protected $allowEmptyValue = \true; + protected $allowEmptyValue = true; protected $nullEquivalent; - protected $trueEquivalent = \true; - protected $falseEquivalent = \false; + protected $trueEquivalent = true; + protected $falseEquivalent = false; protected $parent; protected $attributes = []; /** * @param string|null $name The name of the node * @param NodeParentInterface|null $parent The parent */ - public function __construct($name, \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NodeParentInterface $parent = null) + public function __construct($name, NodeParentInterface $parent = null) { $this->parent = $parent; $this->name = $name; @@ -47,7 +47,7 @@ public function __construct($name, \_PhpScoper5ea00cc67502b\Symfony\Component\Co * * @return $this */ - public function setParent(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NodeParentInterface $parent) + public function setParent(NodeParentInterface $parent) { $this->parent = $parent; return $this; @@ -103,16 +103,16 @@ public function end() * * @return NodeInterface */ - public function getNode($forceRootNode = \false) + public function getNode($forceRootNode = false) { if ($forceRootNode) { $this->parent = null; } if (null !== $this->normalization) { - $this->normalization->before = \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\ExprBuilder::buildExpressions($this->normalization->before); + $this->normalization->before = ExprBuilder::buildExpressions($this->normalization->before); } if (null !== $this->validation) { - $this->validation->rules = \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\ExprBuilder::buildExpressions($this->validation->rules); + $this->validation->rules = ExprBuilder::buildExpressions($this->validation->rules); } $node = $this->createNode(); $node->setAttributes($this->attributes); @@ -127,7 +127,7 @@ public function getNode($forceRootNode = \false) */ public function defaultValue($value) { - $this->default = \true; + $this->default = true; $this->defaultValue = $value; return $this; } @@ -138,7 +138,7 @@ public function defaultValue($value) */ public function isRequired() { - $this->required = \true; + $this->required = true; return $this; } /** @@ -208,7 +208,7 @@ public function defaultNull() */ public function defaultTrue() { - return $this->defaultValue(\true); + return $this->defaultValue(true); } /** * Sets false as the default value. @@ -217,7 +217,7 @@ public function defaultTrue() */ public function defaultFalse() { - return $this->defaultValue(\false); + return $this->defaultValue(false); } /** * Sets an expression to run before the normalization. @@ -235,7 +235,7 @@ public function beforeNormalization() */ public function cannotBeEmpty() { - $this->allowEmptyValue = \false; + $this->allowEmptyValue = false; return $this; } /** @@ -258,7 +258,7 @@ public function validate() * * @return $this */ - public function cannotBeOverwritten($deny = \true) + public function cannotBeOverwritten($deny = true) { $this->merge()->denyOverwrite($deny); return $this; @@ -271,7 +271,7 @@ public function cannotBeOverwritten($deny = \true) protected function validation() { if (null === $this->validation) { - $this->validation = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\ValidationBuilder($this); + $this->validation = new ValidationBuilder($this); } return $this->validation; } @@ -283,7 +283,7 @@ protected function validation() protected function merge() { if (null === $this->merge) { - $this->merge = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\MergeBuilder($this); + $this->merge = new MergeBuilder($this); } return $this->merge; } @@ -295,7 +295,7 @@ protected function merge() protected function normalization() { if (null === $this->normalization) { - $this->normalization = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NormalizationBuilder($this); + $this->normalization = new NormalizationBuilder($this); } return $this->normalization; } diff --git a/vendor/symfony/config/Definition/Builder/NormalizationBuilder.php b/vendor/symfony/config/Definition/Builder/NormalizationBuilder.php index ee7ca162d..36f1c852c 100644 --- a/vendor/symfony/config/Definition/Builder/NormalizationBuilder.php +++ b/vendor/symfony/config/Definition/Builder/NormalizationBuilder.php @@ -10,6 +10,8 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder; +use Closure; + /** * This class builds normalization conditions. * @@ -20,7 +22,7 @@ class NormalizationBuilder protected $node; public $before = []; public $remappings = []; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NodeDefinition $node) + public function __construct(NodeDefinition $node) { $this->node = $node; } @@ -42,12 +44,12 @@ public function remap($key, $plural = null) * * @return ExprBuilder|$this */ - public function before(\Closure $closure = null) + public function before(Closure $closure = null) { if (null !== $closure) { $this->before[] = $closure; return $this; } - return $this->before[] = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\ExprBuilder($this->node); + return $this->before[] = new ExprBuilder($this->node); } } diff --git a/vendor/symfony/config/Definition/Builder/NumericNodeDefinition.php b/vendor/symfony/config/Definition/Builder/NumericNodeDefinition.php index 430aa522e..81439cef2 100644 --- a/vendor/symfony/config/Definition/Builder/NumericNodeDefinition.php +++ b/vendor/symfony/config/Definition/Builder/NumericNodeDefinition.php @@ -11,12 +11,15 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\InvalidDefinitionException; +use InvalidArgumentException; +use function sprintf; + /** * Abstract class that contains common code of integer and float node definitions. * * @author David Jeanmonod */ -abstract class NumericNodeDefinition extends \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition +abstract class NumericNodeDefinition extends ScalarNodeDefinition { protected $min; protected $max; @@ -27,12 +30,12 @@ abstract class NumericNodeDefinition extends \_PhpScoper5ea00cc67502b\Symfony\Co * * @return $this * - * @throws \InvalidArgumentException when the constraint is inconsistent + * @throws InvalidArgumentException when the constraint is inconsistent */ public function max($max) { if (isset($this->min) && $this->min > $max) { - throw new \InvalidArgumentException(\sprintf('You cannot define a max(%s) as you already have a min(%s).', $max, $this->min)); + throw new InvalidArgumentException(sprintf('You cannot define a max(%s) as you already have a min(%s).', $max, $this->min)); } $this->max = $max; return $this; @@ -44,12 +47,12 @@ public function max($max) * * @return $this * - * @throws \InvalidArgumentException when the constraint is inconsistent + * @throws InvalidArgumentException when the constraint is inconsistent */ public function min($min) { if (isset($this->max) && $this->max < $min) { - throw new \InvalidArgumentException(\sprintf('You cannot define a min(%s) as you already have a max(%s).', $min, $this->max)); + throw new InvalidArgumentException(sprintf('You cannot define a min(%s) as you already have a max(%s).', $min, $this->max)); } $this->min = $min; return $this; @@ -61,6 +64,6 @@ public function min($min) */ public function cannotBeEmpty() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Exception\InvalidDefinitionException('->cannotBeEmpty() is not applicable to NumericNodeDefinition.'); + throw new InvalidDefinitionException('->cannotBeEmpty() is not applicable to NumericNodeDefinition.'); } } diff --git a/vendor/symfony/config/Definition/Builder/ParentNodeDefinitionInterface.php b/vendor/symfony/config/Definition/Builder/ParentNodeDefinitionInterface.php index c508114bb..d04c17d1f 100644 --- a/vendor/symfony/config/Definition/Builder/ParentNodeDefinitionInterface.php +++ b/vendor/symfony/config/Definition/Builder/ParentNodeDefinitionInterface.php @@ -38,9 +38,9 @@ public function children(); * * @return $this */ - public function append(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NodeDefinition $node); + public function append(NodeDefinition $node); /** * Sets a custom children builder. */ - public function setBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NodeBuilder $builder); + public function setBuilder(NodeBuilder $builder); } diff --git a/vendor/symfony/config/Definition/Builder/ScalarNodeDefinition.php b/vendor/symfony/config/Definition/Builder/ScalarNodeDefinition.php index 5384358c7..2c6b223be 100644 --- a/vendor/symfony/config/Definition/Builder/ScalarNodeDefinition.php +++ b/vendor/symfony/config/Definition/Builder/ScalarNodeDefinition.php @@ -16,7 +16,7 @@ * * @author Johannes M. Schmitt */ -class ScalarNodeDefinition extends \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\VariableNodeDefinition +class ScalarNodeDefinition extends VariableNodeDefinition { /** * Instantiate a Node. @@ -25,6 +25,6 @@ class ScalarNodeDefinition extends \_PhpScoper5ea00cc67502b\Symfony\Component\Co */ protected function instantiateNode() { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ScalarNode($this->name, $this->parent); + return new ScalarNode($this->name, $this->parent); } } diff --git a/vendor/symfony/config/Definition/Builder/TreeBuilder.php b/vendor/symfony/config/Definition/Builder/TreeBuilder.php index b0c17d844..ce1b8a026 100644 --- a/vendor/symfony/config/Definition/Builder/TreeBuilder.php +++ b/vendor/symfony/config/Definition/Builder/TreeBuilder.php @@ -11,12 +11,14 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\NodeInterface; +use RuntimeException; + /** * This is the entry class for building a config tree. * * @author Johannes M. Schmitt */ -class TreeBuilder implements \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NodeParentInterface +class TreeBuilder implements NodeParentInterface { protected $tree; protected $root; @@ -33,11 +35,11 @@ class TreeBuilder implements \_PhpScoper5ea00cc67502b\Symfony\Component\Config\D * * @return ArrayNodeDefinition|NodeDefinition The root node (as an ArrayNodeDefinition when the type is 'array') * - * @throws \RuntimeException When the node type is not supported + * @throws RuntimeException When the node type is not supported */ - public function root($name, $type = 'array', \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NodeBuilder $builder = null) + public function root($name, $type = 'array', NodeBuilder $builder = null) { - $builder = $builder ?: new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NodeBuilder(); + $builder = $builder ?: new NodeBuilder(); return $this->root = $builder->node($name, $type)->setParent($this); } /** @@ -45,16 +47,16 @@ public function root($name, $type = 'array', \_PhpScoper5ea00cc67502b\Symfony\Co * * @return NodeInterface * - * @throws \RuntimeException + * @throws RuntimeException */ public function buildTree() { if (null === $this->root) { - throw new \RuntimeException('The configuration tree has no root node.'); + throw new RuntimeException('The configuration tree has no root node.'); } if (null !== $this->tree) { return $this->tree; } - return $this->tree = $this->root->getNode(\true); + return $this->tree = $this->root->getNode(true); } } diff --git a/vendor/symfony/config/Definition/Builder/ValidationBuilder.php b/vendor/symfony/config/Definition/Builder/ValidationBuilder.php index c9b69948c..746408e94 100644 --- a/vendor/symfony/config/Definition/Builder/ValidationBuilder.php +++ b/vendor/symfony/config/Definition/Builder/ValidationBuilder.php @@ -10,6 +10,8 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder; +use Closure; + /** * This class builds validation conditions. * @@ -19,7 +21,7 @@ class ValidationBuilder { protected $node; public $rules = []; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NodeDefinition $node) + public function __construct(NodeDefinition $node) { $this->node = $node; } @@ -28,12 +30,12 @@ public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\De * * @return ExprBuilder|$this */ - public function rule(\Closure $closure = null) + public function rule(Closure $closure = null) { if (null !== $closure) { $this->rules[] = $closure; return $this; } - return $this->rules[] = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\ExprBuilder($this->node); + return $this->rules[] = new ExprBuilder($this->node); } } diff --git a/vendor/symfony/config/Definition/Builder/VariableNodeDefinition.php b/vendor/symfony/config/Definition/Builder/VariableNodeDefinition.php index c00028d90..646d14676 100644 --- a/vendor/symfony/config/Definition/Builder/VariableNodeDefinition.php +++ b/vendor/symfony/config/Definition/Builder/VariableNodeDefinition.php @@ -16,7 +16,7 @@ * * @author Johannes M. Schmitt */ -class VariableNodeDefinition extends \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NodeDefinition +class VariableNodeDefinition extends NodeDefinition { /** * Instantiate a Node. @@ -25,7 +25,7 @@ class VariableNodeDefinition extends \_PhpScoper5ea00cc67502b\Symfony\Component\ */ protected function instantiateNode() { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\VariableNode($this->name, $this->parent); + return new VariableNode($this->name, $this->parent); } /** * {@inheritdoc} @@ -39,13 +39,13 @@ protected function createNode() if (null !== $this->merge) { $node->setAllowOverwrite($this->merge->allowOverwrite); } - if (\true === $this->default) { + if (true === $this->default) { $node->setDefaultValue($this->defaultValue); } $node->setAllowEmptyValue($this->allowEmptyValue); $node->addEquivalentValue(null, $this->nullEquivalent); - $node->addEquivalentValue(\true, $this->trueEquivalent); - $node->addEquivalentValue(\false, $this->falseEquivalent); + $node->addEquivalentValue(true, $this->trueEquivalent); + $node->addEquivalentValue(false, $this->falseEquivalent); $node->setRequired($this->required); $node->setDeprecated($this->deprecationMessage); if (null !== $this->validation) { diff --git a/vendor/symfony/config/Definition/Builder/index.php b/vendor/symfony/config/Definition/Builder/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/config/Definition/Builder/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/config/Definition/ConfigurationInterface.php b/vendor/symfony/config/Definition/ConfigurationInterface.php index 7eb7956fe..f34fda10d 100644 --- a/vendor/symfony/config/Definition/ConfigurationInterface.php +++ b/vendor/symfony/config/Definition/ConfigurationInterface.php @@ -10,6 +10,8 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition; +use Symfony\Component\Config\Definition\Builder\TreeBuilder; + /** * Configuration interface. * @@ -20,7 +22,7 @@ interface ConfigurationInterface /** * Generates the configuration tree builder. * - * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder + * @return TreeBuilder The tree builder */ public function getConfigTreeBuilder(); } diff --git a/vendor/symfony/config/Definition/Dumper/XmlReferenceDumper.php b/vendor/symfony/config/Definition/Dumper/XmlReferenceDumper.php index d6f4f90e8..86da8a531 100644 --- a/vendor/symfony/config/Definition/Dumper/XmlReferenceDumper.php +++ b/vendor/symfony/config/Definition/Dumper/XmlReferenceDumper.php @@ -15,6 +15,24 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\EnumNode; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\NodeInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\PrototypedArrayNode; +use function array_filter; +use function array_keys; +use function array_map; +use function array_unshift; +use function count; +use function current; +use function explode; +use function get_class; +use function implode; +use function is_array; +use function is_numeric; +use function is_string; +use function sprintf; +use function str_repeat; +use function str_replace; +use function strlen; +use const PHP_EOL; + /** * Dumps a XML reference configuration for the given configuration/node instance. * @@ -23,14 +41,14 @@ class XmlReferenceDumper { private $reference; - public function dump(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ConfigurationInterface $configuration, $namespace = null) + public function dump(ConfigurationInterface $configuration, $namespace = null) { return $this->dumpNode($configuration->getConfigTreeBuilder()->buildTree(), $namespace); } - public function dumpNode(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\NodeInterface $node, $namespace = null) + public function dumpNode(NodeInterface $node, $namespace = null) { $this->reference = ''; - $this->writeNode($node, 0, \true, $namespace); + $this->writeNode($node, 0, true, $namespace); $ref = $this->reference; $this->reference = null; return $ref; @@ -40,26 +58,26 @@ public function dumpNode(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Defin * @param bool $root If the node is the root node * @param string $namespace The namespace of the node */ - private function writeNode(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\NodeInterface $node, $depth = 0, $root = \false, $namespace = null) + private function writeNode(NodeInterface $node, $depth = 0, $root = false, $namespace = null) { $rootName = $root ? 'config' : $node->getName(); $rootNamespace = $namespace ?: ($root ? 'http://example.org/schema/dic/' . $node->getName() : null); // xml remapping if ($node->getParent()) { - $remapping = \array_filter($node->getParent()->getXmlRemappings(), function ($mapping) use($rootName) { + $remapping = array_filter($node->getParent()->getXmlRemappings(), function ($mapping) use($rootName) { return $rootName === $mapping[1]; }); - if (\count($remapping)) { - list($singular) = \current($remapping); + if (count($remapping)) { + [$singular] = current($remapping); $rootName = $singular; } } - $rootName = \str_replace('_', '-', $rootName); + $rootName = str_replace('_', '-', $rootName); $rootAttributes = []; $rootAttributeComments = []; $rootChildren = []; $rootComments = []; - if ($node instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ArrayNode) { + if ($node instanceof ArrayNode) { $children = $node->getChildren(); // comments about the root node if ($rootInfo = $node->getInfo()) { @@ -69,26 +87,26 @@ private function writeNode(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Def $rootComments[] = 'Namespace: ' . $rootNamespace; } // render prototyped nodes - if ($node instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\PrototypedArrayNode) { + if ($node instanceof PrototypedArrayNode) { $prototype = $node->getPrototype(); $info = 'prototype'; if (null !== $prototype->getInfo()) { $info .= ': ' . $prototype->getInfo(); } - \array_unshift($rootComments, $info); + array_unshift($rootComments, $info); if ($key = $node->getKeyAttribute()) { - $rootAttributes[$key] = \str_replace('-', ' ', $rootName) . ' ' . $key; + $rootAttributes[$key] = str_replace('-', ' ', $rootName) . ' ' . $key; } - if ($prototype instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\PrototypedArrayNode) { + if ($prototype instanceof PrototypedArrayNode) { $prototype->setName($key); $children = [$key => $prototype]; - } elseif ($prototype instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ArrayNode) { + } elseif ($prototype instanceof ArrayNode) { $children = $prototype->getChildren(); } else { if ($prototype->hasDefaultValue()) { $prototypeValue = $prototype->getDefaultValue(); } else { - switch (\get_class($prototype)) { + switch (get_class($prototype)) { case 'Symfony\\Component\\Config\\Definition\\ScalarNode': $prototypeValue = 'scalar value'; break; @@ -100,7 +118,7 @@ private function writeNode(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Def $prototypeValue = 'true|false'; break; case 'Symfony\\Component\\Config\\Definition\\EnumNode': - $prototypeValue = \implode('|', \array_map('json_encode', $prototype->getValues())); + $prototypeValue = implode('|', array_map('json_encode', $prototype->getValues())); break; default: $prototypeValue = 'value'; @@ -110,10 +128,10 @@ private function writeNode(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Def } // get attributes and elements foreach ($children as $child) { - if (!$child instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ArrayNode) { + if (!$child instanceof ArrayNode) { // get attributes // metadata - $name = \str_replace('_', '-', $child->getName()); + $name = str_replace('_', '-', $child->getName()); $value = '%%%%not_defined%%%%'; // use a string which isn't used in the normal world // comments @@ -128,13 +146,13 @@ private function writeNode(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Def $comments[] = 'Required'; } if ($child->isDeprecated()) { - $comments[] = \sprintf('Deprecated (%s)', $child->getDeprecationMessage($child->getName(), $node->getPath())); + $comments[] = sprintf('Deprecated (%s)', $child->getDeprecationMessage($child->getName(), $node->getPath())); } - if ($child instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\EnumNode) { - $comments[] = 'One of ' . \implode('; ', \array_map('json_encode', $child->getValues())); + if ($child instanceof EnumNode) { + $comments[] = 'One of ' . implode('; ', array_map('json_encode', $child->getValues())); } - if (\count($comments)) { - $rootAttributeComments[$name] = \implode(";\n", $comments); + if (count($comments)) { + $rootAttributeComments[$name] = implode(";\n", $comments); } // default values if ($child->hasDefaultValue()) { @@ -150,18 +168,18 @@ private function writeNode(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Def } // render comments // root node comment - if (\count($rootComments)) { + if (count($rootComments)) { foreach ($rootComments as $comment) { $this->writeLine('', $depth); } } // attribute comments - if (\count($rootAttributeComments)) { + if (count($rootAttributeComments)) { foreach ($rootAttributeComments as $attrName => $comment) { - $commentDepth = $depth + 4 + \strlen($attrName) + 2; - $commentLines = \explode("\n", $comment); - $multiline = \count($commentLines) > 1; - $comment = \implode(\PHP_EOL . \str_repeat(' ', $commentDepth), $commentLines); + $commentDepth = $depth + 4 + strlen($attrName) + 2; + $commentLines = explode("\n", $comment); + $multiline = count($commentLines) > 1; + $comment = implode(PHP_EOL . str_repeat(' ', $commentDepth), $commentLines); if ($multiline) { $this->writeLine(' diff --git a/vendor/symfony/config/Tests/Definition/Dumper/YamlReferenceDumperTest.php b/vendor/symfony/config/Tests/Definition/Dumper/YamlReferenceDumperTest.php index d94c376b0..757a3cf3b 100644 --- a/vendor/symfony/config/Tests/Definition/Dumper/YamlReferenceDumperTest.php +++ b/vendor/symfony/config/Tests/Definition/Dumper/YamlReferenceDumperTest.php @@ -13,12 +13,14 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Dumper\YamlReferenceDumper; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Fixtures\Configuration\ExampleConfiguration; -class YamlReferenceDumperTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use function trim; + +class YamlReferenceDumperTest extends TestCase { public function testDumper() { - $configuration = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Fixtures\Configuration\ExampleConfiguration(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Dumper\YamlReferenceDumper(); + $configuration = new ExampleConfiguration(); + $dumper = new YamlReferenceDumper(); $this->assertEquals($this->getConfigurationAsString(), $dumper->dump($configuration)); } public function provideDumpAtPath() @@ -62,9 +64,9 @@ public function provideDumpAtPath() */ public function testDumpAtPath($path, $expected) { - $configuration = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Fixtures\Configuration\ExampleConfiguration(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Dumper\YamlReferenceDumper(); - $this->assertSame(\trim($expected), \trim($dumper->dumpAtPath($configuration, $path))); + $configuration = new ExampleConfiguration(); + $dumper = new YamlReferenceDumper(); + $this->assertSame(trim($expected), trim($dumper->dumpAtPath($configuration, $path))); } private function getConfigurationAsString() { diff --git a/vendor/symfony/config/Tests/Definition/Dumper/index.php b/vendor/symfony/config/Tests/Definition/Dumper/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/config/Tests/Definition/Dumper/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/config/Tests/Definition/EnumNodeTest.php b/vendor/symfony/config/Tests/Definition/EnumNodeTest.php index 91dc149fe..7cbd885ba 100644 --- a/vendor/symfony/config/Tests/Definition/EnumNodeTest.php +++ b/vendor/symfony/config/Tests/Definition/EnumNodeTest.php @@ -12,34 +12,34 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\EnumNode; -class EnumNodeTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class EnumNodeTest extends TestCase { public function testFinalizeValue() { - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\EnumNode('foo', null, ['foo', 'bar']); + $node = new EnumNode('foo', null, ['foo', 'bar']); $this->assertSame('foo', $node->finalize('foo')); } public function testConstructionWithNoValues() { $this->expectException('InvalidArgumentException'); $this->expectExceptionMessage('$values must contain at least one element.'); - new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\EnumNode('foo', null, []); + new EnumNode('foo', null, []); } public function testConstructionWithOneValue() { - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\EnumNode('foo', null, ['foo']); + $node = new EnumNode('foo', null, ['foo']); $this->assertSame('foo', $node->finalize('foo')); } public function testConstructionWithOneDistinctValue() { - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\EnumNode('foo', null, ['foo', 'foo']); + $node = new EnumNode('foo', null, ['foo', 'foo']); $this->assertSame('foo', $node->finalize('foo')); } public function testFinalizeWithInvalidValue() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Definition\\Exception\\InvalidConfigurationException'); $this->expectExceptionMessage('The value "foobar" is not allowed for path "foo". Permissible values: "foo", "bar"'); - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\EnumNode('foo', null, ['foo', 'bar']); + $node = new EnumNode('foo', null, ['foo', 'bar']); $node->finalize('foobar'); } } diff --git a/vendor/symfony/config/Tests/Definition/FinalizationTest.php b/vendor/symfony/config/Tests/Definition/FinalizationTest.php index d177abcc9..c9950833e 100644 --- a/vendor/symfony/config/Tests/Definition/FinalizationTest.php +++ b/vendor/symfony/config/Tests/Definition/FinalizationTest.php @@ -14,19 +14,19 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\TreeBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\NodeInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Processor; -class FinalizationTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class FinalizationTest extends TestCase { public function testUnsetKeyWithDeepHierarchy() { - $tb = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\TreeBuilder(); + $tb = new TreeBuilder(); $tree = $tb->root('config', 'array')->children()->node('level1', 'array')->canBeUnset()->children()->node('level2', 'array')->canBeUnset()->children()->node('somevalue', 'scalar')->end()->node('anothervalue', 'scalar')->end()->end()->end()->node('level1_scalar', 'scalar')->end()->end()->end()->end()->end()->buildTree(); $a = ['level1' => ['level2' => ['somevalue' => 'foo', 'anothervalue' => 'bar'], 'level1_scalar' => 'foo']]; - $b = ['level1' => ['level2' => \false]]; + $b = ['level1' => ['level2' => false]]; $this->assertEquals(['level1' => ['level1_scalar' => 'foo']], $this->process($tree, [$a, $b])); } - protected function process(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\NodeInterface $tree, array $configs) + protected function process(NodeInterface $tree, array $configs) { - $processor = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Processor(); + $processor = new Processor(); return $processor->process($tree, $configs); } } diff --git a/vendor/symfony/config/Tests/Definition/FloatNodeTest.php b/vendor/symfony/config/Tests/Definition/FloatNodeTest.php index 31050e15f..495bc888d 100644 --- a/vendor/symfony/config/Tests/Definition/FloatNodeTest.php +++ b/vendor/symfony/config/Tests/Definition/FloatNodeTest.php @@ -12,14 +12,16 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\FloatNode; -class FloatNodeTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use stdClass; + +class FloatNodeTest extends TestCase { /** * @dataProvider getValidValues */ public function testNormalize($value) { - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\FloatNode('test'); + $node = new FloatNode('test'); $this->assertSame($value, $node->normalize($value)); } /** @@ -29,8 +31,8 @@ public function testNormalize($value) */ public function testValidNonEmptyValues($value) { - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\FloatNode('test'); - $node->setAllowEmptyValue(\false); + $node = new FloatNode('test'); + $node->setAllowEmptyValue(false); $this->assertSame($value, $node->finalize($value)); } public function getValidValues() @@ -52,11 +54,11 @@ public function getValidValues() public function testNormalizeThrowsExceptionOnInvalidValues($value) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Definition\\Exception\\InvalidTypeException'); - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\FloatNode('test'); + $node = new FloatNode('test'); $node->normalize($value); } public function getInvalidValues() { - return [[null], [''], ['foo'], [\true], [\false], [[]], [['foo' => 'bar']], [new \stdClass()]]; + return [[null], [''], ['foo'], [true], [false], [[]], [['foo' => 'bar']], [new stdClass()]]; } } diff --git a/vendor/symfony/config/Tests/Definition/IntegerNodeTest.php b/vendor/symfony/config/Tests/Definition/IntegerNodeTest.php index 433d39936..377fc24ba 100644 --- a/vendor/symfony/config/Tests/Definition/IntegerNodeTest.php +++ b/vendor/symfony/config/Tests/Definition/IntegerNodeTest.php @@ -12,14 +12,16 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\IntegerNode; -class IntegerNodeTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use stdClass; + +class IntegerNodeTest extends TestCase { /** * @dataProvider getValidValues */ public function testNormalize($value) { - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\IntegerNode('test'); + $node = new IntegerNode('test'); $this->assertSame($value, $node->normalize($value)); } /** @@ -29,8 +31,8 @@ public function testNormalize($value) */ public function testValidNonEmptyValues($value) { - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\IntegerNode('test'); - $node->setAllowEmptyValue(\false); + $node = new IntegerNode('test'); + $node->setAllowEmptyValue(false); $this->assertSame($value, $node->finalize($value)); } public function getValidValues() @@ -43,11 +45,11 @@ public function getValidValues() public function testNormalizeThrowsExceptionOnInvalidValues($value) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Definition\\Exception\\InvalidTypeException'); - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\IntegerNode('test'); + $node = new IntegerNode('test'); $node->normalize($value); } public function getInvalidValues() { - return [[null], [''], ['foo'], [\true], [\false], [0.0], [0.1], [[]], [['foo' => 'bar']], [new \stdClass()]]; + return [[null], [''], ['foo'], [true], [false], [0.0], [0.1], [[]], [['foo' => 'bar']], [new stdClass()]]; } } diff --git a/vendor/symfony/config/Tests/Definition/MergeTest.php b/vendor/symfony/config/Tests/Definition/MergeTest.php index 8476c407a..e9bf57f07 100644 --- a/vendor/symfony/config/Tests/Definition/MergeTest.php +++ b/vendor/symfony/config/Tests/Definition/MergeTest.php @@ -12,12 +12,12 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\TreeBuilder; -class MergeTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class MergeTest extends TestCase { public function testForbiddenOverwrite() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Definition\\Exception\\ForbiddenOverwriteException'); - $tb = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\TreeBuilder(); + $tb = new TreeBuilder(); $tree = $tb->root('root', 'array')->children()->node('foo', 'scalar')->cannotBeOverwritten()->end()->end()->end()->buildTree(); $a = ['foo' => 'bar']; $b = ['foo' => 'moo']; @@ -25,16 +25,16 @@ public function testForbiddenOverwrite() } public function testUnsetKey() { - $tb = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\TreeBuilder(); + $tb = new TreeBuilder(); $tree = $tb->root('root', 'array')->children()->node('foo', 'scalar')->end()->node('bar', 'scalar')->end()->node('unsettable', 'array')->canBeUnset()->children()->node('foo', 'scalar')->end()->node('bar', 'scalar')->end()->end()->end()->node('unsetted', 'array')->canBeUnset()->prototype('scalar')->end()->end()->end()->end()->buildTree(); - $a = ['foo' => 'bar', 'unsettable' => ['foo' => 'a', 'bar' => 'b'], 'unsetted' => \false]; - $b = ['foo' => 'moo', 'bar' => 'b', 'unsettable' => \false, 'unsetted' => ['a', 'b']]; - $this->assertEquals(['foo' => 'moo', 'bar' => 'b', 'unsettable' => \false, 'unsetted' => ['a', 'b']], $tree->merge($a, $b)); + $a = ['foo' => 'bar', 'unsettable' => ['foo' => 'a', 'bar' => 'b'], 'unsetted' => false]; + $b = ['foo' => 'moo', 'bar' => 'b', 'unsettable' => false, 'unsetted' => ['a', 'b']]; + $this->assertEquals(['foo' => 'moo', 'bar' => 'b', 'unsettable' => false, 'unsetted' => ['a', 'b']], $tree->merge($a, $b)); } public function testDoesNotAllowNewKeysInSubsequentConfigs() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Definition\\Exception\\InvalidConfigurationException'); - $tb = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\TreeBuilder(); + $tb = new TreeBuilder(); $tree = $tb->root('config', 'array')->children()->node('test', 'array')->disallowNewKeysInSubsequentConfigs()->useAttributeAsKey('key')->prototype('array')->children()->node('value', 'scalar')->end()->end()->end()->end()->end()->end()->buildTree(); $a = ['test' => ['a' => ['value' => 'foo']]]; $b = ['test' => ['b' => ['value' => 'foo']]]; @@ -42,7 +42,7 @@ public function testDoesNotAllowNewKeysInSubsequentConfigs() } public function testPerformsNoDeepMerging() { - $tb = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\TreeBuilder(); + $tb = new TreeBuilder(); $tree = $tb->root('config', 'array')->children()->node('no_deep_merging', 'array')->performNoDeepMerging()->children()->node('foo', 'scalar')->end()->node('bar', 'scalar')->end()->end()->end()->end()->end()->buildTree(); $a = ['no_deep_merging' => ['foo' => 'a', 'bar' => 'b']]; $b = ['no_deep_merging' => ['c' => 'd']]; @@ -50,7 +50,7 @@ public function testPerformsNoDeepMerging() } public function testPrototypeWithoutAKeyAttribute() { - $tb = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\TreeBuilder(); + $tb = new TreeBuilder(); $tree = $tb->root('config', 'array')->children()->arrayNode('append_elements')->prototype('scalar')->end()->end()->end()->end()->buildTree(); $a = ['append_elements' => ['a', 'b']]; $b = ['append_elements' => ['c', 'd']]; diff --git a/vendor/symfony/config/Tests/Definition/NormalizationTest.php b/vendor/symfony/config/Tests/Definition/NormalizationTest.php index 725d9a052..859e3affc 100644 --- a/vendor/symfony/config/Tests/Definition/NormalizationTest.php +++ b/vendor/symfony/config/Tests/Definition/NormalizationTest.php @@ -13,14 +13,16 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\TreeBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\NodeInterface; -class NormalizationTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use function array_map; + +class NormalizationTest extends TestCase { /** * @dataProvider getEncoderTests */ public function testNormalizeEncoders($denormalized) { - $tb = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\TreeBuilder(); + $tb = new TreeBuilder(); $tree = $tb->root('root_name', 'array')->fixXmlConfig('encoder')->children()->node('encoders', 'array')->useAttributeAsKey('class')->prototype('array')->beforeNormalization()->ifString()->then(function ($v) { return ['algorithm' => $v]; })->end()->children()->node('algorithm', 'scalar')->end()->end()->end()->end()->end()->end()->buildTree(); @@ -40,7 +42,7 @@ public function getEncoderTests() $configs[] = ['encoders' => ['foo' => 'plaintext']]; // YAML/PHP $configs[] = ['encoders' => ['foo' => ['algorithm' => 'plaintext']]]; - return \array_map(function ($v) { + return array_map(function ($v) { return [$v]; }, $configs); } @@ -49,7 +51,7 @@ public function getEncoderTests() */ public function testAnonymousKeysArray($denormalized) { - $tb = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\TreeBuilder(); + $tb = new TreeBuilder(); $tree = $tb->root('root', 'array')->children()->node('logout', 'array')->fixXmlConfig('handler')->children()->node('handlers', 'array')->prototype('scalar')->end()->end()->end()->end()->end()->end()->buildTree(); $normalized = ['logout' => ['handlers' => ['a', 'b', 'c']]]; $this->assertNormalized($tree, $denormalized, $normalized); @@ -59,7 +61,7 @@ public function getAnonymousKeysTests() $configs = []; $configs[] = ['logout' => ['handlers' => ['a', 'b', 'c']]]; $configs[] = ['logout' => ['handler' => ['a', 'b', 'c']]]; - return \array_map(function ($v) { + return array_map(function ($v) { return [$v]; }, $configs); } @@ -76,7 +78,7 @@ public function getNumericKeysTests() $configs = []; $configs[] = ['thing' => [42 => ['foo', 'bar'], 1337 => ['baz', 'qux']]]; $configs[] = ['thing' => [['foo', 'bar', 'id' => 42], ['baz', 'qux', 'id' => 1337]]]; - return \array_map(function ($v) { + return array_map(function ($v) { return [$v]; }, $configs); } @@ -89,18 +91,18 @@ public function testNonAssociativeArrayThrowsExceptionIfAttributeNotSet() } public function testAssociativeArrayPreserveKeys() { - $tb = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\TreeBuilder(); + $tb = new TreeBuilder(); $tree = $tb->root('root', 'array')->prototype('array')->children()->node('foo', 'scalar')->end()->end()->end()->end()->buildTree(); $data = ['first' => ['foo' => 'bar']]; $this->assertNormalized($tree, $data, $data); } - public static function assertNormalized(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\NodeInterface $tree, $denormalized, $normalized) + public static function assertNormalized(NodeInterface $tree, $denormalized, $normalized) { self::assertSame($normalized, $tree->normalize($denormalized)); } private function getNumericKeysTestTree() { - $tb = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\TreeBuilder(); + $tb = new TreeBuilder(); $tree = $tb->root('root', 'array')->children()->node('thing', 'array')->useAttributeAsKey('id')->prototype('array')->prototype('scalar')->end()->end()->end()->end()->end()->buildTree(); return $tree; } diff --git a/vendor/symfony/config/Tests/Definition/PrototypedArrayNodeTest.php b/vendor/symfony/config/Tests/Definition/PrototypedArrayNodeTest.php index aaa300d2e..5e50d66c0 100644 --- a/vendor/symfony/config/Tests/Definition/PrototypedArrayNodeTest.php +++ b/vendor/symfony/config/Tests/Definition/PrototypedArrayNodeTest.php @@ -15,19 +15,19 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\PrototypedArrayNode; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ScalarNode; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\VariableNode; -class PrototypedArrayNodeTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class PrototypedArrayNodeTest extends TestCase { public function testGetDefaultValueReturnsAnEmptyArrayForPrototypes() { - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\PrototypedArrayNode('root'); - $prototype = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ArrayNode(null, $node); + $node = new PrototypedArrayNode('root'); + $prototype = new ArrayNode(null, $node); $node->setPrototype($prototype); $this->assertEmpty($node->getDefaultValue()); } public function testGetDefaultValueReturnsDefaultValueForPrototypes() { - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\PrototypedArrayNode('root'); - $prototype = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ArrayNode(null, $node); + $node = new PrototypedArrayNode('root'); + $prototype = new ArrayNode(null, $node); $node->setPrototype($prototype); $node->setDefaultValue(['test']); $this->assertEquals(['test'], $node->getDefaultValue()); @@ -35,11 +35,11 @@ public function testGetDefaultValueReturnsDefaultValueForPrototypes() // a remapped key (e.g. "mapping" -> "mappings") should be unset after being used public function testRemappedKeysAreUnset() { - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ArrayNode('root'); - $mappingsNode = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\PrototypedArrayNode('mappings'); + $node = new ArrayNode('root'); + $mappingsNode = new PrototypedArrayNode('mappings'); $node->addChild($mappingsNode); // each item under mappings is just a scalar - $prototype = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ScalarNode(null, $mappingsNode); + $prototype = new ScalarNode(null, $mappingsNode); $mappingsNode->setPrototype($prototype); $remappings = []; $remappings[] = ['mapping', 'mappings']; @@ -67,11 +67,11 @@ public function testRemappedKeysAreUnset() */ public function testMappedAttributeKeyIsRemoved() { - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\PrototypedArrayNode('root'); - $node->setKeyAttribute('id', \true); + $node = new PrototypedArrayNode('root'); + $node->setKeyAttribute('id', true); // each item under the root is an array, with one scalar item - $prototype = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ArrayNode(null, $node); - $prototype->addChild(new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ScalarNode('foo')); + $prototype = new ArrayNode(null, $node); + $prototype->addChild(new ScalarNode('foo')); $node->setPrototype($prototype); $children = []; $children[] = ['id' => 'item_name', 'foo' => 'bar']; @@ -86,12 +86,12 @@ public function testMappedAttributeKeyIsRemoved() */ public function testMappedAttributeKeyNotRemoved() { - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\PrototypedArrayNode('root'); - $node->setKeyAttribute('id', \false); + $node = new PrototypedArrayNode('root'); + $node->setKeyAttribute('id', false); // each item under the root is an array, with two scalar items - $prototype = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ArrayNode(null, $node); - $prototype->addChild(new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ScalarNode('foo')); - $prototype->addChild(new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ScalarNode('id')); + $prototype = new ArrayNode(null, $node); + $prototype->addChild(new ScalarNode('foo')); + $prototype->addChild(new ScalarNode('id')); // the key attribute will remain $node->setPrototype($prototype); $children = []; @@ -146,12 +146,12 @@ public function testDefaultChildrenWinsOverDefaultValue() } protected function getPrototypeNodeWithDefaultChildren() { - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\PrototypedArrayNode('root'); - $prototype = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ArrayNode(null, $node); - $child = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ScalarNode('foo'); + $node = new PrototypedArrayNode('root'); + $prototype = new ArrayNode(null, $node); + $child = new ScalarNode('foo'); $child->setDefaultValue('bar'); $prototype->addChild($child); - $prototype->setAddIfNotSet(\true); + $prototype->setAddIfNotSet(true); $node->setPrototype($prototype); return $node; } @@ -241,12 +241,12 @@ protected function getPrototypeNodeWithDefaultChildren() */ public function testMappedAttributeKeyIsRemovedLeftValueOnly($value, $children, $expected) { - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\PrototypedArrayNode('root'); - $node->setKeyAttribute('id', \true); + $node = new PrototypedArrayNode('root'); + $node->setKeyAttribute('id', true); // each item under the root is an array, with one scalar item - $prototype = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ArrayNode(null, $node); - $prototype->addChild(new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ScalarNode('id')); - $prototype->addChild(new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ScalarNode('foo')); + $prototype = new ArrayNode(null, $node); + $prototype->addChild(new ScalarNode('id')); + $prototype->addChild(new ScalarNode('foo')); $prototype->addChild($value); $node->setPrototype($prototype); $normalized = $node->normalize($children); @@ -254,11 +254,11 @@ public function testMappedAttributeKeyIsRemovedLeftValueOnly($value, $children, } public function getDataForKeyRemovedLeftValueOnly() { - $scalarValue = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ScalarNode('value'); - $arrayValue = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ArrayNode('value'); - $arrayValue->addChild(new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ScalarNode('foo')); - $arrayValue->addChild(new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ScalarNode('bar')); - $variableValue = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\VariableNode('value'); + $scalarValue = new ScalarNode('value'); + $arrayValue = new ArrayNode('value'); + $arrayValue->addChild(new ScalarNode('foo')); + $arrayValue->addChild(new ScalarNode('bar')); + $variableValue = new VariableNode('value'); return [[$scalarValue, [['id' => 'option1', 'value' => 'value1']], ['option1' => 'value1']], [$scalarValue, [['id' => 'option1', 'value' => 'value1'], ['id' => 'option2', 'value' => 'value2', 'foo' => 'foo2']], ['option1' => 'value1', 'option2' => ['value' => 'value2', 'foo' => 'foo2']]], [$arrayValue, [['id' => 'option1', 'value' => ['foo' => 'foo1', 'bar' => 'bar1']]], ['option1' => ['foo' => 'foo1', 'bar' => 'bar1']]], [$variableValue, [['id' => 'option1', 'value' => ['foo' => 'foo1', 'bar' => 'bar1']], ['id' => 'option2', 'value' => 'value2']], ['option1' => ['foo' => 'foo1', 'bar' => 'bar1'], 'option2' => 'value2']]]; } } diff --git a/vendor/symfony/config/Tests/Definition/ScalarNodeTest.php b/vendor/symfony/config/Tests/Definition/ScalarNodeTest.php index 00c576a65..a55c22069 100644 --- a/vendor/symfony/config/Tests/Definition/ScalarNodeTest.php +++ b/vendor/symfony/config/Tests/Definition/ScalarNodeTest.php @@ -13,42 +13,47 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ArrayNode; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ScalarNode; -class ScalarNodeTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use stdClass; +use function restore_error_handler; +use function set_error_handler; +use const E_USER_DEPRECATED; + +class ScalarNodeTest extends TestCase { /** * @dataProvider getValidValues */ public function testNormalize($value) { - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ScalarNode('test'); + $node = new ScalarNode('test'); $this->assertSame($value, $node->normalize($value)); } public function getValidValues() { - return [[\false], [\true], [null], [''], ['foo'], [0], [1], [0.0], [0.1]]; + return [[false], [true], [null], [''], ['foo'], [0], [1], [0.0], [0.1]]; } public function testSetDeprecated() { - $childNode = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ScalarNode('foo'); + $childNode = new ScalarNode('foo'); $childNode->setDeprecated('"%node%" is deprecated'); $this->assertTrue($childNode->isDeprecated()); $this->assertSame('"foo" is deprecated', $childNode->getDeprecationMessage($childNode->getName(), $childNode->getPath())); - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ArrayNode('root'); + $node = new ArrayNode('root'); $node->addChild($childNode); $deprecationTriggered = 0; $deprecationHandler = function ($level, $message, $file, $line) use(&$prevErrorHandler, &$deprecationTriggered) { - if (\E_USER_DEPRECATED === $level) { + if (E_USER_DEPRECATED === $level) { return ++$deprecationTriggered; } - return $prevErrorHandler ? $prevErrorHandler($level, $message, $file, $line) : \false; + return $prevErrorHandler ? $prevErrorHandler($level, $message, $file, $line) : false; }; - $prevErrorHandler = \set_error_handler($deprecationHandler); + $prevErrorHandler = set_error_handler($deprecationHandler); $node->finalize([]); - \restore_error_handler(); + restore_error_handler(); $this->assertSame(0, $deprecationTriggered, '->finalize() should not trigger if the deprecated node is not set'); - $prevErrorHandler = \set_error_handler($deprecationHandler); + $prevErrorHandler = set_error_handler($deprecationHandler); $node->finalize(['foo' => '']); - \restore_error_handler(); + restore_error_handler(); $this->assertSame(1, $deprecationTriggered, '->finalize() should trigger if the deprecated node is set'); } /** @@ -57,23 +62,23 @@ public function testSetDeprecated() public function testNormalizeThrowsExceptionOnInvalidValues($value) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Definition\\Exception\\InvalidTypeException'); - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ScalarNode('test'); + $node = new ScalarNode('test'); $node->normalize($value); } public function getInvalidValues() { - return [[[]], [['foo' => 'bar']], [new \stdClass()]]; + return [[[]], [['foo' => 'bar']], [new stdClass()]]; } public function testNormalizeThrowsExceptionWithoutHint() { - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ScalarNode('test'); + $node = new ScalarNode('test'); $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Definition\\Exception\\InvalidTypeException'); $this->expectExceptionMessage('Invalid type for path "test". Expected scalar, but got array.'); $node->normalize([]); } public function testNormalizeThrowsExceptionWithErrorMessage() { - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ScalarNode('test'); + $node = new ScalarNode('test'); $node->setInfo('"the test value"'); $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Definition\\Exception\\InvalidTypeException'); $this->expectExceptionMessage("Invalid type for path \"test\". Expected scalar, but got array.\nHint: \"the test value\""); @@ -86,13 +91,13 @@ public function testNormalizeThrowsExceptionWithErrorMessage() */ public function testValidNonEmptyValues($value) { - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ScalarNode('test'); - $node->setAllowEmptyValue(\false); + $node = new ScalarNode('test'); + $node->setAllowEmptyValue(false); $this->assertSame($value, $node->finalize($value)); } public function getValidNonEmptyValues() { - return [[\false], [\true], ['foo'], [0], [1], [0.0], [0.1]]; + return [[false], [true], ['foo'], [0], [1], [0.0], [0.1]]; } /** * @dataProvider getEmptyValues @@ -102,8 +107,8 @@ public function getValidNonEmptyValues() public function testNotAllowedEmptyValuesThrowException($value) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Definition\\Exception\\InvalidConfigurationException'); - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ScalarNode('test'); - $node->setAllowEmptyValue(\false); + $node = new ScalarNode('test'); + $node->setAllowEmptyValue(false); $node->finalize($value); } public function getEmptyValues() diff --git a/vendor/symfony/config/Tests/Definition/index.php b/vendor/symfony/config/Tests/Definition/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/config/Tests/Definition/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/config/Tests/DependencyInjection/ConfigCachePassTest.php b/vendor/symfony/config/Tests/DependencyInjection/ConfigCachePassTest.php index e56307330..1d1d12b16 100644 --- a/vendor/symfony/config/Tests/DependencyInjection/ConfigCachePassTest.php +++ b/vendor/symfony/config/Tests/DependencyInjection/ConfigCachePassTest.php @@ -15,29 +15,31 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; +use function count; + /** * @group legacy */ -class ConfigCachePassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class ConfigCachePassTest extends TestCase { public function testThatCheckersAreProcessedInPriorityOrder() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $definition = $container->register('config_cache_factory')->addArgument(null); $container->register('checker_2')->addTag('config_cache.resource_checker', ['priority' => 100]); $container->register('checker_1')->addTag('config_cache.resource_checker', ['priority' => 200]); $container->register('checker_3')->addTag('config_cache.resource_checker'); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\DependencyInjection\ConfigCachePass(); + $pass = new ConfigCachePass(); $pass->process($container); - $expected = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('checker_1'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('checker_2'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('checker_3')]); + $expected = new IteratorArgument([new Reference('checker_1'), new Reference('checker_2'), new Reference('checker_3')]); $this->assertEquals($expected, $definition->getArgument(0)); } public function testThatCheckersCanBeMissing() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $definitionsBefore = \count($container->getDefinitions()); - $aliasesBefore = \count($container->getAliases()); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\DependencyInjection\ConfigCachePass(); + $container = new ContainerBuilder(); + $definitionsBefore = count($container->getDefinitions()); + $aliasesBefore = count($container->getAliases()); + $pass = new ConfigCachePass(); $pass->process($container); // the container is untouched (i.e. no new definitions or aliases) $this->assertCount($definitionsBefore, $container->getDefinitions()); diff --git a/vendor/symfony/config/Tests/DependencyInjection/index.php b/vendor/symfony/config/Tests/DependencyInjection/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/config/Tests/DependencyInjection/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/config/Tests/Exception/FileLoaderLoadExceptionTest.php b/vendor/symfony/config/Tests/Exception/FileLoaderLoadExceptionTest.php index a0234d528..c234a3301 100644 --- a/vendor/symfony/config/Tests/Exception/FileLoaderLoadExceptionTest.php +++ b/vendor/symfony/config/Tests/Exception/FileLoaderLoadExceptionTest.php @@ -12,46 +12,48 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Exception\FileLoaderLoadException; -class FileLoaderLoadExceptionTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use Exception; + +class FileLoaderLoadExceptionTest extends TestCase { public function testMessageCannotLoadResource() { - $exception = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Exception\FileLoaderLoadException('resource', null); + $exception = new FileLoaderLoadException('resource', null); $this->assertEquals('Cannot load resource "resource".', $exception->getMessage()); } public function testMessageCannotLoadResourceWithType() { - $exception = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Exception\FileLoaderLoadException('resource', null, null, null, 'foobar'); + $exception = new FileLoaderLoadException('resource', null, null, null, 'foobar'); $this->assertEquals('Cannot load resource "resource". Make sure there is a loader supporting the "foobar" type.', $exception->getMessage()); } public function testMessageCannotLoadResourceWithAnnotationType() { - $exception = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Exception\FileLoaderLoadException('resource', null, null, null, 'annotation'); + $exception = new FileLoaderLoadException('resource', null, null, null, 'annotation'); $this->assertEquals('Cannot load resource "resource". Make sure annotations are installed and enabled.', $exception->getMessage()); } public function testMessageCannotImportResourceFromSource() { - $exception = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Exception\FileLoaderLoadException('resource', 'sourceResource'); + $exception = new FileLoaderLoadException('resource', 'sourceResource'); $this->assertEquals('Cannot import resource "resource" from "sourceResource".', $exception->getMessage()); } public function testMessageCannotImportBundleResource() { - $exception = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Exception\FileLoaderLoadException('@resource', 'sourceResource'); + $exception = new FileLoaderLoadException('@resource', 'sourceResource'); $this->assertEquals('Cannot import resource "@resource" from "sourceResource". ' . 'Make sure the "resource" bundle is correctly registered and loaded in the application kernel class. ' . 'If the bundle is registered, make sure the bundle path "@resource" is not empty.', $exception->getMessage()); } public function testMessageHasPreviousErrorWithDotAndUnableToLoad() { - $exception = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Exception\FileLoaderLoadException('resource', null, null, new \Exception('There was a previous error with an ending dot.')); + $exception = new FileLoaderLoadException('resource', null, null, new Exception('There was a previous error with an ending dot.')); $this->assertEquals('There was a previous error with an ending dot in resource (which is loaded in resource "resource").', $exception->getMessage()); } public function testMessageHasPreviousErrorWithoutDotAndUnableToLoad() { - $exception = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Exception\FileLoaderLoadException('resource', null, null, new \Exception('There was a previous error with no ending dot')); + $exception = new FileLoaderLoadException('resource', null, null, new Exception('There was a previous error with no ending dot')); $this->assertEquals('There was a previous error with no ending dot in resource (which is loaded in resource "resource").', $exception->getMessage()); } public function testMessageHasPreviousErrorAndUnableToLoadBundle() { - $exception = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Exception\FileLoaderLoadException('@resource', null, null, new \Exception('There was a previous error with an ending dot.')); + $exception = new FileLoaderLoadException('@resource', null, null, new Exception('There was a previous error with an ending dot.')); $this->assertEquals('There was a previous error with an ending dot in @resource ' . '(which is loaded in resource "@resource"). ' . 'Make sure the "resource" bundle is correctly registered and loaded in the application kernel class. ' . 'If the bundle is registered, make sure the bundle path "@resource" is not empty.', $exception->getMessage()); } } diff --git a/vendor/symfony/config/Tests/Exception/index.php b/vendor/symfony/config/Tests/Exception/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/config/Tests/Exception/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/config/Tests/FileLocatorTest.php b/vendor/symfony/config/Tests/FileLocatorTest.php index a1f8fcae8..b8a8b5c36 100644 --- a/vendor/symfony/config/Tests/FileLocatorTest.php +++ b/vendor/symfony/config/Tests/FileLocatorTest.php @@ -12,17 +12,20 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator; -class FileLocatorTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use ReflectionObject; +use const DIRECTORY_SEPARATOR; + +class FileLocatorTest extends TestCase { /** * @dataProvider getIsAbsolutePathTests */ public function testIsAbsolutePath($path) { - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator([]); - $r = new \ReflectionObject($loader); + $loader = new FileLocator([]); + $r = new ReflectionObject($loader); $m = $r->getMethod('isAbsolutePath'); - $m->setAccessible(\true); + $m->setAccessible(true); $this->assertTrue($m->invoke($loader, $path), '->isAbsolutePath() returns true for an absolute path'); } public function getIsAbsolutePathTests() @@ -31,34 +34,34 @@ public function getIsAbsolutePathTests() } public function testLocate() { - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(__DIR__ . '/Fixtures'); - $this->assertEquals(__DIR__ . \DIRECTORY_SEPARATOR . 'FileLocatorTest.php', $loader->locate('FileLocatorTest.php', __DIR__), '->locate() returns the absolute filename if the file exists in the given path'); - $this->assertEquals(__DIR__ . '/Fixtures' . \DIRECTORY_SEPARATOR . 'foo.xml', $loader->locate('foo.xml', __DIR__), '->locate() returns the absolute filename if the file exists in one of the paths given in the constructor'); - $this->assertEquals(__DIR__ . '/Fixtures' . \DIRECTORY_SEPARATOR . 'foo.xml', $loader->locate(__DIR__ . '/Fixtures' . \DIRECTORY_SEPARATOR . 'foo.xml', __DIR__), '->locate() returns the absolute filename if the file exists in one of the paths given in the constructor'); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator([__DIR__ . '/Fixtures', __DIR__ . '/Fixtures/Again']); - $this->assertEquals([__DIR__ . '/Fixtures' . \DIRECTORY_SEPARATOR . 'foo.xml', __DIR__ . '/Fixtures/Again' . \DIRECTORY_SEPARATOR . 'foo.xml'], $loader->locate('foo.xml', __DIR__, \false), '->locate() returns an array of absolute filenames'); - $this->assertEquals([__DIR__ . '/Fixtures' . \DIRECTORY_SEPARATOR . 'foo.xml', __DIR__ . '/Fixtures/Again' . \DIRECTORY_SEPARATOR . 'foo.xml'], $loader->locate('foo.xml', __DIR__ . '/Fixtures', \false), '->locate() returns an array of absolute filenames'); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(__DIR__ . '/Fixtures/Again'); - $this->assertEquals([__DIR__ . '/Fixtures' . \DIRECTORY_SEPARATOR . 'foo.xml', __DIR__ . '/Fixtures/Again' . \DIRECTORY_SEPARATOR . 'foo.xml'], $loader->locate('foo.xml', __DIR__ . '/Fixtures', \false), '->locate() returns an array of absolute filenames'); + $loader = new FileLocator(__DIR__ . '/Fixtures'); + $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'FileLocatorTest.php', $loader->locate('FileLocatorTest.php', __DIR__), '->locate() returns the absolute filename if the file exists in the given path'); + $this->assertEquals(__DIR__ . '/Fixtures' . DIRECTORY_SEPARATOR . 'foo.xml', $loader->locate('foo.xml', __DIR__), '->locate() returns the absolute filename if the file exists in one of the paths given in the constructor'); + $this->assertEquals(__DIR__ . '/Fixtures' . DIRECTORY_SEPARATOR . 'foo.xml', $loader->locate(__DIR__ . '/Fixtures' . DIRECTORY_SEPARATOR . 'foo.xml', __DIR__), '->locate() returns the absolute filename if the file exists in one of the paths given in the constructor'); + $loader = new FileLocator([__DIR__ . '/Fixtures', __DIR__ . '/Fixtures/Again']); + $this->assertEquals([__DIR__ . '/Fixtures' . DIRECTORY_SEPARATOR . 'foo.xml', __DIR__ . '/Fixtures/Again' . DIRECTORY_SEPARATOR . 'foo.xml'], $loader->locate('foo.xml', __DIR__, false), '->locate() returns an array of absolute filenames'); + $this->assertEquals([__DIR__ . '/Fixtures' . DIRECTORY_SEPARATOR . 'foo.xml', __DIR__ . '/Fixtures/Again' . DIRECTORY_SEPARATOR . 'foo.xml'], $loader->locate('foo.xml', __DIR__ . '/Fixtures', false), '->locate() returns an array of absolute filenames'); + $loader = new FileLocator(__DIR__ . '/Fixtures/Again'); + $this->assertEquals([__DIR__ . '/Fixtures' . DIRECTORY_SEPARATOR . 'foo.xml', __DIR__ . '/Fixtures/Again' . DIRECTORY_SEPARATOR . 'foo.xml'], $loader->locate('foo.xml', __DIR__ . '/Fixtures', false), '->locate() returns an array of absolute filenames'); } public function testLocateThrowsAnExceptionIfTheFileDoesNotExists() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Exception\\FileLocatorFileNotFoundException'); $this->expectExceptionMessage('The file "foobar.xml" does not exist'); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator([__DIR__ . '/Fixtures']); + $loader = new FileLocator([__DIR__ . '/Fixtures']); $loader->locate('foobar.xml', __DIR__); } public function testLocateThrowsAnExceptionIfTheFileDoesNotExistsInAbsolutePath() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Exception\\FileLocatorFileNotFoundException'); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator([__DIR__ . '/Fixtures']); + $loader = new FileLocator([__DIR__ . '/Fixtures']); $loader->locate(__DIR__ . '/Fixtures/foobar.xml', __DIR__); } public function testLocateEmpty() { $this->expectException('InvalidArgumentException'); $this->expectExceptionMessage('An empty file name is not valid to be located.'); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator([__DIR__ . '/Fixtures']); + $loader = new FileLocator([__DIR__ . '/Fixtures']); $loader->locate(null, __DIR__); } } diff --git a/vendor/symfony/config/Tests/Fixtures/Again/index.php b/vendor/symfony/config/Tests/Fixtures/Again/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/config/Tests/Fixtures/Again/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/config/Tests/Fixtures/BadFileName.php b/vendor/symfony/config/Tests/Fixtures/BadFileName.php index 9f4184551..9fee7a7e7 100644 --- a/vendor/symfony/config/Tests/Fixtures/BadFileName.php +++ b/vendor/symfony/config/Tests/Fixtures/BadFileName.php @@ -2,7 +2,9 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Fixtures; +use RuntimeException; + class FileNameMismatchOnPurpose { } -throw new \RuntimeException('Mismatch between file name and class name.'); +throw new RuntimeException('Mismatch between file name and class name.'); diff --git a/vendor/symfony/config/Tests/Fixtures/BadParent.php b/vendor/symfony/config/Tests/Fixtures/BadParent.php index 7c6f727ca..45deeae39 100644 --- a/vendor/symfony/config/Tests/Fixtures/BadParent.php +++ b/vendor/symfony/config/Tests/Fixtures/BadParent.php @@ -2,6 +2,6 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Fixtures; -class BadParent extends \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Fixtures\MissingParent +class BadParent extends MissingParent { } diff --git a/vendor/symfony/config/Tests/Fixtures/BarNode.php b/vendor/symfony/config/Tests/Fixtures/BarNode.php index ec5023add..db5efe9f7 100644 --- a/vendor/symfony/config/Tests/Fixtures/BarNode.php +++ b/vendor/symfony/config/Tests/Fixtures/BarNode.php @@ -11,6 +11,6 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Fixtures; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ArrayNode; -class BarNode extends \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ArrayNode +class BarNode extends ArrayNode { } diff --git a/vendor/symfony/config/Tests/Fixtures/Builder/BarNodeDefinition.php b/vendor/symfony/config/Tests/Fixtures/Builder/BarNodeDefinition.php index 289113083..c796eaecd 100644 --- a/vendor/symfony/config/Tests/Fixtures/Builder/BarNodeDefinition.php +++ b/vendor/symfony/config/Tests/Fixtures/Builder/BarNodeDefinition.php @@ -12,10 +12,10 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NodeDefinition; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Fixtures\BarNode; -class BarNodeDefinition extends \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NodeDefinition +class BarNodeDefinition extends NodeDefinition { protected function createNode() { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Fixtures\BarNode($this->name); + return new BarNode($this->name); } } diff --git a/vendor/symfony/config/Tests/Fixtures/Builder/NodeBuilder.php b/vendor/symfony/config/Tests/Fixtures/Builder/NodeBuilder.php index ca83abb3f..c3ae3c44b 100644 --- a/vendor/symfony/config/Tests/Fixtures/Builder/NodeBuilder.php +++ b/vendor/symfony/config/Tests/Fixtures/Builder/NodeBuilder.php @@ -11,7 +11,9 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Fixtures\Builder; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NodeBuilder as BaseNodeBuilder; -class NodeBuilder extends \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\NodeBuilder +use function ucfirst; + +class NodeBuilder extends BaseNodeBuilder { public function barNode($name) { @@ -21,9 +23,9 @@ protected function getNodeClass($type) { switch ($type) { case 'variable': - return __NAMESPACE__ . '\\' . \ucfirst($type) . 'NodeDefinition'; + return __NAMESPACE__ . '\\' . ucfirst($type) . 'NodeDefinition'; case 'bar': - return __NAMESPACE__ . '\\' . \ucfirst($type) . 'NodeDefinition'; + return __NAMESPACE__ . '\\' . ucfirst($type) . 'NodeDefinition'; default: return parent::getNodeClass($type); } diff --git a/vendor/symfony/config/Tests/Fixtures/Builder/VariableNodeDefinition.php b/vendor/symfony/config/Tests/Fixtures/Builder/VariableNodeDefinition.php index 7429d15a0..3e8c61ca8 100644 --- a/vendor/symfony/config/Tests/Fixtures/Builder/VariableNodeDefinition.php +++ b/vendor/symfony/config/Tests/Fixtures/Builder/VariableNodeDefinition.php @@ -11,6 +11,6 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Fixtures\Builder; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\VariableNodeDefinition as BaseVariableNodeDefinition; -class VariableNodeDefinition extends \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\VariableNodeDefinition +class VariableNodeDefinition extends BaseVariableNodeDefinition { } diff --git a/vendor/symfony/config/Tests/Fixtures/Builder/index.php b/vendor/symfony/config/Tests/Fixtures/Builder/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/config/Tests/Fixtures/Builder/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/config/Tests/Fixtures/Configuration/index.php b/vendor/symfony/config/Tests/Fixtures/Configuration/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/config/Tests/Fixtures/Configuration/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/config/Tests/Fixtures/ParseError.php b/vendor/symfony/config/Tests/Fixtures/ParseError.php index 6bb221382..cb066448c 100644 --- a/vendor/symfony/config/Tests/Fixtures/ParseError.php +++ b/vendor/symfony/config/Tests/Fixtures/ParseError.php @@ -5,3 +5,4 @@ class ParseError { // missing closing bracket +} \ No newline at end of file diff --git a/vendor/symfony/config/Tests/Fixtures/Resource/ConditionalClass.php b/vendor/symfony/config/Tests/Fixtures/Resource/ConditionalClass.php index c8da4deab..8ffa80b2c 100644 --- a/vendor/symfony/config/Tests/Fixtures/Resource/ConditionalClass.php +++ b/vendor/symfony/config/Tests/Fixtures/Resource/ConditionalClass.php @@ -2,7 +2,9 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Fixtures\Resource; -if (!\class_exists(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Fixtures\Resource\MissingClass::class)) { +use function class_exists; + +if (!class_exists(MissingClass::class)) { class ConditionalClass { } diff --git a/vendor/symfony/config/Tests/Fixtures/Resource/index.php b/vendor/symfony/config/Tests/Fixtures/Resource/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/config/Tests/Fixtures/Resource/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/config/Tests/Fixtures/Util/index.php b/vendor/symfony/config/Tests/Fixtures/Util/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/config/Tests/Fixtures/Util/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/config/Tests/Fixtures/index.php b/vendor/symfony/config/Tests/Fixtures/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/config/Tests/Fixtures/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/config/Tests/Loader/DelegatingLoaderTest.php b/vendor/symfony/config/Tests/Loader/DelegatingLoaderTest.php index d91fa9929..02d85ae12 100644 --- a/vendor/symfony/config/Tests/Loader/DelegatingLoaderTest.php +++ b/vendor/symfony/config/Tests/Loader/DelegatingLoaderTest.php @@ -13,48 +13,48 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\DelegatingLoader; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\LoaderResolver; -class DelegatingLoaderTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class DelegatingLoaderTest extends TestCase { public function testConstructor() { - new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\DelegatingLoader($resolver = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\LoaderResolver()); - $this->assertTrue(\true, '__construct() takes a loader resolver as its first argument'); + new DelegatingLoader($resolver = new LoaderResolver()); + $this->assertTrue(true, '__construct() takes a loader resolver as its first argument'); } public function testGetSetResolver() { - $resolver = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\LoaderResolver(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\DelegatingLoader($resolver); + $resolver = new LoaderResolver(); + $loader = new DelegatingLoader($resolver); $this->assertSame($resolver, $loader->getResolver(), '->getResolver() gets the resolver loader'); - $loader->setResolver($resolver = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\LoaderResolver()); + $loader->setResolver($resolver = new LoaderResolver()); $this->assertSame($resolver, $loader->getResolver(), '->setResolver() sets the resolver loader'); } public function testSupports() { $loader1 = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Loader\\LoaderInterface')->getMock(); - $loader1->expects($this->once())->method('supports')->willReturn(\true); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\DelegatingLoader(new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\LoaderResolver([$loader1])); + $loader1->expects($this->once())->method('supports')->willReturn(true); + $loader = new DelegatingLoader(new LoaderResolver([$loader1])); $this->assertTrue($loader->supports('foo.xml'), '->supports() returns true if the resource is loadable'); $loader1 = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Loader\\LoaderInterface')->getMock(); - $loader1->expects($this->once())->method('supports')->willReturn(\false); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\DelegatingLoader(new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\LoaderResolver([$loader1])); + $loader1->expects($this->once())->method('supports')->willReturn(false); + $loader = new DelegatingLoader(new LoaderResolver([$loader1])); $this->assertFalse($loader->supports('foo.foo'), '->supports() returns false if the resource is not loadable'); } public function testLoad() { $loader = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Loader\\LoaderInterface')->getMock(); - $loader->expects($this->once())->method('supports')->willReturn(\true); + $loader->expects($this->once())->method('supports')->willReturn(true); $loader->expects($this->once())->method('load'); - $resolver = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\LoaderResolver([$loader]); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\DelegatingLoader($resolver); + $resolver = new LoaderResolver([$loader]); + $loader = new DelegatingLoader($resolver); $loader->load('foo'); } public function testLoadThrowsAnExceptionIfTheResourceCannotBeLoaded() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Exception\\FileLoaderLoadException'); $loader = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Loader\\LoaderInterface')->getMock(); - $loader->expects($this->once())->method('supports')->willReturn(\false); - $resolver = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\LoaderResolver([$loader]); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\DelegatingLoader($resolver); + $loader->expects($this->once())->method('supports')->willReturn(false); + $resolver = new LoaderResolver([$loader]); + $loader = new DelegatingLoader($resolver); $loader->load('foo'); } } diff --git a/vendor/symfony/config/Tests/Loader/FileLoaderTest.php b/vendor/symfony/config/Tests/Loader/FileLoaderTest.php index cd22287e1..604c53d16 100644 --- a/vendor/symfony/config/Tests/Loader/FileLoaderTest.php +++ b/vendor/symfony/config/Tests/Loader/FileLoaderTest.php @@ -14,7 +14,11 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\FileLoader; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\LoaderResolver; -class FileLoaderTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use Exception; +use function strtr; +use const DIRECTORY_SEPARATOR; + +class FileLoaderTest extends TestCase { public function testImportWithFileLocatorDelegation() { @@ -31,12 +35,12 @@ public function testImportWithFileLocatorDelegation() // Exception ['path/to/file1', 'path/to/file2'] )); - $fileLoader = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Loader\TestFileLoader($locatorMock); - $fileLoader->setSupports(\false); + $fileLoader = new TestFileLoader($locatorMock); + $fileLoader->setSupports(false); $fileLoader->setCurrentDir('.'); - $additionalLoader = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Loader\TestFileLoader($locatorMockForAdditionalLoader); + $additionalLoader = new TestFileLoader($locatorMockForAdditionalLoader); $additionalLoader->setCurrentDir('.'); - $fileLoader->setResolver($loaderResolver = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\LoaderResolver([$fileLoader, $additionalLoader])); + $fileLoader->setResolver($loaderResolver = new LoaderResolver([$fileLoader, $additionalLoader])); // Default case $this->assertSame('path/to/file1', $fileLoader->import('my_resource')); // Check first file is imported if not already loading @@ -48,7 +52,7 @@ public function testImportWithFileLocatorDelegation() try { $fileLoader->import('my_resource'); $this->fail('->import() throws a FileLoaderImportCircularReferenceException if the resource is already loading'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Exception\\FileLoaderImportCircularReferenceException', $e, '->import() throws a FileLoaderImportCircularReferenceException if the resource is already loading'); } // Check exception throws if all files are already loading @@ -56,31 +60,31 @@ public function testImportWithFileLocatorDelegation() $fileLoader->addLoading('path/to/file2'); $fileLoader->import('my_resource'); $this->fail('->import() throws a FileLoaderImportCircularReferenceException if the resource is already loading'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Exception\\FileLoaderImportCircularReferenceException', $e, '->import() throws a FileLoaderImportCircularReferenceException if the resource is already loading'); } } public function testImportWithGlobLikeResource() { $locatorMock = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\FileLocatorInterface')->getMock(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Loader\TestFileLoader($locatorMock); + $loader = new TestFileLoader($locatorMock); $this->assertSame('[foo]', $loader->import('[foo]')); } public function testImportWithNoGlobMatch() { $locatorMock = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\FileLocatorInterface')->getMock(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Loader\TestFileLoader($locatorMock); + $loader = new TestFileLoader($locatorMock); $this->assertNull($loader->import('./*.abc')); } public function testImportWithSimpleGlob() { - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Loader\TestFileLoader(new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(__DIR__)); - $this->assertSame(__FILE__, \strtr($loader->import('FileLoaderTest.*'), '/', \DIRECTORY_SEPARATOR)); + $loader = new TestFileLoader(new FileLocator(__DIR__)); + $this->assertSame(__FILE__, strtr($loader->import('FileLoaderTest.*'), '/', DIRECTORY_SEPARATOR)); } } -class TestFileLoader extends \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\FileLoader +class TestFileLoader extends FileLoader { - private $supports = \true; + private $supports = true; public function load($resource, $type = null) { return $resource; @@ -91,7 +95,7 @@ public function supports($resource, $type = null) } public function addLoading($resource) { - self::$loading[$resource] = \true; + self::$loading[$resource] = true; } public function removeLoading($resource) { diff --git a/vendor/symfony/config/Tests/Loader/LoaderResolverTest.php b/vendor/symfony/config/Tests/Loader/LoaderResolverTest.php index 52c5e3a1d..8838a69fb 100644 --- a/vendor/symfony/config/Tests/Loader/LoaderResolverTest.php +++ b/vendor/symfony/config/Tests/Loader/LoaderResolverTest.php @@ -12,27 +12,27 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\LoaderResolver; -class LoaderResolverTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class LoaderResolverTest extends TestCase { public function testConstructor() { - $resolver = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\LoaderResolver([$loader = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Loader\\LoaderInterface')->getMock()]); + $resolver = new LoaderResolver([$loader = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Loader\\LoaderInterface')->getMock()]); $this->assertEquals([$loader], $resolver->getLoaders(), '__construct() takes an array of loaders as its first argument'); } public function testResolve() { $loader = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Loader\\LoaderInterface')->getMock(); - $resolver = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\LoaderResolver([$loader]); + $resolver = new LoaderResolver([$loader]); $this->assertFalse($resolver->resolve('foo.foo'), '->resolve() returns false if no loader is able to load the resource'); $loader = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Loader\\LoaderInterface')->getMock(); - $loader->expects($this->once())->method('supports')->willReturn(\true); - $resolver = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\LoaderResolver([$loader]); + $loader->expects($this->once())->method('supports')->willReturn(true); + $resolver = new LoaderResolver([$loader]); $this->assertEquals($loader, $resolver->resolve(function () { }), '->resolve() returns the loader for the given resource'); } public function testLoaders() { - $resolver = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\LoaderResolver(); + $resolver = new LoaderResolver(); $resolver->addLoader($loader = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Loader\\LoaderInterface')->getMock()); $this->assertEquals([$loader], $resolver->getLoaders(), 'addLoader() adds a loader'); } diff --git a/vendor/symfony/config/Tests/Loader/LoaderTest.php b/vendor/symfony/config/Tests/Loader/LoaderTest.php index f0b613c04..f13e16df3 100644 --- a/vendor/symfony/config/Tests/Loader/LoaderTest.php +++ b/vendor/symfony/config/Tests/Loader/LoaderTest.php @@ -12,12 +12,16 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\Loader; -class LoaderTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use function is_string; +use function pathinfo; +use const PATHINFO_EXTENSION; + +class LoaderTest extends TestCase { public function testGetSetResolver() { $resolver = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Loader\\LoaderResolverInterface')->getMock(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Loader\ProjectLoader1(); + $loader = new ProjectLoader1(); $loader->setResolver($resolver); $this->assertSame($resolver, $loader->getResolver(), '->setResolver() sets the resolver loader'); } @@ -26,7 +30,7 @@ public function testResolve() $resolvedLoader = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Loader\\LoaderInterface')->getMock(); $resolver = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Loader\\LoaderResolverInterface')->getMock(); $resolver->expects($this->once())->method('resolve')->with('foo.xml')->willReturn($resolvedLoader); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Loader\ProjectLoader1(); + $loader = new ProjectLoader1(); $loader->setResolver($resolver); $this->assertSame($loader, $loader->resolve('foo.foo'), '->resolve() finds a loader'); $this->assertSame($resolvedLoader, $loader->resolve('foo.xml'), '->resolve() finds a loader'); @@ -35,8 +39,8 @@ public function testResolveWhenResolverCannotFindLoader() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Exception\\FileLoaderLoadException'); $resolver = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Loader\\LoaderResolverInterface')->getMock(); - $resolver->expects($this->once())->method('resolve')->with('FOOBAR')->willReturn(\false); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Loader\ProjectLoader1(); + $resolver->expects($this->once())->method('resolve')->with('FOOBAR')->willReturn(false); + $loader = new ProjectLoader1(); $loader->setResolver($resolver); $loader->resolve('FOOBAR'); } @@ -46,7 +50,7 @@ public function testImport() $resolvedLoader->expects($this->once())->method('load')->with('foo')->willReturn('yes'); $resolver = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Loader\\LoaderResolverInterface')->getMock(); $resolver->expects($this->once())->method('resolve')->with('foo')->willReturn($resolvedLoader); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Loader\ProjectLoader1(); + $loader = new ProjectLoader1(); $loader->setResolver($resolver); $this->assertEquals('yes', $loader->import('foo')); } @@ -56,19 +60,19 @@ public function testImportWithType() $resolvedLoader->expects($this->once())->method('load')->with('foo', 'bar')->willReturn('yes'); $resolver = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Loader\\LoaderResolverInterface')->getMock(); $resolver->expects($this->once())->method('resolve')->with('foo', 'bar')->willReturn($resolvedLoader); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Loader\ProjectLoader1(); + $loader = new ProjectLoader1(); $loader->setResolver($resolver); $this->assertEquals('yes', $loader->import('foo', 'bar')); } } -class ProjectLoader1 extends \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\Loader +class ProjectLoader1 extends Loader { public function load($resource, $type = null) { } public function supports($resource, $type = null) { - return \is_string($resource) && 'foo' === \pathinfo($resource, \PATHINFO_EXTENSION); + return is_string($resource) && 'foo' === pathinfo($resource, PATHINFO_EXTENSION); } public function getType() { diff --git a/vendor/symfony/config/Tests/Loader/index.php b/vendor/symfony/config/Tests/Loader/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/config/Tests/Loader/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/config/Tests/Resource/ClassExistenceResourceTest.php b/vendor/symfony/config/Tests/Resource/ClassExistenceResourceTest.php index 07f5157b3..f2725f574 100644 --- a/vendor/symfony/config/Tests/Resource/ClassExistenceResourceTest.php +++ b/vendor/symfony/config/Tests/Resource/ClassExistenceResourceTest.php @@ -16,22 +16,26 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Fixtures\BadParent; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Fixtures\ParseError; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Fixtures\Resource\ConditionalClass; -class ClassExistenceResourceTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use function spl_autoload_register; +use function spl_autoload_unregister; +use function time; + +class ClassExistenceResourceTest extends TestCase { public function testToString() { - $res = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ClassExistenceResource('BarClass'); + $res = new ClassExistenceResource('BarClass'); $this->assertSame('BarClass', (string) $res); } public function testGetResource() { - $res = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ClassExistenceResource('BarClass'); + $res = new ClassExistenceResource('BarClass'); $this->assertSame('BarClass', $res->getResource()); } public function testIsFreshWhenClassDoesNotExist() { - $res = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ClassExistenceResource('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Tests\\Fixtures\\BarClass'); - $this->assertTrue($res->isFresh(\time())); + $res = new ClassExistenceResource('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Tests\\Fixtures\\BarClass'); + $this->assertTrue($res->isFresh(time())); eval(<<assertFalse($res->isFresh(\time())); + $this->assertFalse($res->isFresh(time())); } public function testIsFreshWhenClassExists() { - $res = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ClassExistenceResource('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Tests\\Resource\\ClassExistenceResourceTest'); - $this->assertTrue($res->isFresh(\time())); + $res = new ClassExistenceResource('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Tests\\Resource\\ClassExistenceResourceTest'); + $this->assertTrue($res->isFresh(time())); } public function testExistsKo() { - \spl_autoload_register($autoloader = function ($class) use(&$loadedClass) { + spl_autoload_register($autoloader = function ($class) use(&$loadedClass) { $loadedClass = $class; }); try { - $res = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ClassExistenceResource('MissingFooClass'); + $res = new ClassExistenceResource('MissingFooClass'); $this->assertTrue($res->isFresh(0)); $this->assertSame('MissingFooClass', $loadedClass); $loadedClass = 123; - new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ClassExistenceResource('MissingFooClass', \false); + new ClassExistenceResource('MissingFooClass', false); $this->assertSame(123, $loadedClass); } finally { - \spl_autoload_unregister($autoloader); + spl_autoload_unregister($autoloader); } } public function testBadParentWithTimestamp() { - $res = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ClassExistenceResource(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Fixtures\BadParent::class, \false); - $this->assertTrue($res->isFresh(\time())); + $res = new ClassExistenceResource(BadParent::class, false); + $this->assertTrue($res->isFresh(time())); } public function testBadParentWithNoTimestamp() { $this->expectException('ReflectionException'); $this->expectExceptionMessage('Class "Symfony\\Component\\Config\\Tests\\Fixtures\\MissingParent" not found while loading "Symfony\\Component\\Config\\Tests\\Fixtures\\BadParent".'); - $res = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ClassExistenceResource(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Fixtures\BadParent::class, \false); + $res = new ClassExistenceResource(BadParent::class, false); $res->isFresh(0); } public function testBadFileName() { $this->expectException('ReflectionException'); $this->expectExceptionMessage('Mismatch between file name and class name.'); - $res = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ClassExistenceResource(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Fixtures\BadFileName::class, \false); + $res = new ClassExistenceResource(BadFileName::class, false); $res->isFresh(0); } public function testBadFileNameBis() { $this->expectException('ReflectionException'); $this->expectExceptionMessage('Mismatch between file name and class name.'); - $res = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ClassExistenceResource(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Fixtures\BadFileName::class, \false); + $res = new ClassExistenceResource(BadFileName::class, false); $res->isFresh(0); } public function testConditionalClass() { - $res = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ClassExistenceResource(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Fixtures\Resource\ConditionalClass::class, \false); + $res = new ClassExistenceResource(ConditionalClass::class, false); $this->assertFalse($res->isFresh(0)); } /** @@ -100,7 +104,7 @@ public function testConditionalClass() public function testParseError() { $this->expectException('ParseError'); - $res = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ClassExistenceResource(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Fixtures\ParseError::class, \false); + $res = new ClassExistenceResource(ParseError::class, false); $res->isFresh(0); } } diff --git a/vendor/symfony/config/Tests/Resource/ComposerResourceTest.php b/vendor/symfony/config/Tests/Resource/ComposerResourceTest.php index a44794944..7f787fe29 100644 --- a/vendor/symfony/config/Tests/Resource/ComposerResourceTest.php +++ b/vendor/symfony/config/Tests/Resource/ComposerResourceTest.php @@ -13,16 +13,21 @@ use _PhpScoper5ea00cc67502b\Composer\Autoload\ClassLoader; use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ComposerResource; -class ComposerResourceTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use ReflectionClass; +use function serialize; +use function strpos; +use function unserialize; + +class ComposerResourceTest extends TestCase { public function testGetVendor() { - $res = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ComposerResource(); - $r = new \ReflectionClass(\_PhpScoper5ea00cc67502b\Composer\Autoload\ClassLoader::class); - $found = \false; + $res = new ComposerResource(); + $r = new ReflectionClass(ClassLoader::class); + $found = false; foreach ($res->getVendors() as $vendor) { - if ($vendor && 0 === \strpos($r->getFileName(), $vendor)) { - $found = \true; + if ($vendor && 0 === strpos($r->getFileName(), $vendor)) { + $found = true; break; } } @@ -30,8 +35,8 @@ public function testGetVendor() } public function testSerializeUnserialize() { - $res = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ComposerResource(); - $ser = \unserialize(\serialize($res)); + $res = new ComposerResource(); + $ser = unserialize(serialize($res)); $this->assertTrue($res->isFresh(0)); $this->assertTrue($ser->isFresh(0)); $this->assertEquals($res, $ser); diff --git a/vendor/symfony/config/Tests/Resource/DirectoryResourceTest.php b/vendor/symfony/config/Tests/Resource/DirectoryResourceTest.php index e5ad97d4f..2febebdf5 100644 --- a/vendor/symfony/config/Tests/Resource/DirectoryResourceTest.php +++ b/vendor/symfony/config/Tests/Resource/DirectoryResourceTest.php @@ -12,139 +12,158 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\DirectoryResource; -class DirectoryResourceTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use RecursiveDirectoryIterator; +use RecursiveIteratorIterator; +use function array_unique; +use function file_exists; +use function is_dir; +use function mkdir; +use function mt_rand; +use function preg_match; +use function realpath; +use function rmdir; +use function serialize; +use function sleep; +use function sys_get_temp_dir; +use function time; +use function touch; +use function unlink; +use function unserialize; +use const DIRECTORY_SEPARATOR; + +class DirectoryResourceTest extends TestCase { protected $directory; protected function setUp() { - $this->directory = \sys_get_temp_dir() . \DIRECTORY_SEPARATOR . 'symfonyDirectoryIterator'; - if (!\file_exists($this->directory)) { - \mkdir($this->directory); + $this->directory = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'symfonyDirectoryIterator'; + if (!file_exists($this->directory)) { + mkdir($this->directory); } - \touch($this->directory . '/tmp.xml'); + touch($this->directory . '/tmp.xml'); } protected function tearDown() { - if (!\is_dir($this->directory)) { + if (!is_dir($this->directory)) { return; } $this->removeDirectory($this->directory); } protected function removeDirectory($directory) { - $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($directory), \RecursiveIteratorIterator::CHILD_FIRST); + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory), RecursiveIteratorIterator::CHILD_FIRST); foreach ($iterator as $path) { - if (\preg_match('#[/\\\\]\\.\\.?$#', $path->__toString())) { + if (preg_match('#[/\\\\]\\.\\.?$#', $path->__toString())) { continue; } if ($path->isDir()) { - \rmdir($path->__toString()); + rmdir($path->__toString()); } else { - \unlink($path->__toString()); + unlink($path->__toString()); } } - \rmdir($directory); + rmdir($directory); } public function testGetResource() { - $resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\DirectoryResource($this->directory); - $this->assertSame(\realpath($this->directory), $resource->getResource(), '->getResource() returns the path to the resource'); + $resource = new DirectoryResource($this->directory); + $this->assertSame(realpath($this->directory), $resource->getResource(), '->getResource() returns the path to the resource'); } public function testGetPattern() { - $resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\DirectoryResource($this->directory, 'bar'); + $resource = new DirectoryResource($this->directory, 'bar'); $this->assertEquals('bar', $resource->getPattern()); } public function testResourceDoesNotExist() { $this->expectException('InvalidArgumentException'); $this->expectExceptionMessageRegExp('/The directory ".*" does not exist./'); - new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\DirectoryResource('/____foo/foobar' . \mt_rand(1, 999999)); + new DirectoryResource('/____foo/foobar' . mt_rand(1, 999999)); } public function testIsFresh() { - $resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\DirectoryResource($this->directory); - $this->assertTrue($resource->isFresh(\time() + 10), '->isFresh() returns true if the resource has not changed'); - $this->assertFalse($resource->isFresh(\time() - 86400), '->isFresh() returns false if the resource has been updated'); + $resource = new DirectoryResource($this->directory); + $this->assertTrue($resource->isFresh(time() + 10), '->isFresh() returns true if the resource has not changed'); + $this->assertFalse($resource->isFresh(time() - 86400), '->isFresh() returns false if the resource has been updated'); } public function testIsFreshForDeletedResources() { - $resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\DirectoryResource($this->directory); + $resource = new DirectoryResource($this->directory); $this->removeDirectory($this->directory); - $this->assertFalse($resource->isFresh(\time()), '->isFresh() returns false if the resource does not exist'); + $this->assertFalse($resource->isFresh(time()), '->isFresh() returns false if the resource does not exist'); } public function testIsFreshUpdateFile() { - $resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\DirectoryResource($this->directory); - \touch($this->directory . '/tmp.xml', \time() + 20); - $this->assertFalse($resource->isFresh(\time() + 10), '->isFresh() returns false if an existing file is modified'); + $resource = new DirectoryResource($this->directory); + touch($this->directory . '/tmp.xml', time() + 20); + $this->assertFalse($resource->isFresh(time() + 10), '->isFresh() returns false if an existing file is modified'); } public function testIsFreshNewFile() { - $resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\DirectoryResource($this->directory); - \touch($this->directory . '/new.xml', \time() + 20); - $this->assertFalse($resource->isFresh(\time() + 10), '->isFresh() returns false if a new file is added'); + $resource = new DirectoryResource($this->directory); + touch($this->directory . '/new.xml', time() + 20); + $this->assertFalse($resource->isFresh(time() + 10), '->isFresh() returns false if a new file is added'); } public function testIsFreshNewFileWithDifferentPattern() { - $resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\DirectoryResource($this->directory, '/.xml$/'); - \touch($this->directory . '/new.yaml', \time() + 20); - $this->assertTrue($resource->isFresh(\time() + 10), '->isFresh() returns true if a new file with a non-matching pattern is added'); + $resource = new DirectoryResource($this->directory, '/.xml$/'); + touch($this->directory . '/new.yaml', time() + 20); + $this->assertTrue($resource->isFresh(time() + 10), '->isFresh() returns true if a new file with a non-matching pattern is added'); } public function testIsFreshDeleteFile() { - $resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\DirectoryResource($this->directory); - $time = \time(); - \sleep(1); - \unlink($this->directory . '/tmp.xml'); + $resource = new DirectoryResource($this->directory); + $time = time(); + sleep(1); + unlink($this->directory . '/tmp.xml'); $this->assertFalse($resource->isFresh($time), '->isFresh() returns false if an existing file is removed'); } public function testIsFreshDeleteDirectory() { - $resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\DirectoryResource($this->directory); + $resource = new DirectoryResource($this->directory); $this->removeDirectory($this->directory); - $this->assertFalse($resource->isFresh(\time()), '->isFresh() returns false if the whole resource is removed'); + $this->assertFalse($resource->isFresh(time()), '->isFresh() returns false if the whole resource is removed'); } public function testIsFreshCreateFileInSubdirectory() { $subdirectory = $this->directory . '/subdirectory'; - \mkdir($subdirectory); - $resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\DirectoryResource($this->directory); - $this->assertTrue($resource->isFresh(\time() + 10), '->isFresh() returns true if an unmodified subdirectory exists'); - \touch($subdirectory . '/newfile.xml', \time() + 20); - $this->assertFalse($resource->isFresh(\time() + 10), '->isFresh() returns false if a new file in a subdirectory is added'); + mkdir($subdirectory); + $resource = new DirectoryResource($this->directory); + $this->assertTrue($resource->isFresh(time() + 10), '->isFresh() returns true if an unmodified subdirectory exists'); + touch($subdirectory . '/newfile.xml', time() + 20); + $this->assertFalse($resource->isFresh(time() + 10), '->isFresh() returns false if a new file in a subdirectory is added'); } public function testIsFreshModifySubdirectory() { - $resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\DirectoryResource($this->directory); + $resource = new DirectoryResource($this->directory); $subdirectory = $this->directory . '/subdirectory'; - \mkdir($subdirectory); - \touch($subdirectory, \time() + 20); - $this->assertFalse($resource->isFresh(\time() + 10), '->isFresh() returns false if a subdirectory is modified (e.g. a file gets deleted)'); + mkdir($subdirectory); + touch($subdirectory, time() + 20); + $this->assertFalse($resource->isFresh(time() + 10), '->isFresh() returns false if a subdirectory is modified (e.g. a file gets deleted)'); } public function testFilterRegexListNoMatch() { - $resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\DirectoryResource($this->directory, '/\\.(foo|xml)$/'); - \touch($this->directory . '/new.bar', \time() + 20); - $this->assertTrue($resource->isFresh(\time() + 10), '->isFresh() returns true if a new file not matching the filter regex is created'); + $resource = new DirectoryResource($this->directory, '/\\.(foo|xml)$/'); + touch($this->directory . '/new.bar', time() + 20); + $this->assertTrue($resource->isFresh(time() + 10), '->isFresh() returns true if a new file not matching the filter regex is created'); } public function testFilterRegexListMatch() { - $resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\DirectoryResource($this->directory, '/\\.(foo|xml)$/'); - \touch($this->directory . '/new.xml', \time() + 20); - $this->assertFalse($resource->isFresh(\time() + 10), '->isFresh() returns false if an new file matching the filter regex is created '); + $resource = new DirectoryResource($this->directory, '/\\.(foo|xml)$/'); + touch($this->directory . '/new.xml', time() + 20); + $this->assertFalse($resource->isFresh(time() + 10), '->isFresh() returns false if an new file matching the filter regex is created '); } public function testSerializeUnserialize() { - $resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\DirectoryResource($this->directory, '/\\.(foo|xml)$/'); - \unserialize(\serialize($resource)); - $this->assertSame(\realpath($this->directory), $resource->getResource()); + $resource = new DirectoryResource($this->directory, '/\\.(foo|xml)$/'); + unserialize(serialize($resource)); + $this->assertSame(realpath($this->directory), $resource->getResource()); $this->assertSame('/\\.(foo|xml)$/', $resource->getPattern()); } public function testResourcesWithDifferentPatternsAreDifferent() { - $resourceA = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\DirectoryResource($this->directory, '/.xml$/'); - $resourceB = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\DirectoryResource($this->directory, '/.yaml$/'); - $this->assertCount(2, \array_unique([$resourceA, $resourceB])); + $resourceA = new DirectoryResource($this->directory, '/.xml$/'); + $resourceB = new DirectoryResource($this->directory, '/.yaml$/'); + $this->assertCount(2, array_unique([$resourceA, $resourceB])); } } diff --git a/vendor/symfony/config/Tests/Resource/FileExistenceResourceTest.php b/vendor/symfony/config/Tests/Resource/FileExistenceResourceTest.php index e2a3a72ad..74cf0573c 100644 --- a/vendor/symfony/config/Tests/Resource/FileExistenceResourceTest.php +++ b/vendor/symfony/config/Tests/Resource/FileExistenceResourceTest.php @@ -12,21 +12,30 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\FileExistenceResource; -class FileExistenceResourceTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use function file_exists; +use function realpath; +use function serialize; +use function sys_get_temp_dir; +use function time; +use function touch; +use function unlink; +use function unserialize; + +class FileExistenceResourceTest extends TestCase { protected $resource; protected $file; protected $time; protected function setUp() { - $this->file = \realpath(\sys_get_temp_dir()) . '/tmp.xml'; - $this->time = \time(); - $this->resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\FileExistenceResource($this->file); + $this->file = realpath(sys_get_temp_dir()) . '/tmp.xml'; + $this->time = time(); + $this->resource = new FileExistenceResource($this->file); } protected function tearDown() { - if (\file_exists($this->file)) { - \unlink($this->file); + if (file_exists($this->file)) { + unlink($this->file); } } public function testToString() @@ -39,21 +48,21 @@ public function testGetResource() } public function testIsFreshWithExistingResource() { - \touch($this->file, $this->time); - $serialized = \serialize(new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\FileExistenceResource($this->file)); - $resource = \unserialize($serialized); + touch($this->file, $this->time); + $serialized = serialize(new FileExistenceResource($this->file)); + $resource = unserialize($serialized); $this->assertTrue($resource->isFresh($this->time), '->isFresh() returns true if the resource is still present'); - \unlink($this->file); - $resource = \unserialize($serialized); + unlink($this->file); + $resource = unserialize($serialized); $this->assertFalse($resource->isFresh($this->time), '->isFresh() returns false if the resource has been deleted'); } public function testIsFreshWithAbsentResource() { - $serialized = \serialize(new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\FileExistenceResource($this->file)); - $resource = \unserialize($serialized); + $serialized = serialize(new FileExistenceResource($this->file)); + $resource = unserialize($serialized); $this->assertTrue($resource->isFresh($this->time), '->isFresh() returns true if the resource is still absent'); - \touch($this->file, $this->time); - $resource = \unserialize($serialized); + touch($this->file, $this->time); + $resource = unserialize($serialized); $this->assertFalse($resource->isFresh($this->time), '->isFresh() returns false if the resource has been created'); } } diff --git a/vendor/symfony/config/Tests/Resource/FileResourceTest.php b/vendor/symfony/config/Tests/Resource/FileResourceTest.php index 844fd36e7..0fa8374f2 100644 --- a/vendor/symfony/config/Tests/Resource/FileResourceTest.php +++ b/vendor/symfony/config/Tests/Resource/FileResourceTest.php @@ -12,43 +12,53 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\FileResource; -class FileResourceTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use function file_exists; +use function mt_rand; +use function realpath; +use function serialize; +use function sys_get_temp_dir; +use function time; +use function touch; +use function unlink; +use function unserialize; + +class FileResourceTest extends TestCase { protected $resource; protected $file; protected $time; protected function setUp() { - $this->file = \sys_get_temp_dir() . '/tmp.xml'; - $this->time = \time(); - \touch($this->file, $this->time); - $this->resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\FileResource($this->file); + $this->file = sys_get_temp_dir() . '/tmp.xml'; + $this->time = time(); + touch($this->file, $this->time); + $this->resource = new FileResource($this->file); } protected function tearDown() { - if (!\file_exists($this->file)) { + if (!file_exists($this->file)) { return; } - \unlink($this->file); + unlink($this->file); } public function testGetResource() { - $this->assertSame(\realpath($this->file), $this->resource->getResource(), '->getResource() returns the path to the resource'); + $this->assertSame(realpath($this->file), $this->resource->getResource(), '->getResource() returns the path to the resource'); } public function testGetResourceWithScheme() { - $resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\FileResource('file://' . $this->file); + $resource = new FileResource('file://' . $this->file); $this->assertSame('file://' . $this->file, $resource->getResource(), '->getResource() returns the path to the schemed resource'); } public function testToString() { - $this->assertSame(\realpath($this->file), (string) $this->resource); + $this->assertSame(realpath($this->file), (string) $this->resource); } public function testResourceDoesNotExist() { $this->expectException('InvalidArgumentException'); $this->expectExceptionMessageRegExp('/The file ".*" does not exist./'); - new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\FileResource('/____foo/foobar' . \mt_rand(1, 999999)); + new FileResource('/____foo/foobar' . mt_rand(1, 999999)); } public function testIsFresh() { @@ -58,12 +68,12 @@ public function testIsFresh() } public function testIsFreshForDeletedResources() { - \unlink($this->file); + unlink($this->file); $this->assertFalse($this->resource->isFresh($this->time), '->isFresh() returns false if the resource does not exist'); } public function testSerializeUnserialize() { - \unserialize(\serialize($this->resource)); - $this->assertSame(\realpath($this->file), $this->resource->getResource()); + unserialize(serialize($this->resource)); + $this->assertSame(realpath($this->file), $this->resource->getResource()); } } diff --git a/vendor/symfony/config/Tests/Resource/GlobResourceTest.php b/vendor/symfony/config/Tests/Resource/GlobResourceTest.php index a9765775a..53e109fb1 100644 --- a/vendor/symfony/config/Tests/Resource/GlobResourceTest.php +++ b/vendor/symfony/config/Tests/Resource/GlobResourceTest.php @@ -12,77 +12,87 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\GlobResource; -class GlobResourceTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use SplFileInfo; +use function current; +use function dirname; +use function iterator_to_array; +use function mkdir; +use function rmdir; +use function touch; +use function unlink; +use const DIRECTORY_SEPARATOR; + +class GlobResourceTest extends TestCase { protected function tearDown() { - $dir = \dirname(__DIR__) . '/Fixtures'; - @\rmdir($dir . '/TmpGlob'); - @\unlink($dir . '/TmpGlob'); - @\unlink($dir . '/Resource/TmpGlob'); - \touch($dir . '/Resource/.hiddenFile'); + $dir = dirname(__DIR__) . '/Fixtures'; + @rmdir($dir . '/TmpGlob'); + @unlink($dir . '/TmpGlob'); + @unlink($dir . '/Resource/TmpGlob'); + touch($dir . '/Resource/.hiddenFile'); } public function testIterator() { - $dir = \dirname(__DIR__) . \DIRECTORY_SEPARATOR . 'Fixtures'; - $resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\GlobResource($dir, '/Resource', \true); - $paths = \iterator_to_array($resource); - $file = $dir . '/Resource' . \DIRECTORY_SEPARATOR . 'ConditionalClass.php'; - $this->assertEquals([$file => new \SplFileInfo($file)], $paths); - $this->assertInstanceOf('SplFileInfo', \current($paths)); + $dir = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'Fixtures'; + $resource = new GlobResource($dir, '/Resource', true); + $paths = iterator_to_array($resource); + $file = $dir . '/Resource' . DIRECTORY_SEPARATOR . 'ConditionalClass.php'; + $this->assertEquals([$file => new SplFileInfo($file)], $paths); + $this->assertInstanceOf('SplFileInfo', current($paths)); $this->assertSame($dir, $resource->getPrefix()); - $resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\GlobResource($dir, '/**/Resource', \true); - $paths = \iterator_to_array($resource); - $file = $dir . \DIRECTORY_SEPARATOR . 'Resource' . \DIRECTORY_SEPARATOR . 'ConditionalClass.php'; + $resource = new GlobResource($dir, '/**/Resource', true); + $paths = iterator_to_array($resource); + $file = $dir . DIRECTORY_SEPARATOR . 'Resource' . DIRECTORY_SEPARATOR . 'ConditionalClass.php'; $this->assertEquals([$file => $file], $paths); - $this->assertInstanceOf('SplFileInfo', \current($paths)); + $this->assertInstanceOf('SplFileInfo', current($paths)); $this->assertSame($dir, $resource->getPrefix()); } public function testIsFreshNonRecursiveDetectsNewFile() { - $dir = \dirname(__DIR__) . '/Fixtures'; - $resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\GlobResource($dir, '/*', \false); + $dir = dirname(__DIR__) . '/Fixtures'; + $resource = new GlobResource($dir, '/*', false); $this->assertTrue($resource->isFresh(0)); - \mkdir($dir . '/TmpGlob'); + mkdir($dir . '/TmpGlob'); $this->assertTrue($resource->isFresh(0)); - \rmdir($dir . '/TmpGlob'); + rmdir($dir . '/TmpGlob'); $this->assertTrue($resource->isFresh(0)); - \touch($dir . '/TmpGlob'); + touch($dir . '/TmpGlob'); $this->assertFalse($resource->isFresh(0)); - \unlink($dir . '/TmpGlob'); + unlink($dir . '/TmpGlob'); $this->assertTrue($resource->isFresh(0)); } public function testIsFreshNonRecursiveDetectsRemovedFile() { - $dir = \dirname(__DIR__) . '/Fixtures'; - $resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\GlobResource($dir, '/*', \false); - \touch($dir . '/TmpGlob'); - \touch($dir . '/.TmpGlob'); + $dir = dirname(__DIR__) . '/Fixtures'; + $resource = new GlobResource($dir, '/*', false); + touch($dir . '/TmpGlob'); + touch($dir . '/.TmpGlob'); $this->assertTrue($resource->isFresh(0)); - \unlink($dir . '/.TmpGlob'); + unlink($dir . '/.TmpGlob'); $this->assertTrue($resource->isFresh(0)); - \unlink($dir . '/TmpGlob'); + unlink($dir . '/TmpGlob'); $this->assertFalse($resource->isFresh(0)); } public function testIsFreshRecursiveDetectsRemovedFile() { - $dir = \dirname(__DIR__) . '/Fixtures'; - $resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\GlobResource($dir, '/*', \true); - \touch($dir . '/Resource/TmpGlob'); + $dir = dirname(__DIR__) . '/Fixtures'; + $resource = new GlobResource($dir, '/*', true); + touch($dir . '/Resource/TmpGlob'); $this->assertTrue($resource->isFresh(0)); - \unlink($dir . '/Resource/TmpGlob'); + unlink($dir . '/Resource/TmpGlob'); $this->assertFalse($resource->isFresh(0)); - \touch($dir . '/Resource/TmpGlob'); + touch($dir . '/Resource/TmpGlob'); $this->assertTrue($resource->isFresh(0)); - \unlink($dir . '/Resource/.hiddenFile'); + unlink($dir . '/Resource/.hiddenFile'); $this->assertTrue($resource->isFresh(0)); } public function testIsFreshRecursiveDetectsNewFile() { - $dir = \dirname(__DIR__) . '/Fixtures'; - $resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\GlobResource($dir, '/*', \true); + $dir = dirname(__DIR__) . '/Fixtures'; + $resource = new GlobResource($dir, '/*', true); $this->assertTrue($resource->isFresh(0)); - \touch($dir . '/Resource/TmpGlob'); + touch($dir . '/Resource/TmpGlob'); $this->assertFalse($resource->isFresh(0)); } } diff --git a/vendor/symfony/config/Tests/Resource/ReflectionClassResourceTest.php b/vendor/symfony/config/Tests/Resource/ReflectionClassResourceTest.php index ab738f0b0..0c9433a77 100644 --- a/vendor/symfony/config/Tests/Resource/ReflectionClassResourceTest.php +++ b/vendor/symfony/config/Tests/Resource/ReflectionClassResourceTest.php @@ -14,38 +14,55 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ReflectionClassResource; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceSubscriberInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\EventDispatcher\EventSubscriberInterface; -class ReflectionClassResourceTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use ReflectionClass; +use function define; +use function explode; +use function file_put_contents; +use function filemtime; +use function implode; +use function iterator_to_array; +use function serialize; +use function sprintf; +use function str_replace; +use function sys_get_temp_dir; +use function time; +use function uniqid; +use function unlink; +use function unserialize; +use const PHP_VERSION_ID; + +class ReflectionClassResourceTest extends TestCase { public function testToString() { - $res = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ReflectionClassResource(new \ReflectionClass('ErrorException')); + $res = new ReflectionClassResource(new ReflectionClass('ErrorException')); $this->assertSame('reflection.ErrorException', (string) $res); } public function testSerializeUnserialize() { - $res = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ReflectionClassResource(new \ReflectionClass(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Resource\DummyInterface::class)); - $ser = \unserialize(\serialize($res)); + $res = new ReflectionClassResource(new ReflectionClass(DummyInterface::class)); + $ser = unserialize(serialize($res)); $this->assertTrue($res->isFresh(0)); $this->assertTrue($ser->isFresh(0)); $this->assertSame((string) $res, (string) $ser); } public function testIsFresh() { - $res = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ReflectionClassResource(new \ReflectionClass(__CLASS__)); - $mtime = \filemtime(__FILE__); + $res = new ReflectionClassResource(new ReflectionClass(__CLASS__)); + $mtime = filemtime(__FILE__); $this->assertTrue($res->isFresh($mtime), '->isFresh() returns true if the resource has not changed in same second'); $this->assertTrue($res->isFresh($mtime + 10), '->isFresh() returns true if the resource has not changed'); $this->assertTrue($res->isFresh($mtime - 86400), '->isFresh() returns true if the resource has not changed'); } public function testIsFreshForDeletedResources() { - $now = \time(); - $tmp = \sys_get_temp_dir() . '/tmp.php'; - \file_put_contents($tmp, 'assertTrue($res->isFresh($now)); - \unlink($tmp); + unlink($tmp); $this->assertFalse($res->isFresh($now), '->isFresh() returns false if the resource does not exist'); } /** @@ -79,19 +96,19 @@ public function testHashedSignature($changeExpected, $changedLine, $changedCode, EOPHP; static $expectedSignature, $generateSignature; if (null === $expectedSignature) { - eval(\sprintf($code, $class = 'Foo' . \str_replace('.', '_', \uniqid('', \true)))); - $r = new \ReflectionClass(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ReflectionClassResource::class); + eval(sprintf($code, $class = 'Foo' . str_replace('.', '_', uniqid('', true)))); + $r = new ReflectionClass(ReflectionClassResource::class); $generateSignature = $r->getMethod('generateSignature'); - $generateSignature->setAccessible(\true); + $generateSignature->setAccessible(true); $generateSignature = $generateSignature->getClosure($r->newInstanceWithoutConstructor()); - $expectedSignature = \implode("\n", \iterator_to_array($generateSignature(new \ReflectionClass($class)))); + $expectedSignature = implode("\n", iterator_to_array($generateSignature(new ReflectionClass($class)))); } - $code = \explode("\n", $code); + $code = explode("\n", $code); if (null !== $changedCode) { $code[$changedLine] = $changedCode; } - eval(\sprintf(\implode("\n", $code), $class = 'Foo' . \str_replace('.', '_', \uniqid('', \true)))); - $signature = \implode("\n", \iterator_to_array($generateSignature(new \ReflectionClass($class)))); + eval(sprintf(implode("\n", $code), $class = 'Foo' . str_replace('.', '_', uniqid('', true)))); + $signature = implode("\n", iterator_to_array($generateSignature(new ReflectionClass($class)))); if ($changeExpected) { $this->assertNotSame($expectedSignature, $signature); } else { @@ -105,7 +122,7 @@ public function provideHashedSignature() (yield [1, 1, 'abstract class %s']); (yield [1, 1, 'final class %s']); (yield [1, 1, 'class %s extends Exception']); - (yield [1, 1, 'class %s implements ' . \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Resource\DummyInterface::class]); + (yield [1, 1, 'class %s implements ' . DummyInterface::class]); (yield [1, 3, 'const FOO = 456;']); (yield [1, 3, 'const BAR = 123;']); (yield [1, 4, '/** pub docblock */']); @@ -116,10 +133,10 @@ public function provideHashedSignature() (yield [0, 8, '/** priv docblock */']); (yield [0, 9, 'private $priv = 123;']); (yield [1, 10, '/** pub docblock */']); - if (\PHP_VERSION_ID >= 50600) { + if (PHP_VERSION_ID >= 50600) { (yield [1, 11, 'public function pub(...$arg) {}']); } - if (\PHP_VERSION_ID >= 70000) { + if (PHP_VERSION_ID >= 70000) { (yield [1, 11, 'public function pub($arg = null): Foo {}']); } (yield [0, 11, "public function pub(\$arg = null) {\nreturn 123;\n}"]); @@ -127,7 +144,7 @@ public function provideHashedSignature() (yield [1, 13, 'protected function prot($a = [123]) {}']); (yield [0, 14, '/** priv docblock */']); (yield [0, 15, '']); - if (\PHP_VERSION_ID >= 70400) { + if (PHP_VERSION_ID >= 70400) { // PHP7.4 typed properties without default value are // undefined, make sure this doesn't throw an error (yield [1, 5, 'public array $pub;']); @@ -137,39 +154,39 @@ public function provideHashedSignature() (yield [1, 17, 'public function ccc($bar = 187) {}']); (yield [1, 17, 'public function ccc($bar = ANOTHER_ONE_THAT_WILL_NEVER_BE_DEFINED_CCCCCCCCC) {}']); (yield [1, 17, null, static function () { - \define('A_CONSTANT_THAT_FOR_SURE_WILL_NEVER_BE_DEFINED_CCCCCC', 'foo'); + define('A_CONSTANT_THAT_FOR_SURE_WILL_NEVER_BE_DEFINED_CCCCCC', 'foo'); }]); } public function testEventSubscriber() { - $res = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ReflectionClassResource(new \ReflectionClass(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Resource\TestEventSubscriber::class)); + $res = new ReflectionClassResource(new ReflectionClass(TestEventSubscriber::class)); $this->assertTrue($res->isFresh(0)); - \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Resource\TestEventSubscriber::$subscribedEvents = [123]; + TestEventSubscriber::$subscribedEvents = [123]; $this->assertFalse($res->isFresh(0)); - $res = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ReflectionClassResource(new \ReflectionClass(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Resource\TestEventSubscriber::class)); + $res = new ReflectionClassResource(new ReflectionClass(TestEventSubscriber::class)); $this->assertTrue($res->isFresh(0)); } public function testServiceSubscriber() { - $res = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ReflectionClassResource(new \ReflectionClass(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Resource\TestServiceSubscriber::class)); + $res = new ReflectionClassResource(new ReflectionClass(TestServiceSubscriber::class)); $this->assertTrue($res->isFresh(0)); - \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Resource\TestServiceSubscriber::$subscribedServices = [123]; + TestServiceSubscriber::$subscribedServices = [123]; $this->assertFalse($res->isFresh(0)); - $res = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ReflectionClassResource(new \ReflectionClass(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Resource\TestServiceSubscriber::class)); + $res = new ReflectionClassResource(new ReflectionClass(TestServiceSubscriber::class)); $this->assertTrue($res->isFresh(0)); } public function testIgnoresObjectsInSignature() { - $res = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ReflectionClassResource(new \ReflectionClass(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Resource\TestServiceWithStaticProperty::class)); + $res = new ReflectionClassResource(new ReflectionClass(TestServiceWithStaticProperty::class)); $this->assertTrue($res->isFresh(0)); - \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Resource\TestServiceWithStaticProperty::$initializedObject = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Resource\TestServiceWithStaticProperty(); + TestServiceWithStaticProperty::$initializedObject = new TestServiceWithStaticProperty(); $this->assertTrue($res->isFresh(0)); } } interface DummyInterface { } -class TestEventSubscriber implements \_PhpScoper5ea00cc67502b\Symfony\Component\EventDispatcher\EventSubscriberInterface +class TestEventSubscriber implements EventSubscriberInterface { public static $subscribedEvents = []; public static function getSubscribedEvents() @@ -177,7 +194,7 @@ public static function getSubscribedEvents() return self::$subscribedEvents; } } -class TestServiceSubscriber implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceSubscriberInterface +class TestServiceSubscriber implements ServiceSubscriberInterface { public static $subscribedServices = []; public static function getSubscribedServices() diff --git a/vendor/symfony/config/Tests/Resource/ResourceStub.php b/vendor/symfony/config/Tests/Resource/ResourceStub.php index a39abc45b..b17510658 100644 --- a/vendor/symfony/config/Tests/Resource/ResourceStub.php +++ b/vendor/symfony/config/Tests/Resource/ResourceStub.php @@ -11,9 +11,9 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Resource; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\SelfCheckingResourceInterface; -class ResourceStub implements \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\SelfCheckingResourceInterface +class ResourceStub implements SelfCheckingResourceInterface { - private $fresh = \true; + private $fresh = true; public function setFresh($isFresh) { $this->fresh = $isFresh; diff --git a/vendor/symfony/config/Tests/Resource/index.php b/vendor/symfony/config/Tests/Resource/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/config/Tests/Resource/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/config/Tests/ResourceCheckerConfigCacheTest.php b/vendor/symfony/config/Tests/ResourceCheckerConfigCacheTest.php index 8753de768..e8aef6ce9 100644 --- a/vendor/symfony/config/Tests/ResourceCheckerConfigCacheTest.php +++ b/vendor/symfony/config/Tests/ResourceCheckerConfigCacheTest.php @@ -14,25 +14,34 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\FileResource; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\ResourceCheckerConfigCache; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Resource\ResourceStub; -class ResourceCheckerConfigCacheTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use ArrayIterator; +use function file_exists; +use function file_get_contents; +use function file_put_contents; +use function str_replace; +use function sys_get_temp_dir; +use function tempnam; +use function unlink; + +class ResourceCheckerConfigCacheTest extends TestCase { private $cacheFile = null; protected function setUp() { - $this->cacheFile = \tempnam(\sys_get_temp_dir(), 'config_'); + $this->cacheFile = tempnam(sys_get_temp_dir(), 'config_'); } protected function tearDown() { $files = [$this->cacheFile, "{$this->cacheFile}.meta"]; foreach ($files as $file) { - if (\file_exists($file)) { - \unlink($file); + if (file_exists($file)) { + unlink($file); } } } public function testGetPath() { - $cache = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\ResourceCheckerConfigCache($this->cacheFile); + $cache = new ResourceCheckerConfigCache($this->cacheFile); $this->assertSame($this->cacheFile, $cache->getPath()); } public function testCacheIsNotFreshIfEmpty() @@ -40,71 +49,71 @@ public function testCacheIsNotFreshIfEmpty() $checker = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\ResourceCheckerInterface')->getMock()->expects($this->never())->method('supports'); /* If there is nothing in the cache, it needs to be filled (and thus it's not fresh). It does not matter if you provide checkers or not. */ - \unlink($this->cacheFile); + unlink($this->cacheFile); // remove tempnam() side effect - $cache = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\ResourceCheckerConfigCache($this->cacheFile, [$checker]); + $cache = new ResourceCheckerConfigCache($this->cacheFile, [$checker]); $this->assertFalse($cache->isFresh()); } public function testCacheIsFreshIfNoCheckerProvided() { /* For example in prod mode, you may choose not to run any checkers at all. In that case, the cache should always be considered fresh. */ - $cache = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\ResourceCheckerConfigCache($this->cacheFile); + $cache = new ResourceCheckerConfigCache($this->cacheFile); $this->assertTrue($cache->isFresh()); } public function testCacheIsFreshIfEmptyCheckerIteratorProvided() { - $cache = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\ResourceCheckerConfigCache($this->cacheFile, new \ArrayIterator([])); + $cache = new ResourceCheckerConfigCache($this->cacheFile, new ArrayIterator([])); $this->assertTrue($cache->isFresh()); } public function testResourcesWithoutcheckersAreIgnoredAndConsideredFresh() { /* As in the previous test, but this time we have a resource. */ - $cache = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\ResourceCheckerConfigCache($this->cacheFile); - $cache->write('', [new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Resource\ResourceStub()]); + $cache = new ResourceCheckerConfigCache($this->cacheFile); + $cache->write('', [new ResourceStub()]); $this->assertTrue($cache->isFresh()); // no (matching) ResourceChecker passed } public function testIsFreshWithchecker() { $checker = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\ResourceCheckerInterface')->getMock(); - $checker->expects($this->once())->method('supports')->willReturn(\true); - $checker->expects($this->once())->method('isFresh')->willReturn(\true); - $cache = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\ResourceCheckerConfigCache($this->cacheFile, [$checker]); - $cache->write('', [new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Resource\ResourceStub()]); + $checker->expects($this->once())->method('supports')->willReturn(true); + $checker->expects($this->once())->method('isFresh')->willReturn(true); + $cache = new ResourceCheckerConfigCache($this->cacheFile, [$checker]); + $cache->write('', [new ResourceStub()]); $this->assertTrue($cache->isFresh()); } public function testIsNotFreshWithchecker() { $checker = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\ResourceCheckerInterface')->getMock(); - $checker->expects($this->once())->method('supports')->willReturn(\true); - $checker->expects($this->once())->method('isFresh')->willReturn(\false); - $cache = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\ResourceCheckerConfigCache($this->cacheFile, [$checker]); - $cache->write('', [new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Resource\ResourceStub()]); + $checker->expects($this->once())->method('supports')->willReturn(true); + $checker->expects($this->once())->method('isFresh')->willReturn(false); + $cache = new ResourceCheckerConfigCache($this->cacheFile, [$checker]); + $cache->write('', [new ResourceStub()]); $this->assertFalse($cache->isFresh()); } public function testCacheIsNotFreshWhenUnserializeFails() { $checker = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\ResourceCheckerInterface')->getMock(); - $cache = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\ResourceCheckerConfigCache($this->cacheFile, [$checker]); - $cache->write('foo', [new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\FileResource(__FILE__)]); + $cache = new ResourceCheckerConfigCache($this->cacheFile, [$checker]); + $cache->write('foo', [new FileResource(__FILE__)]); $metaFile = "{$this->cacheFile}.meta"; - \file_put_contents($metaFile, \str_replace('FileResource', 'ClassNotHere', \file_get_contents($metaFile))); + file_put_contents($metaFile, str_replace('FileResource', 'ClassNotHere', file_get_contents($metaFile))); $this->assertFalse($cache->isFresh()); } public function testCacheKeepsContent() { - $cache = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\ResourceCheckerConfigCache($this->cacheFile); + $cache = new ResourceCheckerConfigCache($this->cacheFile); $cache->write('FOOBAR'); - $this->assertSame('FOOBAR', \file_get_contents($cache->getPath())); + $this->assertSame('FOOBAR', file_get_contents($cache->getPath())); } public function testCacheIsNotFreshIfNotExistsMetaFile() { $checker = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\ResourceCheckerInterface')->getMock(); - $cache = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\ResourceCheckerConfigCache($this->cacheFile, [$checker]); - $cache->write('foo', [new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\FileResource(__FILE__)]); + $cache = new ResourceCheckerConfigCache($this->cacheFile, [$checker]); + $cache->write('foo', [new FileResource(__FILE__)]); $metaFile = "{$this->cacheFile}.meta"; - \unlink($metaFile); + unlink($metaFile); $this->assertFalse($cache->isFresh()); } } diff --git a/vendor/symfony/config/Tests/Util/XmlUtilsTest.php b/vendor/symfony/config/Tests/Util/XmlUtilsTest.php index dede1d13d..a0fa49230 100644 --- a/vendor/symfony/config/Tests/Util/XmlUtilsTest.php +++ b/vendor/symfony/config/Tests/Util/XmlUtilsTest.php @@ -12,144 +12,159 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils; -class XmlUtilsTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use DOMDocument; +use Exception; +use InvalidArgumentException; +use function chmod; +use function error_reporting; +use function file_get_contents; +use function libxml_clear_errors; +use function libxml_disable_entity_loader; +use function libxml_get_errors; +use function libxml_use_internal_errors; +use function restore_error_handler; +use function set_error_handler; +use function sprintf; +use const DIRECTORY_SEPARATOR; + +class XmlUtilsTest extends TestCase { public function testLoadFile() { $fixtures = __DIR__ . '/../Fixtures/Util/'; try { - \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::loadFile($fixtures); + XmlUtils::loadFile($fixtures); $this->fail(); - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $this->assertStringContainsString('is not a file', $e->getMessage()); } try { - \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::loadFile($fixtures . 'non_existing.xml'); + XmlUtils::loadFile($fixtures . 'non_existing.xml'); $this->fail(); - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $this->assertStringContainsString('is not a file', $e->getMessage()); } try { - if ('\\' === \DIRECTORY_SEPARATOR) { + if ('\\' === DIRECTORY_SEPARATOR) { $this->markTestSkipped('chmod is not supported on Windows'); } - \chmod($fixtures . 'not_readable.xml', 00); - \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::loadFile($fixtures . 'not_readable.xml'); + chmod($fixtures . 'not_readable.xml', 00); + XmlUtils::loadFile($fixtures . 'not_readable.xml'); $this->fail(); - } catch (\InvalidArgumentException $e) { - \chmod($fixtures . 'not_readable.xml', 0644); + } catch (InvalidArgumentException $e) { + chmod($fixtures . 'not_readable.xml', 0644); $this->assertStringContainsString('is not readable', $e->getMessage()); } try { - \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::loadFile($fixtures . 'invalid.xml'); + XmlUtils::loadFile($fixtures . 'invalid.xml'); $this->fail(); - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $this->assertStringContainsString('ERROR ', $e->getMessage()); } try { - \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::loadFile($fixtures . 'document_type.xml'); + XmlUtils::loadFile($fixtures . 'document_type.xml'); $this->fail(); - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $this->assertStringContainsString('Document types are not allowed', $e->getMessage()); } try { - \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::loadFile($fixtures . 'invalid_schema.xml', $fixtures . 'schema.xsd'); + XmlUtils::loadFile($fixtures . 'invalid_schema.xml', $fixtures . 'schema.xsd'); $this->fail(); - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $this->assertStringContainsString('ERROR 1845', $e->getMessage()); } try { - \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::loadFile($fixtures . 'invalid_schema.xml', 'invalid_callback_or_file'); + XmlUtils::loadFile($fixtures . 'invalid_schema.xml', 'invalid_callback_or_file'); $this->fail(); - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $this->assertStringContainsString('XSD file or callable', $e->getMessage()); } - $mock = $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Util\Validator::class)->getMock(); - $mock->expects($this->exactly(2))->method('validate')->will($this->onConsecutiveCalls(\false, \true)); + $mock = $this->getMockBuilder(Validator::class)->getMock(); + $mock->expects($this->exactly(2))->method('validate')->will($this->onConsecutiveCalls(false, true)); try { - \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::loadFile($fixtures . 'valid.xml', [$mock, 'validate']); + XmlUtils::loadFile($fixtures . 'valid.xml', [$mock, 'validate']); $this->fail(); - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $this->assertRegExp('/The XML file ".+" is not valid\\./', $e->getMessage()); } - $this->assertInstanceOf('DOMDocument', \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::loadFile($fixtures . 'valid.xml', [$mock, 'validate'])); - $this->assertSame([], \libxml_get_errors()); + $this->assertInstanceOf('DOMDocument', XmlUtils::loadFile($fixtures . 'valid.xml', [$mock, 'validate'])); + $this->assertSame([], libxml_get_errors()); } public function testParseWithInvalidValidatorCallable() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Util\\Exception\\InvalidXmlException'); $this->expectExceptionMessage('The XML is not valid'); $fixtures = __DIR__ . '/../Fixtures/Util/'; - $mock = $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Tests\Util\Validator::class)->getMock(); - $mock->expects($this->once())->method('validate')->willReturn(\false); - \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::parse(\file_get_contents($fixtures . 'valid.xml'), [$mock, 'validate']); + $mock = $this->getMockBuilder(Validator::class)->getMock(); + $mock->expects($this->once())->method('validate')->willReturn(false); + XmlUtils::parse(file_get_contents($fixtures . 'valid.xml'), [$mock, 'validate']); } public function testLoadFileWithInternalErrorsEnabled() { - $internalErrors = \libxml_use_internal_errors(\true); - $this->assertSame([], \libxml_get_errors()); - $this->assertInstanceOf('DOMDocument', \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::loadFile(__DIR__ . '/../Fixtures/Util/invalid_schema.xml')); - $this->assertSame([], \libxml_get_errors()); - \libxml_clear_errors(); - \libxml_use_internal_errors($internalErrors); + $internalErrors = libxml_use_internal_errors(true); + $this->assertSame([], libxml_get_errors()); + $this->assertInstanceOf('DOMDocument', XmlUtils::loadFile(__DIR__ . '/../Fixtures/Util/invalid_schema.xml')); + $this->assertSame([], libxml_get_errors()); + libxml_clear_errors(); + libxml_use_internal_errors($internalErrors); } /** * @dataProvider getDataForConvertDomToArray */ - public function testConvertDomToArray($expected, $xml, $root = \false, $checkPrefix = \true) + public function testConvertDomToArray($expected, $xml, $root = false, $checkPrefix = true) { - $dom = new \DOMDocument(); + $dom = new DOMDocument(); $dom->loadXML($root ? $xml : '' . $xml . ''); - $this->assertSame($expected, \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::convertDomElementToArray($dom->documentElement, $checkPrefix)); + $this->assertSame($expected, XmlUtils::convertDomElementToArray($dom->documentElement, $checkPrefix)); } public function getDataForConvertDomToArray() { - return [[null, ''], ['bar', 'bar'], [['bar' => 'foobar'], '', \true], [['foo' => null], ''], [['foo' => 'bar'], 'bar'], [['foo' => ['foo' => 'bar']], ''], [['foo' => ['foo' => 0]], '0'], [['foo' => ['foo' => 'bar']], 'bar'], [['foo' => ['foo' => 'bar', 'value' => 'text']], 'text'], [['foo' => ['attr' => 'bar', 'foo' => 'text']], 'text'], [['foo' => ['bar', 'text']], 'bartext'], [['foo' => [['foo' => 'bar'], ['foo' => 'text']]], ''], [['foo' => ['foo' => ['bar', 'text']]], 'text'], [['foo' => 'bar'], 'bar'], [['foo' => 'text'], 'text'], [['foo' => ['bar' => 'bar', 'value' => 'text']], 'text', \false, \false], [['attr' => 1, 'b' => 'hello'], 'hello2', \true]]; + return [[null, ''], ['bar', 'bar'], [['bar' => 'foobar'], '', true], [['foo' => null], ''], [['foo' => 'bar'], 'bar'], [['foo' => ['foo' => 'bar']], ''], [['foo' => ['foo' => 0]], '0'], [['foo' => ['foo' => 'bar']], 'bar'], [['foo' => ['foo' => 'bar', 'value' => 'text']], 'text'], [['foo' => ['attr' => 'bar', 'foo' => 'text']], 'text'], [['foo' => ['bar', 'text']], 'bartext'], [['foo' => [['foo' => 'bar'], ['foo' => 'text']]], ''], [['foo' => ['foo' => ['bar', 'text']]], 'text'], [['foo' => 'bar'], 'bar'], [['foo' => 'text'], 'text'], [['foo' => ['bar' => 'bar', 'value' => 'text']], 'text', false, false], [['attr' => 1, 'b' => 'hello'], 'hello2', true]]; } /** * @dataProvider getDataForPhpize */ public function testPhpize($expected, $value) { - $this->assertSame($expected, \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::phpize($value)); + $this->assertSame($expected, XmlUtils::phpize($value)); } public function getDataForPhpize() { - return [['', ''], [null, 'null'], [\true, 'true'], [\false, 'false'], [null, 'Null'], [\true, 'True'], [\false, 'False'], [0, '0'], [1, '1'], [-1, '-1'], [0777, '0777'], [255, '0xFF'], [100.0, '1e2'], [-120.0, '-1.2E2'], [-10100.1, '-10100.1'], ['-10,100.1', '-10,100.1'], ['1234 5678 9101 1121 3141', '1234 5678 9101 1121 3141'], ['1,2,3,4', '1,2,3,4'], ['11,22,33,44', '11,22,33,44'], ['11,222,333,4', '11,222,333,4'], ['1,222,333,444', '1,222,333,444'], ['11,222,333,444', '11,222,333,444'], ['111,222,333,444', '111,222,333,444'], ['1111,2222,3333,4444,5555', '1111,2222,3333,4444,5555'], ['foo', 'foo'], [6, '0b0110']]; + return [['', ''], [null, 'null'], [true, 'true'], [false, 'false'], [null, 'Null'], [true, 'True'], [false, 'False'], [0, '0'], [1, '1'], [-1, '-1'], [0777, '0777'], [255, '0xFF'], [100.0, '1e2'], [-120.0, '-1.2E2'], [-10100.1, '-10100.1'], ['-10,100.1', '-10,100.1'], ['1234 5678 9101 1121 3141', '1234 5678 9101 1121 3141'], ['1,2,3,4', '1,2,3,4'], ['11,22,33,44', '11,22,33,44'], ['11,222,333,4', '11,222,333,4'], ['1,222,333,444', '1,222,333,444'], ['11,222,333,444', '11,222,333,444'], ['111,222,333,444', '111,222,333,444'], ['1111,2222,3333,4444,5555', '1111,2222,3333,4444,5555'], ['foo', 'foo'], [6, '0b0110']]; } public function testLoadEmptyXmlFile() { $file = __DIR__ . '/../Fixtures/foo.xml'; $this->expectException('InvalidArgumentException'); - $this->expectExceptionMessage(\sprintf('File "%s" does not contain valid XML, it is empty.', $file)); - \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::loadFile($file); + $this->expectExceptionMessage(sprintf('File "%s" does not contain valid XML, it is empty.', $file)); + XmlUtils::loadFile($file); } // test for issue https://github.com/symfony/symfony/issues/9731 public function testLoadWrongEmptyXMLWithErrorHandler() { - $originalDisableEntities = \libxml_disable_entity_loader(\false); - $errorReporting = \error_reporting(-1); - \set_error_handler(function ($errno, $errstr) { - throw new \Exception($errstr, $errno); + $originalDisableEntities = libxml_disable_entity_loader(false); + $errorReporting = error_reporting(-1); + set_error_handler(function ($errno, $errstr) { + throw new Exception($errstr, $errno); }); $file = __DIR__ . '/../Fixtures/foo.xml'; try { try { - \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::loadFile($file); + XmlUtils::loadFile($file); $this->fail('An exception should have been raised'); - } catch (\InvalidArgumentException $e) { - $this->assertEquals(\sprintf('File "%s" does not contain valid XML, it is empty.', $file), $e->getMessage()); + } catch (InvalidArgumentException $e) { + $this->assertEquals(sprintf('File "%s" does not contain valid XML, it is empty.', $file), $e->getMessage()); } } finally { - \restore_error_handler(); - \error_reporting($errorReporting); + restore_error_handler(); + error_reporting($errorReporting); } - $disableEntities = \libxml_disable_entity_loader(\true); - \libxml_disable_entity_loader($disableEntities); - \libxml_disable_entity_loader($originalDisableEntities); + $disableEntities = libxml_disable_entity_loader(true); + libxml_disable_entity_loader($disableEntities); + libxml_disable_entity_loader($originalDisableEntities); $this->assertFalse($disableEntities); // should not throw an exception - \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::loadFile(__DIR__ . '/../Fixtures/Util/valid.xml', __DIR__ . '/../Fixtures/Util/schema.xsd'); + XmlUtils::loadFile(__DIR__ . '/../Fixtures/Util/valid.xml', __DIR__ . '/../Fixtures/Util/schema.xsd'); } } interface Validator diff --git a/vendor/symfony/config/Tests/Util/index.php b/vendor/symfony/config/Tests/Util/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/config/Tests/Util/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/config/Tests/index.php b/vendor/symfony/config/Tests/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/config/Tests/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/config/Util/Exception/InvalidXmlException.php b/vendor/symfony/config/Util/Exception/InvalidXmlException.php index e2bc9a0f4..c51608150 100644 --- a/vendor/symfony/config/Util/Exception/InvalidXmlException.php +++ b/vendor/symfony/config/Util/Exception/InvalidXmlException.php @@ -16,6 +16,6 @@ * * @author Ole Rößner */ -class InvalidXmlException extends \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\Exception\XmlParsingException +class InvalidXmlException extends XmlParsingException { } diff --git a/vendor/symfony/config/Util/Exception/XmlParsingException.php b/vendor/symfony/config/Util/Exception/XmlParsingException.php index d8e427020..143387a73 100644 --- a/vendor/symfony/config/Util/Exception/XmlParsingException.php +++ b/vendor/symfony/config/Util/Exception/XmlParsingException.php @@ -10,11 +10,13 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\Exception; +use InvalidArgumentException; + /** * Exception class for when XML cannot be parsed properly. * * @author Ole Rößner */ -class XmlParsingException extends \InvalidArgumentException +class XmlParsingException extends InvalidArgumentException { } diff --git a/vendor/symfony/config/Util/Exception/index.php b/vendor/symfony/config/Util/Exception/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/config/Util/Exception/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/config/Util/XmlUtils.php b/vendor/symfony/config/Util/XmlUtils.php index 0f18189bc..49acac880 100644 --- a/vendor/symfony/config/Util/XmlUtils.php +++ b/vendor/symfony/config/Util/XmlUtils.php @@ -12,6 +12,45 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\Exception\InvalidXmlException; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\Exception\XmlParsingException; +use DOMComment; +use DOMDocument; +use DOMElement; +use DOMText; +use Exception; +use InvalidArgumentException; +use RuntimeException; +use function bindec; +use function call_user_func; +use function count; +use function ctype_digit; +use function defined; +use function extension_loaded; +use function file_get_contents; +use function hexdec; +use function implode; +use function in_array; +use function is_array; +use function is_callable; +use function is_file; +use function is_int; +use function is_numeric; +use function is_readable; +use function key; +use function libxml_clear_errors; +use function libxml_disable_entity_loader; +use function libxml_get_errors; +use function libxml_use_internal_errors; +use function octdec; +use function preg_match; +use function sprintf; +use function strtolower; +use function substr; +use function trim; +use const LIBXML_COMPACT; +use const LIBXML_ERR_WARNING; +use const LIBXML_NONET; +use const XML_DOCUMENT_TYPE_NODE; + /** * XMLUtils is a bunch of utility methods to XML operations. * @@ -35,61 +74,61 @@ private function __construct() * @param string $content An XML string * @param string|callable|null $schemaOrCallable An XSD schema file path, a callable, or null to disable validation * - * @return \DOMDocument + * @return DOMDocument * * @throws XmlParsingException When parsing of XML file returns error * @throws InvalidXmlException When parsing of XML with schema or callable produces any errors unrelated to the XML parsing itself - * @throws \RuntimeException When DOM extension is missing + * @throws RuntimeException When DOM extension is missing */ public static function parse($content, $schemaOrCallable = null) { - if (!\extension_loaded('dom')) { - throw new \RuntimeException('Extension DOM is required.'); + if (!extension_loaded('dom')) { + throw new RuntimeException('Extension DOM is required.'); } - $internalErrors = \libxml_use_internal_errors(\true); - $disableEntities = \libxml_disable_entity_loader(\true); - \libxml_clear_errors(); - $dom = new \DOMDocument(); - $dom->validateOnParse = \true; - if (!$dom->loadXML($content, \LIBXML_NONET | (\defined('LIBXML_COMPACT') ? \LIBXML_COMPACT : 0))) { - \libxml_disable_entity_loader($disableEntities); - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\Exception\XmlParsingException(\implode("\n", static::getXmlErrors($internalErrors))); + $internalErrors = libxml_use_internal_errors(true); + $disableEntities = libxml_disable_entity_loader(true); + libxml_clear_errors(); + $dom = new DOMDocument(); + $dom->validateOnParse = true; + if (!$dom->loadXML($content, LIBXML_NONET | (defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0))) { + libxml_disable_entity_loader($disableEntities); + throw new XmlParsingException(implode("\n", static::getXmlErrors($internalErrors))); } $dom->normalizeDocument(); - \libxml_use_internal_errors($internalErrors); - \libxml_disable_entity_loader($disableEntities); + libxml_use_internal_errors($internalErrors); + libxml_disable_entity_loader($disableEntities); foreach ($dom->childNodes as $child) { - if (\XML_DOCUMENT_TYPE_NODE === $child->nodeType) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\Exception\XmlParsingException('Document types are not allowed.'); + if (XML_DOCUMENT_TYPE_NODE === $child->nodeType) { + throw new XmlParsingException('Document types are not allowed.'); } } if (null !== $schemaOrCallable) { - $internalErrors = \libxml_use_internal_errors(\true); - \libxml_clear_errors(); + $internalErrors = libxml_use_internal_errors(true); + libxml_clear_errors(); $e = null; - if (\is_callable($schemaOrCallable)) { + if (is_callable($schemaOrCallable)) { try { - $valid = \call_user_func($schemaOrCallable, $dom, $internalErrors); - } catch (\Exception $e) { - $valid = \false; + $valid = call_user_func($schemaOrCallable, $dom, $internalErrors); + } catch (Exception $e) { + $valid = false; } - } elseif (!\is_array($schemaOrCallable) && \is_file((string) $schemaOrCallable)) { - $schemaSource = \file_get_contents((string) $schemaOrCallable); + } elseif (!is_array($schemaOrCallable) && is_file((string) $schemaOrCallable)) { + $schemaSource = file_get_contents((string) $schemaOrCallable); $valid = @$dom->schemaValidateSource($schemaSource); } else { - \libxml_use_internal_errors($internalErrors); - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\Exception\XmlParsingException('The schemaOrCallable argument has to be a valid path to XSD file or callable.'); + libxml_use_internal_errors($internalErrors); + throw new XmlParsingException('The schemaOrCallable argument has to be a valid path to XSD file or callable.'); } if (!$valid) { $messages = static::getXmlErrors($internalErrors); if (empty($messages)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\Exception\InvalidXmlException('The XML is not valid.', 0, $e); + throw new InvalidXmlException('The XML is not valid.', 0, $e); } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\Exception\XmlParsingException(\implode("\n", $messages), 0, $e); + throw new XmlParsingException(implode("\n", $messages), 0, $e); } } - \libxml_clear_errors(); - \libxml_use_internal_errors($internalErrors); + libxml_clear_errors(); + libxml_use_internal_errors($internalErrors); return $dom; } /** @@ -98,28 +137,28 @@ public static function parse($content, $schemaOrCallable = null) * @param string $file An XML file path * @param string|callable|null $schemaOrCallable An XSD schema file path, a callable, or null to disable validation * - * @return \DOMDocument + * @return DOMDocument * - * @throws \InvalidArgumentException When loading of XML file returns error + * @throws InvalidArgumentException When loading of XML file returns error * @throws XmlParsingException When XML parsing returns any errors - * @throws \RuntimeException When DOM extension is missing + * @throws RuntimeException When DOM extension is missing */ public static function loadFile($file, $schemaOrCallable = null) { - if (!\is_file($file)) { - throw new \InvalidArgumentException(\sprintf('Resource "%s" is not a file.', $file)); + if (!is_file($file)) { + throw new InvalidArgumentException(sprintf('Resource "%s" is not a file.', $file)); } - if (!\is_readable($file)) { - throw new \InvalidArgumentException(\sprintf('File "%s" is not readable.', $file)); + if (!is_readable($file)) { + throw new InvalidArgumentException(sprintf('File "%s" is not readable.', $file)); } - $content = @\file_get_contents($file); - if ('' === \trim($content)) { - throw new \InvalidArgumentException(\sprintf('File "%s" does not contain valid XML, it is empty.', $file)); + $content = @file_get_contents($file); + if ('' === trim($content)) { + throw new InvalidArgumentException(sprintf('File "%s" does not contain valid XML, it is empty.', $file)); } try { return static::parse($content, $schemaOrCallable); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\Exception\InvalidXmlException $e) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\Exception\XmlParsingException(\sprintf('The XML file "%s" is not valid.', $file), 0, $e->getPrevious()); + } catch (InvalidXmlException $e) { + throw new XmlParsingException(sprintf('The XML file "%s" is not valid.', $file), 0, $e->getPrevious()); } } /** @@ -137,49 +176,49 @@ public static function loadFile($file, $schemaOrCallable = null) * * * The nested-tags are converted to keys (bar) * - * @param \DOMElement $element A \DOMElement instance + * @param DOMElement $element A \DOMElement instance * @param bool $checkPrefix Check prefix in an element or an attribute name * * @return mixed */ - public static function convertDomElementToArray(\DOMElement $element, $checkPrefix = \true) + public static function convertDomElementToArray(DOMElement $element, $checkPrefix = true) { $prefix = (string) $element->prefix; - $empty = \true; + $empty = true; $config = []; foreach ($element->attributes as $name => $node) { - if ($checkPrefix && !\in_array((string) $node->prefix, ['', $prefix], \true)) { + if ($checkPrefix && !in_array((string) $node->prefix, ['', $prefix], true)) { continue; } $config[$name] = static::phpize($node->value); - $empty = \false; + $empty = false; } - $nodeValue = \false; + $nodeValue = false; foreach ($element->childNodes as $node) { - if ($node instanceof \DOMText) { - if ('' !== \trim($node->nodeValue)) { - $nodeValue = \trim($node->nodeValue); - $empty = \false; + if ($node instanceof DOMText) { + if ('' !== trim($node->nodeValue)) { + $nodeValue = trim($node->nodeValue); + $empty = false; } } elseif ($checkPrefix && $prefix != (string) $node->prefix) { continue; - } elseif (!$node instanceof \DOMComment) { + } elseif (!$node instanceof DOMComment) { $value = static::convertDomElementToArray($node, $checkPrefix); $key = $node->localName; if (isset($config[$key])) { - if (!\is_array($config[$key]) || !\is_int(\key($config[$key]))) { + if (!is_array($config[$key]) || !is_int(key($config[$key]))) { $config[$key] = [$config[$key]]; } $config[$key][] = $value; } else { $config[$key] = $value; } - $empty = \false; + $empty = false; } } - if (\false !== $nodeValue) { + if (false !== $nodeValue) { $value = static::phpize($nodeValue); - if (\count($config)) { + if (count($config)) { $config['value'] = $value; } else { $config = $value; @@ -197,29 +236,29 @@ public static function convertDomElementToArray(\DOMElement $element, $checkPref public static function phpize($value) { $value = (string) $value; - $lowercaseValue = \strtolower($value); - switch (\true) { + $lowercaseValue = strtolower($value); + switch (true) { case 'null' === $lowercaseValue: return null; - case \ctype_digit($value): + case ctype_digit($value): $raw = $value; $cast = (int) $value; - return '0' == $value[0] ? \octdec($value) : ((string) $raw === (string) $cast ? $cast : $raw); - case isset($value[1]) && '-' === $value[0] && \ctype_digit(\substr($value, 1)): + return '0' == $value[0] ? octdec($value) : ((string) $raw === (string) $cast ? $cast : $raw); + case isset($value[1]) && '-' === $value[0] && ctype_digit(substr($value, 1)): $raw = $value; $cast = (int) $value; - return '0' == $value[1] ? \octdec($value) : ((string) $raw === (string) $cast ? $cast : $raw); + return '0' == $value[1] ? octdec($value) : ((string) $raw === (string) $cast ? $cast : $raw); case 'true' === $lowercaseValue: - return \true; + return true; case 'false' === $lowercaseValue: - return \false; - case isset($value[1]) && '0b' == $value[0] . $value[1] && \preg_match('/^0b[01]*$/', $value): - return \bindec($value); - case \is_numeric($value): - return '0x' === $value[0] . $value[1] ? \hexdec($value) : (float) $value; - case \preg_match('/^0x[0-9a-f]++$/i', $value): - return \hexdec($value); - case \preg_match('/^[+-]?[0-9]+(\\.[0-9]+)?$/', $value): + return false; + case isset($value[1]) && '0b' == $value[0] . $value[1] && preg_match('/^0b[01]*$/', $value): + return bindec($value); + case is_numeric($value): + return '0x' === $value[0] . $value[1] ? hexdec($value) : (float) $value; + case preg_match('/^0x[0-9a-f]++$/i', $value): + return hexdec($value); + case preg_match('/^[+-]?[0-9]+(\\.[0-9]+)?$/', $value): return (float) $value; default: return $value; @@ -228,11 +267,11 @@ public static function phpize($value) protected static function getXmlErrors($internalErrors) { $errors = []; - foreach (\libxml_get_errors() as $error) { - $errors[] = \sprintf('[%s %s] %s (in %s - line %d, column %d)', \LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR', $error->code, \trim($error->message), $error->file ?: 'n/a', $error->line, $error->column); + foreach (libxml_get_errors() as $error) { + $errors[] = sprintf('[%s %s] %s (in %s - line %d, column %d)', LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR', $error->code, trim($error->message), $error->file ?: 'n/a', $error->line, $error->column); } - \libxml_clear_errors(); - \libxml_use_internal_errors($internalErrors); + libxml_clear_errors(); + libxml_use_internal_errors($internalErrors); return $errors; } } diff --git a/vendor/symfony/config/Util/index.php b/vendor/symfony/config/Util/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/config/Util/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/config/index.php b/vendor/symfony/config/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/config/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Alias.php b/vendor/symfony/dependency-injection/Alias.php index c82c214fe..91adbaa32 100644 --- a/vendor/symfony/dependency-injection/Alias.php +++ b/vendor/symfony/dependency-injection/Alias.php @@ -10,6 +10,8 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection; +use function func_num_args; + class Alias { private $id; @@ -19,11 +21,11 @@ class Alias * @param string $id Alias identifier * @param bool $public If this alias is public */ - public function __construct($id, $public = \true) + public function __construct($id, $public = true) { $this->id = (string) $id; $this->public = $public; - $this->private = 2 > \func_num_args(); + $this->private = 2 > func_num_args(); } /** * Checks if this DI Alias should be public or not. @@ -44,7 +46,7 @@ public function isPublic() public function setPublic($boolean) { $this->public = (bool) $boolean; - $this->private = \false; + $this->private = false; return $this; } /** diff --git a/vendor/symfony/dependency-injection/Argument/BoundArgument.php b/vendor/symfony/dependency-injection/Argument/BoundArgument.php index 41fea5b5e..994a4b26c 100644 --- a/vendor/symfony/dependency-injection/Argument/BoundArgument.php +++ b/vendor/symfony/dependency-injection/Argument/BoundArgument.php @@ -13,7 +13,7 @@ /** * @author Guilhem Niot */ -final class BoundArgument implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ArgumentInterface +final class BoundArgument implements ArgumentInterface { private static $sequence = 0; private $value; diff --git a/vendor/symfony/dependency-injection/Argument/IteratorArgument.php b/vendor/symfony/dependency-injection/Argument/IteratorArgument.php index 8a95f3866..2729b5348 100644 --- a/vendor/symfony/dependency-injection/Argument/IteratorArgument.php +++ b/vendor/symfony/dependency-injection/Argument/IteratorArgument.php @@ -12,12 +12,17 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; +use function get_class; +use function gettype; +use function is_object; +use function sprintf; + /** * Represents a collection of values to lazily iterate over. * * @author Titouan Galopin */ -class IteratorArgument implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ArgumentInterface +class IteratorArgument implements ArgumentInterface { private $values; /** @@ -40,8 +45,8 @@ public function getValues() public function setValues(array $values) { foreach ($values as $k => $v) { - if (null !== $v && !$v instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('An IteratorArgument must hold only Reference instances, "%s" given.', \is_object($v) ? \get_class($v) : \gettype($v))); + if (null !== $v && !$v instanceof Reference) { + throw new InvalidArgumentException(sprintf('An IteratorArgument must hold only Reference instances, "%s" given.', is_object($v) ? get_class($v) : gettype($v))); } } $this->values = $values; diff --git a/vendor/symfony/dependency-injection/Argument/RewindableGenerator.php b/vendor/symfony/dependency-injection/Argument/RewindableGenerator.php index 1b92f074e..466f15617 100644 --- a/vendor/symfony/dependency-injection/Argument/RewindableGenerator.php +++ b/vendor/symfony/dependency-injection/Argument/RewindableGenerator.php @@ -10,10 +10,14 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument; +use Countable; +use IteratorAggregate; +use function is_callable; + /** * @internal */ -class RewindableGenerator implements \IteratorAggregate, \Countable +class RewindableGenerator implements IteratorAggregate, Countable { private $generator; private $count; @@ -32,7 +36,7 @@ public function getIterator() } public function count() { - if (\is_callable($count = $this->count)) { + if (is_callable($count = $this->count)) { $this->count = $count(); } return $this->count; diff --git a/vendor/symfony/dependency-injection/Argument/ServiceClosureArgument.php b/vendor/symfony/dependency-injection/Argument/ServiceClosureArgument.php index 820ade829..25c75a330 100644 --- a/vendor/symfony/dependency-injection/Argument/ServiceClosureArgument.php +++ b/vendor/symfony/dependency-injection/Argument/ServiceClosureArgument.php @@ -12,15 +12,17 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; +use function array_keys; + /** * Represents a service wrapped in a memoizing closure. * * @author Nicolas Grekas */ -class ServiceClosureArgument implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ArgumentInterface +class ServiceClosureArgument implements ArgumentInterface { private $values; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference $reference) + public function __construct(Reference $reference) { $this->values = [$reference]; } @@ -36,8 +38,8 @@ public function getValues() */ public function setValues(array $values) { - if ([0] !== \array_keys($values) || !($values[0] instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference || null === $values[0])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException('A ServiceClosureArgument must hold one and only one Reference.'); + if ([0] !== array_keys($values) || !($values[0] instanceof Reference || null === $values[0])) { + throw new InvalidArgumentException('A ServiceClosureArgument must hold one and only one Reference.'); } $this->values = $values; } diff --git a/vendor/symfony/dependency-injection/Argument/TaggedIteratorArgument.php b/vendor/symfony/dependency-injection/Argument/TaggedIteratorArgument.php index b2cc963b5..03a87d996 100644 --- a/vendor/symfony/dependency-injection/Argument/TaggedIteratorArgument.php +++ b/vendor/symfony/dependency-injection/Argument/TaggedIteratorArgument.php @@ -15,7 +15,7 @@ * * @author Roland Franssen */ -class TaggedIteratorArgument extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument +class TaggedIteratorArgument extends IteratorArgument { private $tag; /** diff --git a/vendor/symfony/dependency-injection/Argument/index.php b/vendor/symfony/dependency-injection/Argument/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Argument/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/ChildDefinition.php b/vendor/symfony/dependency-injection/ChildDefinition.php index 70b6dc1ed..60d28c560 100644 --- a/vendor/symfony/dependency-injection/ChildDefinition.php +++ b/vendor/symfony/dependency-injection/ChildDefinition.php @@ -13,12 +13,17 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\BadMethodCallException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\OutOfBoundsException; +use function array_key_exists; +use function class_alias; +use function is_int; +use function strpos; + /** * This definition extends another definition. * * @author Johannes M. Schmitt */ -class ChildDefinition extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition +class ChildDefinition extends Definition { private $parent; /** @@ -27,7 +32,7 @@ class ChildDefinition extends \_PhpScoper5ea00cc67502b\Symfony\Component\Depende public function __construct($parent) { $this->parent = $parent; - $this->setPrivate(\false); + $this->setPrivate(false); } /** * Returns the Definition to inherit from. @@ -64,7 +69,7 @@ public function setParent($parent) */ public function getArgument($index) { - if (\array_key_exists('index_' . $index, $this->arguments)) { + if (array_key_exists('index_' . $index, $this->arguments)) { return $this->arguments['index_' . $index]; } return parent::getArgument($index); @@ -86,12 +91,12 @@ public function getArgument($index) */ public function replaceArgument($index, $value) { - if (\is_int($index)) { + if (is_int($index)) { $this->arguments['index_' . $index] = $value; - } elseif (0 === \strpos($index, '$')) { + } elseif (0 === strpos($index, '$')) { $this->arguments[$index] = $value; } else { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException('The argument must be an existing index or the name of a constructor\'s parameter.'); + throw new InvalidArgumentException('The argument must be an existing index or the name of a constructor\'s parameter.'); } return $this; } @@ -100,14 +105,14 @@ public function replaceArgument($index, $value) */ public function setAutoconfigured($autoconfigured) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\BadMethodCallException('A ChildDefinition cannot be autoconfigured.'); + throw new BadMethodCallException('A ChildDefinition cannot be autoconfigured.'); } /** * @internal */ public function setInstanceofConditionals(array $instanceof) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\BadMethodCallException('A ChildDefinition cannot have instanceof conditionals set on it.'); + throw new BadMethodCallException('A ChildDefinition cannot have instanceof conditionals set on it.'); } } -\class_alias(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\DefinitionDecorator::class); +class_alias(ChildDefinition::class, DefinitionDecorator::class); diff --git a/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php b/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php index acd0283fd..9bbe2131d 100644 --- a/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php +++ b/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php @@ -15,10 +15,21 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; +use ReflectionException; +use ReflectionFunction; +use ReflectionFunctionAbstract; +use function file_exists; +use function function_exists; +use function is_array; +use function is_string; +use function lcfirst; +use function rtrim; +use function sprintf; + /** * @author Nicolas Grekas */ -abstract class AbstractRecursivePass implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface +abstract class AbstractRecursivePass implements CompilerPassInterface { /** * @var ContainerBuilder @@ -28,11 +39,11 @@ abstract class AbstractRecursivePass implements \_PhpScoper5ea00cc67502b\Symfony /** * {@inheritdoc} */ - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { $this->container = $container; try { - $this->processValue($container->getDefinitions(), \true); + $this->processValue($container->getDefinitions(), true); } finally { $this->container = null; } @@ -45,9 +56,9 @@ public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInj * * @return mixed The processed value */ - protected function processValue($value, $isRoot = \false) + protected function processValue($value, $isRoot = false) { - if (\is_array($value)) { + if (is_array($value)) { foreach ($value as $k => $v) { if ($isRoot) { $this->currentId = $k; @@ -56,9 +67,9 @@ protected function processValue($value, $isRoot = \false) $value[$k] = $processedValue; } } - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ArgumentInterface) { + } elseif ($value instanceof ArgumentInterface) { $value->setValues($this->processValue($value->getValues())); - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition) { + } elseif ($value instanceof Definition) { $value->setArguments($this->processValue($value->getArguments())); $value->setProperties($this->processValue($value->getProperties())); $value->setMethodCalls($this->processValue($value->getMethodCalls())); @@ -75,51 +86,51 @@ protected function processValue($value, $isRoot = \false) /** * @param bool $required * - * @return \ReflectionFunctionAbstract|null + * @return ReflectionFunctionAbstract|null * * @throws RuntimeException */ - protected function getConstructor(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition, $required) + protected function getConstructor(Definition $definition, $required) { if ($definition->isSynthetic()) { return null; } - if (\is_string($factory = $definition->getFactory())) { - if (!\function_exists($factory)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Invalid service "%s": function "%s" does not exist.', $this->currentId, $factory)); + if (is_string($factory = $definition->getFactory())) { + if (!function_exists($factory)) { + throw new RuntimeException(sprintf('Invalid service "%s": function "%s" does not exist.', $this->currentId, $factory)); } - $r = new \ReflectionFunction($factory); - if (\false !== $r->getFileName() && \file_exists($r->getFileName())) { + $r = new ReflectionFunction($factory); + if (false !== $r->getFileName() && file_exists($r->getFileName())) { $this->container->fileExists($r->getFileName()); } return $r; } if ($factory) { - list($class, $method) = $factory; - if ($class instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference) { + [$class, $method] = $factory; + if ($class instanceof Reference) { $class = $this->container->findDefinition((string) $class)->getClass(); } elseif (null === $class) { $class = $definition->getClass(); } if ('__construct' === $method) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Invalid service "%s": "__construct()" cannot be used as a factory method.', $this->currentId)); + throw new RuntimeException(sprintf('Invalid service "%s": "__construct()" cannot be used as a factory method.', $this->currentId)); } - return $this->getReflectionMethod(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition($class), $method); + return $this->getReflectionMethod(new Definition($class), $method); } $class = $definition->getClass(); try { if (!($r = $this->container->getReflectionClass($class))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Invalid service "%s": class "%s" does not exist.', $this->currentId, $class)); + throw new RuntimeException(sprintf('Invalid service "%s": class "%s" does not exist.', $this->currentId, $class)); } - } catch (\ReflectionException $e) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Invalid service "%s": %s.', $this->currentId, \lcfirst(\rtrim($e->getMessage(), '.')))); + } catch (ReflectionException $e) { + throw new RuntimeException(sprintf('Invalid service "%s": %s.', $this->currentId, lcfirst(rtrim($e->getMessage(), '.')))); } if (!($r = $r->getConstructor())) { if ($required) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Invalid service "%s": class%s has no constructor.', $this->currentId, \sprintf($class !== $this->currentId ? ' "%s"' : '', $class))); + throw new RuntimeException(sprintf('Invalid service "%s": class%s has no constructor.', $this->currentId, sprintf($class !== $this->currentId ? ' "%s"' : '', $class))); } } elseif (!$r->isPublic()) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Invalid service "%s": %s must be public.', $this->currentId, \sprintf($class !== $this->currentId ? 'constructor of class "%s"' : 'its constructor', $class))); + throw new RuntimeException(sprintf('Invalid service "%s": %s must be public.', $this->currentId, sprintf($class !== $this->currentId ? 'constructor of class "%s"' : 'its constructor', $class))); } return $r; } @@ -128,25 +139,25 @@ protected function getConstructor(\_PhpScoper5ea00cc67502b\Symfony\Component\Dep * * @throws RuntimeException * - * @return \ReflectionFunctionAbstract + * @return ReflectionFunctionAbstract */ - protected function getReflectionMethod(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition, $method) + protected function getReflectionMethod(Definition $definition, $method) { if ('__construct' === $method) { - return $this->getConstructor($definition, \true); + return $this->getConstructor($definition, true); } if (!($class = $definition->getClass())) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Invalid service "%s": the class is not set.', $this->currentId)); + throw new RuntimeException(sprintf('Invalid service "%s": the class is not set.', $this->currentId)); } if (!($r = $this->container->getReflectionClass($class))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Invalid service "%s": class "%s" does not exist.', $this->currentId, $class)); + throw new RuntimeException(sprintf('Invalid service "%s": class "%s" does not exist.', $this->currentId, $class)); } if (!$r->hasMethod($method)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Invalid service "%s": method "%s()" does not exist.', $this->currentId, $class !== $this->currentId ? $class . '::' . $method : $method)); + throw new RuntimeException(sprintf('Invalid service "%s": method "%s()" does not exist.', $this->currentId, $class !== $this->currentId ? $class . '::' . $method : $method)); } $r = $r->getMethod($method); if (!$r->isPublic()) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Invalid service "%s": method "%s()" must be public.', $this->currentId, $class !== $this->currentId ? $class . '::' . $method : $method)); + throw new RuntimeException(sprintf('Invalid service "%s": method "%s()" must be public.', $this->currentId, $class !== $this->currentId ? $class . '::' . $method : $method)); } return $r; } diff --git a/vendor/symfony/dependency-injection/Compiler/AnalyzeServiceReferencesPass.php b/vendor/symfony/dependency-injection/Compiler/AnalyzeServiceReferencesPass.php index 24bfb25e1..aa0b399b2 100644 --- a/vendor/symfony/dependency-injection/Compiler/AnalyzeServiceReferencesPass.php +++ b/vendor/symfony/dependency-injection/Compiler/AnalyzeServiceReferencesPass.php @@ -18,6 +18,12 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ExpressionLanguage; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression; +use function class_exists; +use function sprintf; +use function stripcslashes; +use function substr; +use function substr_replace; + /** * Run this pass before passes that need to know more about the relation of * your services. @@ -27,7 +33,7 @@ * * @author Johannes M. Schmitt */ -class AnalyzeServiceReferencesPass extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RepeatablePassInterface +class AnalyzeServiceReferencesPass extends AbstractRecursivePass implements RepeatablePassInterface { private $graph; private $currentDefinition; @@ -39,7 +45,7 @@ class AnalyzeServiceReferencesPass extends \_PhpScoper5ea00cc67502b\Symfony\Comp /** * @param bool $onlyConstructorArguments Sets this Service Reference pass to ignore method calls */ - public function __construct($onlyConstructorArguments = \false, $hasProxyDumper = \true) + public function __construct($onlyConstructorArguments = false, $hasProxyDumper = true) { $this->onlyConstructorArguments = (bool) $onlyConstructorArguments; $this->hasProxyDumper = (bool) $hasProxyDumper; @@ -47,46 +53,46 @@ public function __construct($onlyConstructorArguments = \false, $hasProxyDumper /** * {@inheritdoc} */ - public function setRepeatedPass(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RepeatedPass $repeatedPass) + public function setRepeatedPass(RepeatedPass $repeatedPass) { // no-op for BC } /** * Processes a ContainerBuilder object to populate the service reference graph. */ - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { $this->container = $container; $this->graph = $container->getCompiler()->getServiceReferenceGraph(); $this->graph->clear(); - $this->lazy = \false; - $this->byConstructor = \false; + $this->lazy = false; + $this->byConstructor = false; foreach ($container->getAliases() as $id => $alias) { $targetId = $this->getDefinitionId((string) $alias); $this->graph->connect($id, $alias, $targetId, $this->getDefinition($targetId), null); } parent::process($container); } - protected function processValue($value, $isRoot = \false) + protected function processValue($value, $isRoot = false) { $lazy = $this->lazy; - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ArgumentInterface) { - $this->lazy = \true; + if ($value instanceof ArgumentInterface) { + $this->lazy = true; parent::processValue($value->getValues()); $this->lazy = $lazy; return $value; } - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression) { + if ($value instanceof Expression) { $this->getExpressionLanguage()->compile((string) $value, ['this' => 'container']); return $value; } - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference) { + if ($value instanceof Reference) { $targetId = $this->getDefinitionId((string) $value); $targetDefinition = $this->getDefinition($targetId); - $this->graph->connect($this->currentId, $this->currentDefinition, $targetId, $targetDefinition, $value, $this->lazy || $this->hasProxyDumper && $targetDefinition && $targetDefinition->isLazy(), \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $value->getInvalidBehavior(), $this->byConstructor); + $this->graph->connect($this->currentId, $this->currentDefinition, $targetId, $targetDefinition, $value, $this->lazy || $this->hasProxyDumper && $targetDefinition && $targetDefinition->isLazy(), ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $value->getInvalidBehavior(), $this->byConstructor); return $value; } - if (!$value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition) { + if (!$value instanceof Definition) { return parent::processValue($value, $isRoot); } if ($isRoot) { @@ -97,7 +103,7 @@ protected function processValue($value, $isRoot = \false) } elseif ($this->currentDefinition === $value) { return $value; } - $this->lazy = \false; + $this->lazy = false; $byConstructor = $this->byConstructor; $this->byConstructor = $isRoot || $byConstructor; $this->processValue($value->getFactory()); @@ -135,17 +141,17 @@ private function getDefinitionId($id) private function getExpressionLanguage() { if (null === $this->expressionLanguage) { - if (!\class_exists(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ExpressionLanguage::class)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.'); + if (!class_exists(ExpressionLanguage::class)) { + throw new RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.'); } $providers = $this->container->getExpressionLanguageProviders(); - $this->expressionLanguage = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ExpressionLanguage(null, $providers, function ($arg) { - if ('""' === \substr_replace($arg, '', 1, -1)) { - $id = \stripcslashes(\substr($arg, 1, -1)); + $this->expressionLanguage = new ExpressionLanguage(null, $providers, function ($arg) { + if ('""' === substr_replace($arg, '', 1, -1)) { + $id = stripcslashes(substr($arg, 1, -1)); $id = $this->getDefinitionId($id); $this->graph->connect($this->currentId, $this->currentDefinition, $id, $this->getDefinition($id)); } - return \sprintf('$this->get(%s)', $arg); + return sprintf('$this->get(%s)', $arg); }); } return $this->expressionLanguage; diff --git a/vendor/symfony/dependency-injection/Compiler/AutoAliasServicePass.php b/vendor/symfony/dependency-injection/Compiler/AutoAliasServicePass.php index 0523b4f53..4b06ba513 100644 --- a/vendor/symfony/dependency-injection/Compiler/AutoAliasServicePass.php +++ b/vendor/symfony/dependency-injection/Compiler/AutoAliasServicePass.php @@ -13,24 +13,26 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Alias; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use function sprintf; + /** * Sets a service to be an alias of another one, given a format pattern. */ -class AutoAliasServicePass implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface +class AutoAliasServicePass implements CompilerPassInterface { /** * {@inheritdoc} */ - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { foreach ($container->findTaggedServiceIds('auto_alias') as $serviceId => $tags) { foreach ($tags as $tag) { if (!isset($tag['format'])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Missing tag information "format" on auto_alias service "%s".', $serviceId)); + throw new InvalidArgumentException(sprintf('Missing tag information "format" on auto_alias service "%s".', $serviceId)); } $aliasId = $container->getParameterBag()->resolveValue($tag['format']); if ($container->hasDefinition($aliasId) || $container->hasAlias($aliasId)) { - $container->setAlias($serviceId, new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Alias($aliasId, \true)); + $container->setAlias($serviceId, new Alias($aliasId, true)); } } } diff --git a/vendor/symfony/dependency-injection/Compiler/AutowireExceptionPass.php b/vendor/symfony/dependency-injection/Compiler/AutowireExceptionPass.php index 64d7aba97..62bf49a77 100644 --- a/vendor/symfony/dependency-injection/Compiler/AutowireExceptionPass.php +++ b/vendor/symfony/dependency-injection/Compiler/AutowireExceptionPass.php @@ -10,8 +10,11 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler; -@\trigger_error('The ' . __NAMESPACE__ . '\\AutowireExceptionPass class is deprecated since Symfony 3.4 and will be removed in 4.0. Use the DefinitionErrorExceptionPass class instead.', \E_USER_DEPRECATED); +@trigger_error('The ' . __NAMESPACE__ . '\\AutowireExceptionPass class is deprecated since Symfony 3.4 and will be removed in 4.0. Use the DefinitionErrorExceptionPass class instead.', E_USER_DEPRECATED); use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * Throws autowire exceptions from AutowirePass for definitions that still exist. * @@ -19,16 +22,16 @@ * * @author Ryan Weaver */ -class AutowireExceptionPass implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface +class AutowireExceptionPass implements CompilerPassInterface { private $autowirePass; private $inlineServicePass; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass $autowirePass, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\InlineServiceDefinitionsPass $inlineServicePass) + public function __construct(AutowirePass $autowirePass, InlineServiceDefinitionsPass $inlineServicePass) { $this->autowirePass = $autowirePass; $this->inlineServicePass = $inlineServicePass; } - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { // the pass should only be run once if (null === $this->autowirePass || null === $this->inlineServicePass) { @@ -45,19 +48,19 @@ public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInj } } } - private function doesServiceExistInTheContainer($serviceId, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container, array $inlinedIds) + private function doesServiceExistInTheContainer($serviceId, ContainerBuilder $container, array $inlinedIds) { if ($container->hasDefinition($serviceId)) { - return \true; + return true; } // was the service inlined? Of so, does its parent service exist? if (isset($inlinedIds[$serviceId])) { foreach ($inlinedIds[$serviceId] as $parentId) { if ($this->doesServiceExistInTheContainer($parentId, $container, $inlinedIds)) { - return \true; + return true; } } } - return \false; + return false; } } diff --git a/vendor/symfony/dependency-injection/Compiler/AutowirePass.php b/vendor/symfony/dependency-injection/Compiler/AutowirePass.php index e900a8eea..5d91655b4 100644 --- a/vendor/symfony/dependency-injection/Compiler/AutowirePass.php +++ b/vendor/symfony/dependency-injection/Compiler/AutowirePass.php @@ -18,13 +18,33 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\LazyProxy\ProxyHelper; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference; +use ReflectionClass; +use ReflectionException; +use ReflectionFunctionAbstract; +use ReflectionMethod; +use function array_key_exists; +use function array_pop; +use function array_shift; +use function array_unshift; +use function class_exists; +use function class_implements; +use function class_parents; +use function count; +use function implode; +use function ksort; +use function method_exists; +use function preg_match; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * Inspects existing service definitions and wires the autowired ones using the type hints of their classes. * * @author Kévin Dunglas * @author Nicolas Grekas */ -class AutowirePass extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass +class AutowirePass extends AbstractRecursivePass { private $definedTypes = []; private $types; @@ -37,7 +57,7 @@ class AutowirePass extends \_PhpScoper5ea00cc67502b\Symfony\Component\Dependency /** * @param bool $throwOnAutowireException Errors can be retrieved via Definition::getErrors() */ - public function __construct($throwOnAutowireException = \true) + public function __construct($throwOnAutowireException = true) { $this->throwOnAutowiringException = $throwOnAutowireException; } @@ -48,13 +68,13 @@ public function __construct($throwOnAutowireException = \true) */ public function getAutowiringExceptions() { - @\trigger_error('Calling AutowirePass::getAutowiringExceptions() is deprecated since Symfony 3.4 and will be removed in 4.0. Use Definition::getErrors() instead.', \E_USER_DEPRECATED); + @trigger_error('Calling AutowirePass::getAutowiringExceptions() is deprecated since Symfony 3.4 and will be removed in 4.0. Use Definition::getErrors() instead.', E_USER_DEPRECATED); return $this->autowiringExceptions; } /** * {@inheritdoc} */ - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { // clear out any possibly stored exceptions from before $this->autowiringExceptions = []; @@ -75,25 +95,25 @@ public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInj * * @deprecated since version 3.3, to be removed in 4.0. Use ContainerBuilder::getReflectionClass() instead. */ - public static function createResourceForClass(\ReflectionClass $reflectionClass) + public static function createResourceForClass(ReflectionClass $reflectionClass) { - @\trigger_error('The ' . __METHOD__ . '() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use ContainerBuilder::getReflectionClass() instead.', \E_USER_DEPRECATED); + @trigger_error('The ' . __METHOD__ . '() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use ContainerBuilder::getReflectionClass() instead.', E_USER_DEPRECATED); $metadata = []; - foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflectionMethod) { + foreach ($reflectionClass->getMethods(ReflectionMethod::IS_PUBLIC) as $reflectionMethod) { if (!$reflectionMethod->isStatic()) { $metadata[$reflectionMethod->name] = self::getResourceMetadataForMethod($reflectionMethod); } } - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Config\AutowireServiceResource($reflectionClass->name, $reflectionClass->getFileName(), $metadata); + return new AutowireServiceResource($reflectionClass->name, $reflectionClass->getFileName(), $metadata); } /** * {@inheritdoc} */ - protected function processValue($value, $isRoot = \false) + protected function processValue($value, $isRoot = false) { try { return $this->doProcessValue($value, $isRoot); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\AutowiringFailedException $e) { + } catch (AutowiringFailedException $e) { if ($this->throwOnAutowiringException) { throw $e; } @@ -102,34 +122,34 @@ protected function processValue($value, $isRoot = \false) return parent::processValue($value, $isRoot); } } - private function doProcessValue($value, $isRoot = \false) + private function doProcessValue($value, $isRoot = false) { - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference) { - if ($ref = $this->getAutowiredReference($value, $value->getRequiringClass() ? \sprintf('for "%s" in "%s"', $value->getType(), $value->getRequiringClass()) : '')) { + if ($value instanceof TypedReference) { + if ($ref = $this->getAutowiredReference($value, $value->getRequiringClass() ? sprintf('for "%s" in "%s"', $value->getType(), $value->getRequiringClass()) : '')) { return $ref; } $this->container->log($this, $this->createTypeNotFoundMessage($value, 'it')); } $value = parent::processValue($value, $isRoot); - if (!$value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition || !$value->isAutowired() || $value->isAbstract() || !$value->getClass()) { + if (!$value instanceof Definition || !$value->isAutowired() || $value->isAbstract() || !$value->getClass()) { return $value; } - if (!($reflectionClass = $this->container->getReflectionClass($value->getClass(), \false))) { - $this->container->log($this, \sprintf('Skipping service "%s": Class or interface "%s" cannot be loaded.', $this->currentId, $value->getClass())); + if (!($reflectionClass = $this->container->getReflectionClass($value->getClass(), false))) { + $this->container->log($this, sprintf('Skipping service "%s": Class or interface "%s" cannot be loaded.', $this->currentId, $value->getClass())); return $value; } $methodCalls = $value->getMethodCalls(); try { - $constructor = $this->getConstructor($value, \false); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException $e) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\AutowiringFailedException($this->currentId, $e->getMessage(), 0, $e); + $constructor = $this->getConstructor($value, false); + } catch (RuntimeException $e) { + throw new AutowiringFailedException($this->currentId, $e->getMessage(), 0, $e); } if ($constructor) { - \array_unshift($methodCalls, [$constructor, $value->getArguments()]); + array_unshift($methodCalls, [$constructor, $value->getArguments()]); } $methodCalls = $this->autowireCalls($reflectionClass, $methodCalls); if ($constructor) { - list(, $arguments) = \array_shift($methodCalls); + [, $arguments] = array_shift($methodCalls); if ($arguments !== $value->getArguments()) { $value->setArguments($arguments); } @@ -142,17 +162,17 @@ private function doProcessValue($value, $isRoot = \false) /** * @return array */ - private function autowireCalls(\ReflectionClass $reflectionClass, array $methodCalls) + private function autowireCalls(ReflectionClass $reflectionClass, array $methodCalls) { foreach ($methodCalls as $i => $call) { - list($method, $arguments) = $call; - if ($method instanceof \ReflectionFunctionAbstract) { + [$method, $arguments] = $call; + if ($method instanceof ReflectionFunctionAbstract) { $reflectionMethod = $method; } else { - $definition = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition($reflectionClass->name); + $definition = new Definition($reflectionClass->name); try { $reflectionMethod = $this->getReflectionMethod($definition, $method); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException $e) { + } catch (RuntimeException $e) { if ($definition->getFactory()) { continue; } @@ -173,19 +193,19 @@ private function autowireCalls(\ReflectionClass $reflectionClass, array $methodC * * @throws AutowiringFailedException */ - private function autowireMethod(\ReflectionFunctionAbstract $reflectionMethod, array $arguments) + private function autowireMethod(ReflectionFunctionAbstract $reflectionMethod, array $arguments) { - $class = $reflectionMethod instanceof \ReflectionMethod ? $reflectionMethod->class : $this->currentId; + $class = $reflectionMethod instanceof ReflectionMethod ? $reflectionMethod->class : $this->currentId; $method = $reflectionMethod->name; $parameters = $reflectionMethod->getParameters(); - if (\method_exists('ReflectionMethod', 'isVariadic') && $reflectionMethod->isVariadic()) { - \array_pop($parameters); + if (method_exists('ReflectionMethod', 'isVariadic') && $reflectionMethod->isVariadic()) { + array_pop($parameters); } foreach ($parameters as $index => $parameter) { - if (\array_key_exists($index, $arguments) && '' !== $arguments[$index]) { + if (array_key_exists($index, $arguments) && '' !== $arguments[$index]) { continue; } - $type = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\LazyProxy\ProxyHelper::getTypeHint($reflectionMethod, $parameter, \true); + $type = ProxyHelper::getTypeHint($reflectionMethod, $parameter, true); if (!$type) { if (isset($arguments[$index])) { continue; @@ -198,20 +218,20 @@ private function autowireMethod(\ReflectionFunctionAbstract $reflectionMethod, a if ($parameter->isOptional()) { continue; } - $type = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\LazyProxy\ProxyHelper::getTypeHint($reflectionMethod, $parameter, \false); - $type = $type ? \sprintf('is type-hinted "%s"', $type) : 'has no type-hint'; - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\AutowiringFailedException($this->currentId, \sprintf('Cannot autowire service "%s": argument "$%s" of method "%s()" %s, you should configure its value explicitly.', $this->currentId, $parameter->name, $class !== $this->currentId ? $class . '::' . $method : $method, $type)); + $type = ProxyHelper::getTypeHint($reflectionMethod, $parameter, false); + $type = $type ? sprintf('is type-hinted "%s"', $type) : 'has no type-hint'; + throw new AutowiringFailedException($this->currentId, sprintf('Cannot autowire service "%s": argument "$%s" of method "%s()" %s, you should configure its value explicitly.', $this->currentId, $parameter->name, $class !== $this->currentId ? $class . '::' . $method : $method, $type)); } // specifically pass the default value $arguments[$index] = $parameter->getDefaultValue(); continue; } - if (!($value = $this->getAutowiredReference($ref = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference($type, $type, !$parameter->isOptional() ? $class : ''), 'for ' . \sprintf('argument "$%s" of method "%s()"', $parameter->name, $class . '::' . $method)))) { - $failureMessage = $this->createTypeNotFoundMessage($ref, \sprintf('argument "$%s" of method "%s()"', $parameter->name, $class !== $this->currentId ? $class . '::' . $method : $method)); + if (!($value = $this->getAutowiredReference($ref = new TypedReference($type, $type, !$parameter->isOptional() ? $class : ''), 'for ' . sprintf('argument "$%s" of method "%s()"', $parameter->name, $class . '::' . $method)))) { + $failureMessage = $this->createTypeNotFoundMessage($ref, sprintf('argument "$%s" of method "%s()"', $parameter->name, $class !== $this->currentId ? $class . '::' . $method : $method)); if ($parameter->isDefaultValueAvailable()) { $value = $parameter->getDefaultValue(); } elseif (!$parameter->allowsNull()) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\AutowiringFailedException($this->currentId, $failureMessage); + throw new AutowiringFailedException($this->currentId, $failureMessage); } $this->container->log($this, $failureMessage); } @@ -228,13 +248,13 @@ private function autowireMethod(\ReflectionFunctionAbstract $reflectionMethod, a } // it's possible index 1 was set, then index 0, then 2, etc // make sure that we re-order so they're injected as expected - \ksort($arguments); + ksort($arguments); return $arguments; } /** * @return TypedReference|null A reference to the service matching the given type, if any */ - private function getAutowiredReference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference $reference, $deprecationMessage) + private function getAutowiredReference(TypedReference $reference, $deprecationMessage) { $this->lastFailure = null; $type = $reference->getType(); @@ -245,23 +265,23 @@ private function getAutowiredReference(\_PhpScoper5ea00cc67502b\Symfony\Componen $this->populateAvailableTypes($this->strictMode); } if (isset($this->definedTypes[$type])) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference($this->types[$type], $type); + return new TypedReference($this->types[$type], $type); } if (!$this->strictMode && isset($this->types[$type])) { $message = 'Autowiring services based on the types they implement is deprecated since Symfony 3.3 and won\'t be supported in version 4.0.'; if ($aliasSuggestion = $this->getAliasesSuggestionForType($type = $reference->getType(), $deprecationMessage)) { $message .= ' ' . $aliasSuggestion; } else { - $message .= \sprintf(' You should %s the "%s" service to "%s" instead.', isset($this->types[$this->types[$type]]) ? 'alias' : 'rename (or alias)', $this->types[$type], $type); + $message .= sprintf(' You should %s the "%s" service to "%s" instead.', isset($this->types[$this->types[$type]]) ? 'alias' : 'rename (or alias)', $this->types[$type], $type); } - @\trigger_error($message, \E_USER_DEPRECATED); - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference($this->types[$type], $type); + @trigger_error($message, E_USER_DEPRECATED); + return new TypedReference($this->types[$type], $type); } if (!$reference->canBeAutoregistered() || isset($this->types[$type]) || isset($this->ambiguousServiceTypes[$type])) { return null; } if (isset($this->autowired[$type])) { - return $this->autowired[$type] ? new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference($this->autowired[$type], $type) : null; + return $this->autowired[$type] ? new TypedReference($this->autowired[$type], $type) : null; } if (!$this->strictMode) { return $this->createAutowiredDefinition($type); @@ -271,7 +291,7 @@ private function getAutowiredReference(\_PhpScoper5ea00cc67502b\Symfony\Componen /** * Populates the list of available types. */ - private function populateAvailableTypes($onlyAutowiringTypes = \false) + private function populateAvailableTypes($onlyAutowiringTypes = false) { $this->types = []; if (!$onlyAutowiringTypes) { @@ -286,21 +306,21 @@ private function populateAvailableTypes($onlyAutowiringTypes = \false) * * @param string $id */ - private function populateAvailableType($id, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition, $onlyAutowiringTypes) + private function populateAvailableType($id, Definition $definition, $onlyAutowiringTypes) { // Never use abstract services if ($definition->isAbstract()) { return; } - foreach ($definition->getAutowiringTypes(\false) as $type) { - $this->definedTypes[$type] = \true; + foreach ($definition->getAutowiringTypes(false) as $type) { + $this->definedTypes[$type] = true; $this->types[$type] = $id; unset($this->ambiguousServiceTypes[$type]); } if ($onlyAutowiringTypes) { return; } - if (\preg_match('/^\\d+_[^~]++~[._a-zA-Z\\d]{7}$/', $id) || $definition->isDeprecated() || !($reflectionClass = $this->container->getReflectionClass($definition->getClass(), \false))) { + if (preg_match('/^\\d+_[^~]++~[._a-zA-Z\\d]{7}$/', $id) || $definition->isDeprecated() || !($reflectionClass = $this->container->getReflectionClass($definition->getClass(), false))) { return; } foreach ($reflectionClass->getInterfaces() as $reflectionInterface) { @@ -347,22 +367,22 @@ private function set($type, $id) */ private function createAutowiredDefinition($type) { - if (!($typeHint = $this->container->getReflectionClass($type, \false)) || !$typeHint->isInstantiable()) { + if (!($typeHint = $this->container->getReflectionClass($type, false)) || !$typeHint->isInstantiable()) { return null; } $currentId = $this->currentId; $this->currentId = $type; - $this->autowired[$type] = $argumentId = \sprintf('autowired.%s', $type); - $argumentDefinition = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition($type); - $argumentDefinition->setPublic(\false); - $argumentDefinition->setAutowired(\true); + $this->autowired[$type] = $argumentId = sprintf('autowired.%s', $type); + $argumentDefinition = new Definition($type); + $argumentDefinition->setPublic(false); + $argumentDefinition->setAutowired(true); try { $originalThrowSetting = $this->throwOnAutowiringException; - $this->throwOnAutowiringException = \true; - $this->processValue($argumentDefinition, \true); + $this->throwOnAutowiringException = true; + $this->processValue($argumentDefinition, true); $this->container->setDefinition($argumentId, $argumentDefinition); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\AutowiringFailedException $e) { - $this->autowired[$type] = \false; + } catch (AutowiringFailedException $e) { + $this->autowired[$type] = false; $this->lastFailure = $e->getMessage(); $this->container->log($this, $this->lastFailure); return null; @@ -370,16 +390,16 @@ private function createAutowiredDefinition($type) $this->throwOnAutowiringException = $originalThrowSetting; $this->currentId = $currentId; } - @\trigger_error(\sprintf('Relying on service auto-registration for type "%s" is deprecated since Symfony 3.4 and won\'t be supported in 4.0. Create a service named "%s" instead.', $type, $type), \E_USER_DEPRECATED); - $this->container->log($this, \sprintf('Type "%s" has been auto-registered for service "%s".', $type, $this->currentId)); - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference($argumentId, $type); + @trigger_error(sprintf('Relying on service auto-registration for type "%s" is deprecated since Symfony 3.4 and won\'t be supported in 4.0. Create a service named "%s" instead.', $type, $type), E_USER_DEPRECATED); + $this->container->log($this, sprintf('Type "%s" has been auto-registered for service "%s".', $type, $this->currentId)); + return new TypedReference($argumentId, $type); } - private function createTypeNotFoundMessage(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference $reference, $label) + private function createTypeNotFoundMessage(TypedReference $reference, $label) { $trackResources = $this->container->isTrackingResources(); - $this->container->setResourceTracking(\false); + $this->container->setResourceTracking(false); try { - if ($r = $this->container->getReflectionClass($type = $reference->getType(), \false)) { + if ($r = $this->container->getReflectionClass($type = $reference->getType(), false)) { $alternatives = $this->createTypeAlternatives($reference); } } finally { @@ -388,29 +408,29 @@ private function createTypeNotFoundMessage(\_PhpScoper5ea00cc67502b\Symfony\Comp if (!$r) { // either $type does not exist or a parent class does not exist try { - $resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ClassExistenceResource($type, \false); + $resource = new ClassExistenceResource($type, false); // isFresh() will explode ONLY if a parent class/trait does not exist $resource->isFresh(0); - $parentMsg = \false; - } catch (\ReflectionException $e) { + $parentMsg = false; + } catch (ReflectionException $e) { $parentMsg = $e->getMessage(); } - $message = \sprintf('has type "%s" but this class %s.', $type, $parentMsg ? \sprintf('is missing a parent class (%s)', $parentMsg) : 'was not found'); + $message = sprintf('has type "%s" but this class %s.', $type, $parentMsg ? sprintf('is missing a parent class (%s)', $parentMsg) : 'was not found'); } else { $message = $this->container->has($type) ? 'this service is abstract' : 'no such service exists'; - $message = \sprintf('references %s "%s" but %s.%s', $r->isInterface() ? 'interface' : 'class', $type, $message, $alternatives); + $message = sprintf('references %s "%s" but %s.%s', $r->isInterface() ? 'interface' : 'class', $type, $message, $alternatives); if ($r->isInterface() && !$alternatives) { $message .= ' Did you create a class that implements this interface?'; } } - $message = \sprintf('Cannot autowire service "%s": %s %s', $this->currentId, $label, $message); + $message = sprintf('Cannot autowire service "%s": %s %s', $this->currentId, $label, $message); if (null !== $this->lastFailure) { $message = $this->lastFailure . "\n" . $message; $this->lastFailure = null; } return $message; } - private function createTypeAlternatives(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference $reference) + private function createTypeAlternatives(TypedReference $reference) { // try suggesting available aliases first if ($message = $this->getAliasesSuggestionForType($type = $reference->getType())) { @@ -420,30 +440,30 @@ private function createTypeAlternatives(\_PhpScoper5ea00cc67502b\Symfony\Compone $this->populateAvailableTypes(); } if (isset($this->ambiguousServiceTypes[$type])) { - $message = \sprintf('one of these existing services: "%s"', \implode('", "', $this->ambiguousServiceTypes[$type])); + $message = sprintf('one of these existing services: "%s"', implode('", "', $this->ambiguousServiceTypes[$type])); } elseif (isset($this->types[$type])) { - $message = \sprintf('the existing "%s" service', $this->types[$type]); + $message = sprintf('the existing "%s" service', $this->types[$type]); } elseif ($reference->getRequiringClass() && !$reference->canBeAutoregistered() && !$this->strictMode) { return ' It cannot be auto-registered because it is from a different root namespace.'; } else { return ''; } - return \sprintf(' You should maybe alias this %s to %s.', \class_exists($type, \false) ? 'class' : 'interface', $message); + return sprintf(' You should maybe alias this %s to %s.', class_exists($type, false) ? 'class' : 'interface', $message); } /** * @deprecated since version 3.3, to be removed in 4.0. */ - private static function getResourceMetadataForMethod(\ReflectionMethod $method) + private static function getResourceMetadataForMethod(ReflectionMethod $method) { $methodArgumentsMetadata = []; foreach ($method->getParameters() as $parameter) { try { $class = $parameter->getClass(); - } catch (\ReflectionException $e) { + } catch (ReflectionException $e) { // type-hint is against a non-existent class - $class = \false; + $class = false; } - $isVariadic = \method_exists($parameter, 'isVariadic') && $parameter->isVariadic(); + $isVariadic = method_exists($parameter, 'isVariadic') && $parameter->isVariadic(); $methodArgumentsMetadata[] = ['class' => $class, 'isOptional' => $parameter->isOptional(), 'defaultValue' => $parameter->isOptional() && !$isVariadic ? $parameter->getDefaultValue() : null]; } return $methodArgumentsMetadata; @@ -451,22 +471,22 @@ private static function getResourceMetadataForMethod(\ReflectionMethod $method) private function getAliasesSuggestionForType($type, $extraContext = null) { $aliases = []; - foreach (\class_parents($type) + \class_implements($type) as $parent) { + foreach (class_parents($type) + class_implements($type) as $parent) { if ($this->container->has($parent) && !$this->container->findDefinition($parent)->isAbstract()) { $aliases[] = $parent; } } $extraContext = $extraContext ? ' ' . $extraContext : ''; - if (1 < ($len = \count($aliases))) { - $message = \sprintf('Try changing the type-hint%s to one of its parents: ', $extraContext); + if (1 < ($len = count($aliases))) { + $message = sprintf('Try changing the type-hint%s to one of its parents: ', $extraContext); for ($i = 0, --$len; $i < $len; ++$i) { - $message .= \sprintf('%s "%s", ', \class_exists($aliases[$i], \false) ? 'class' : 'interface', $aliases[$i]); + $message .= sprintf('%s "%s", ', class_exists($aliases[$i], false) ? 'class' : 'interface', $aliases[$i]); } - $message .= \sprintf('or %s "%s".', \class_exists($aliases[$i], \false) ? 'class' : 'interface', $aliases[$i]); + $message .= sprintf('or %s "%s".', class_exists($aliases[$i], false) ? 'class' : 'interface', $aliases[$i]); return $message; } if ($aliases) { - return \sprintf('Try changing the type-hint%s to "%s" instead.', $extraContext, $aliases[0]); + return sprintf('Try changing the type-hint%s to "%s" instead.', $extraContext, $aliases[0]); } return null; } diff --git a/vendor/symfony/dependency-injection/Compiler/AutowireRequiredMethodsPass.php b/vendor/symfony/dependency-injection/Compiler/AutowireRequiredMethodsPass.php index 46bf22046..bad2a0659 100644 --- a/vendor/symfony/dependency-injection/Compiler/AutowireRequiredMethodsPass.php +++ b/vendor/symfony/dependency-injection/Compiler/AutowireRequiredMethodsPass.php @@ -11,47 +11,52 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; +use ReflectionException; +use function preg_match; +use function stripos; +use function strtolower; + /** * Looks for definitions with autowiring enabled and registers their corresponding "@required" methods as setters. * * @author Nicolas Grekas */ -class AutowireRequiredMethodsPass extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass +class AutowireRequiredMethodsPass extends AbstractRecursivePass { /** * {@inheritdoc} */ - protected function processValue($value, $isRoot = \false) + protected function processValue($value, $isRoot = false) { $value = parent::processValue($value, $isRoot); - if (!$value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition || !$value->isAutowired() || $value->isAbstract() || !$value->getClass()) { + if (!$value instanceof Definition || !$value->isAutowired() || $value->isAbstract() || !$value->getClass()) { return $value; } - if (!($reflectionClass = $this->container->getReflectionClass($value->getClass(), \false))) { + if (!($reflectionClass = $this->container->getReflectionClass($value->getClass(), false))) { return $value; } $alreadyCalledMethods = []; - foreach ($value->getMethodCalls() as list($method)) { - $alreadyCalledMethods[\strtolower($method)] = \true; + foreach ($value->getMethodCalls() as [$method]) { + $alreadyCalledMethods[strtolower($method)] = true; } foreach ($reflectionClass->getMethods() as $reflectionMethod) { $r = $reflectionMethod; - if ($r->isConstructor() || isset($alreadyCalledMethods[\strtolower($r->name)])) { + if ($r->isConstructor() || isset($alreadyCalledMethods[strtolower($r->name)])) { continue; } - while (\true) { - if (\false !== ($doc = $r->getDocComment())) { - if (\false !== \stripos($doc, '@required') && \preg_match('#(?:^/\\*\\*|\\n\\s*+\\*)\\s*+@required(?:\\s|\\*/$)#i', $doc)) { + while (true) { + if (false !== ($doc = $r->getDocComment())) { + if (false !== stripos($doc, '@required') && preg_match('#(?:^/\\*\\*|\\n\\s*+\\*)\\s*+@required(?:\\s|\\*/$)#i', $doc)) { $value->addMethodCall($reflectionMethod->name); break; } - if (\false === \stripos($doc, '@inheritdoc') || !\preg_match('#(?:^/\\*\\*|\\n\\s*+\\*)\\s*+(?:\\{@inheritdoc\\}|@inheritdoc)(?:\\s|\\*/$)#i', $doc)) { + if (false === stripos($doc, '@inheritdoc') || !preg_match('#(?:^/\\*\\*|\\n\\s*+\\*)\\s*+(?:\\{@inheritdoc\\}|@inheritdoc)(?:\\s|\\*/$)#i', $doc)) { break; } } try { $r = $r->getPrototype(); - } catch (\ReflectionException $e) { + } catch (ReflectionException $e) { break; // method has no prototype } diff --git a/vendor/symfony/dependency-injection/Compiler/CheckArgumentsValidityPass.php b/vendor/symfony/dependency-injection/Compiler/CheckArgumentsValidityPass.php index 1715e355a..0ae2cabeb 100644 --- a/vendor/symfony/dependency-injection/Compiler/CheckArgumentsValidityPass.php +++ b/vendor/symfony/dependency-injection/Compiler/CheckArgumentsValidityPass.php @@ -12,42 +12,45 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; +use function is_int; +use function sprintf; + /** * Checks if arguments of methods are properly configured. * * @author Kévin Dunglas * @author Nicolas Grekas */ -class CheckArgumentsValidityPass extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass +class CheckArgumentsValidityPass extends AbstractRecursivePass { private $throwExceptions; - public function __construct($throwExceptions = \true) + public function __construct($throwExceptions = true) { $this->throwExceptions = $throwExceptions; } /** * {@inheritdoc} */ - protected function processValue($value, $isRoot = \false) + protected function processValue($value, $isRoot = false) { - if (!$value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition) { + if (!$value instanceof Definition) { return parent::processValue($value, $isRoot); } $i = 0; foreach ($value->getArguments() as $k => $v) { if ($k !== $i++) { - if (!\is_int($k)) { - $msg = \sprintf('Invalid constructor argument for service "%s": integer expected but found string "%s". Check your service definition.', $this->currentId, $k); + if (!is_int($k)) { + $msg = sprintf('Invalid constructor argument for service "%s": integer expected but found string "%s". Check your service definition.', $this->currentId, $k); $value->addError($msg); if ($this->throwExceptions) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException($msg); + throw new RuntimeException($msg); } break; } - $msg = \sprintf('Invalid constructor argument %d for service "%s": argument %d must be defined before. Check your service definition.', 1 + $k, $this->currentId, $i); + $msg = sprintf('Invalid constructor argument %d for service "%s": argument %d must be defined before. Check your service definition.', 1 + $k, $this->currentId, $i); $value->addError($msg); if ($this->throwExceptions) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException($msg); + throw new RuntimeException($msg); } } } @@ -55,18 +58,18 @@ protected function processValue($value, $isRoot = \false) $i = 0; foreach ($methodCall[1] as $k => $v) { if ($k !== $i++) { - if (!\is_int($k)) { - $msg = \sprintf('Invalid argument for method call "%s" of service "%s": integer expected but found string "%s". Check your service definition.', $methodCall[0], $this->currentId, $k); + if (!is_int($k)) { + $msg = sprintf('Invalid argument for method call "%s" of service "%s": integer expected but found string "%s". Check your service definition.', $methodCall[0], $this->currentId, $k); $value->addError($msg); if ($this->throwExceptions) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException($msg); + throw new RuntimeException($msg); } break; } - $msg = \sprintf('Invalid argument %d for method call "%s" of service "%s": argument %d must be defined before. Check your service definition.', 1 + $k, $methodCall[0], $this->currentId, $i); + $msg = sprintf('Invalid argument %d for method call "%s" of service "%s": argument %d must be defined before. Check your service definition.', 1 + $k, $methodCall[0], $this->currentId, $i); $value->addError($msg); if ($this->throwExceptions) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException($msg); + throw new RuntimeException($msg); } } } diff --git a/vendor/symfony/dependency-injection/Compiler/CheckCircularReferencesPass.php b/vendor/symfony/dependency-injection/Compiler/CheckCircularReferencesPass.php index 4cdcac6f3..6a3c5a472 100644 --- a/vendor/symfony/dependency-injection/Compiler/CheckCircularReferencesPass.php +++ b/vendor/symfony/dependency-injection/Compiler/CheckCircularReferencesPass.php @@ -12,6 +12,10 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; +use function array_pop; +use function array_search; +use function array_slice; + /** * Checks your services for circular references. * @@ -22,14 +26,14 @@ * * @author Johannes M. Schmitt */ -class CheckCircularReferencesPass implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface +class CheckCircularReferencesPass implements CompilerPassInterface { private $currentPath; private $checkedNodes; /** * Checks the ContainerBuilder object for circular references. */ - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { $graph = $container->getCompiler()->getServiceReferenceGraph(); $this->checkedNodes = []; @@ -53,15 +57,15 @@ private function checkOutEdges(array $edges) if (empty($this->checkedNodes[$id])) { // Don't check circular references for lazy edges if (!$node->getValue() || !$edge->isLazy() && !$edge->isWeak()) { - $searchKey = \array_search($id, $this->currentPath); + $searchKey = array_search($id, $this->currentPath); $this->currentPath[] = $id; - if (\false !== $searchKey) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException($id, \array_slice($this->currentPath, $searchKey)); + if (false !== $searchKey) { + throw new ServiceCircularReferenceException($id, array_slice($this->currentPath, $searchKey)); } $this->checkOutEdges($node->getOutEdges()); } - $this->checkedNodes[$id] = \true; - \array_pop($this->currentPath); + $this->checkedNodes[$id] = true; + array_pop($this->currentPath); } } } diff --git a/vendor/symfony/dependency-injection/Compiler/CheckDefinitionValidityPass.php b/vendor/symfony/dependency-injection/Compiler/CheckDefinitionValidityPass.php index 36eddeded..eabf0d899 100644 --- a/vendor/symfony/dependency-injection/Compiler/CheckDefinitionValidityPass.php +++ b/vendor/symfony/dependency-injection/Compiler/CheckDefinitionValidityPass.php @@ -13,6 +13,14 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\EnvParameterException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; +use function class_exists; +use function interface_exists; +use function is_scalar; +use function sprintf; +use function strpos; +use function substr; +use function substr_count; + /** * This pass validates each definition individually only taking the information * into account which is contained in the definition itself. @@ -25,39 +33,39 @@ * * @author Johannes M. Schmitt */ -class CheckDefinitionValidityPass implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface +class CheckDefinitionValidityPass implements CompilerPassInterface { /** * Processes the ContainerBuilder to validate the Definition. * * @throws RuntimeException When the Definition is invalid */ - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { foreach ($container->getDefinitions() as $id => $definition) { // synthetic service is public if ($definition->isSynthetic() && !($definition->isPublic() || $definition->isPrivate())) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('A synthetic service ("%s") must be public.', $id)); + throw new RuntimeException(sprintf('A synthetic service ("%s") must be public.', $id)); } // non-synthetic, non-abstract service has class if (!$definition->isAbstract() && !$definition->isSynthetic() && !$definition->getClass()) { if ($definition->getFactory()) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Please add the class to service "%s" even if it is constructed by a factory since we might need to add method calls based on compile-time checks.', $id)); + throw new RuntimeException(sprintf('Please add the class to service "%s" even if it is constructed by a factory since we might need to add method calls based on compile-time checks.', $id)); } - if (\class_exists($id) || \interface_exists($id, \false)) { - if (0 === \strpos($id, '\\') && 1 < \substr_count($id, '\\')) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('The definition for "%s" has no class attribute, and appears to reference a class or interface. Please specify the class attribute explicitly or remove the leading backslash by renaming the service to "%s" to get rid of this error.', $id, \substr($id, 1))); + if (class_exists($id) || interface_exists($id, false)) { + if (0 === strpos($id, '\\') && 1 < substr_count($id, '\\')) { + throw new RuntimeException(sprintf('The definition for "%s" has no class attribute, and appears to reference a class or interface. Please specify the class attribute explicitly or remove the leading backslash by renaming the service to "%s" to get rid of this error.', $id, substr($id, 1))); } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('The definition for "%s" has no class attribute, and appears to reference a class or interface in the global namespace. Leaving out the "class" attribute is only allowed for namespaced classes. Please specify the class attribute explicitly to get rid of this error.', $id)); + throw new RuntimeException(sprintf('The definition for "%s" has no class attribute, and appears to reference a class or interface in the global namespace. Leaving out the "class" attribute is only allowed for namespaced classes. Please specify the class attribute explicitly to get rid of this error.', $id)); } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('The definition for "%s" has no class. If you intend to inject this service dynamically at runtime, please mark it as synthetic=true. If this is an abstract definition solely used by child definitions, please add abstract=true, otherwise specify a class to get rid of this error.', $id)); + throw new RuntimeException(sprintf('The definition for "%s" has no class. If you intend to inject this service dynamically at runtime, please mark it as synthetic=true. If this is an abstract definition solely used by child definitions, please add abstract=true, otherwise specify a class to get rid of this error.', $id)); } // tag attribute values must be scalars foreach ($definition->getTags() as $name => $tags) { foreach ($tags as $attributes) { foreach ($attributes as $attribute => $value) { - if (!\is_scalar($value) && null !== $value) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('A "tags" attribute must be of a scalar-type for service "%s", tag "%s", attribute "%s".', $id, $name, $attribute)); + if (!is_scalar($value) && null !== $value) { + throw new RuntimeException(sprintf('A "tags" attribute must be of a scalar-type for service "%s", tag "%s", attribute "%s".', $id, $name, $attribute)); } } } @@ -65,7 +73,7 @@ public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInj if ($definition->isPublic() && !$definition->isPrivate()) { $resolvedId = $container->resolveEnvPlaceholders($id, null, $usedEnvs); if (null !== $usedEnvs) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\EnvParameterException([$resolvedId], null, 'A service name ("%s") cannot contain dynamic values.'); + throw new EnvParameterException([$resolvedId], null, 'A service name ("%s") cannot contain dynamic values.'); } } } @@ -73,7 +81,7 @@ public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInj if ($alias->isPublic() && !$alias->isPrivate()) { $resolvedId = $container->resolveEnvPlaceholders($id, null, $usedEnvs); if (null !== $usedEnvs) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\EnvParameterException([$resolvedId], null, 'An alias name ("%s") cannot contain dynamic values.'); + throw new EnvParameterException([$resolvedId], null, 'An alias name ("%s") cannot contain dynamic values.'); } } } diff --git a/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php b/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php index 550dd1c0a..ce3adcc09 100644 --- a/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php +++ b/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php @@ -18,15 +18,15 @@ * * @author Johannes M. Schmitt */ -class CheckExceptionOnInvalidReferenceBehaviorPass extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass +class CheckExceptionOnInvalidReferenceBehaviorPass extends AbstractRecursivePass { - protected function processValue($value, $isRoot = \false) + protected function processValue($value, $isRoot = false) { - if (!$value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference) { + if (!$value instanceof Reference) { return parent::processValue($value, $isRoot); } - if (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE === $value->getInvalidBehavior() && !$this->container->has($id = (string) $value)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException($id, $this->currentId); + if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE === $value->getInvalidBehavior() && !$this->container->has($id = (string) $value)) { + throw new ServiceNotFoundException($id, $this->currentId); } return $value; } diff --git a/vendor/symfony/dependency-injection/Compiler/CheckReferenceValidityPass.php b/vendor/symfony/dependency-injection/Compiler/CheckReferenceValidityPass.php index d3d9dfe5d..038eadcbb 100644 --- a/vendor/symfony/dependency-injection/Compiler/CheckReferenceValidityPass.php +++ b/vendor/symfony/dependency-injection/Compiler/CheckReferenceValidityPass.php @@ -13,6 +13,8 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; +use function sprintf; + /** * Checks the validity of references. * @@ -21,17 +23,17 @@ * * @author Johannes M. Schmitt */ -class CheckReferenceValidityPass extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass +class CheckReferenceValidityPass extends AbstractRecursivePass { - protected function processValue($value, $isRoot = \false) + protected function processValue($value, $isRoot = false) { - if ($isRoot && $value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition && ($value->isSynthetic() || $value->isAbstract())) { + if ($isRoot && $value instanceof Definition && ($value->isSynthetic() || $value->isAbstract())) { return $value; } - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference && $this->container->hasDefinition((string) $value)) { + if ($value instanceof Reference && $this->container->hasDefinition((string) $value)) { $targetDefinition = $this->container->getDefinition((string) $value); if ($targetDefinition->isAbstract()) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('The definition "%s" has a reference to an abstract definition "%s". Abstract definitions cannot be the target of references.', $this->currentId, $value)); + throw new RuntimeException(sprintf('The definition "%s" has a reference to an abstract definition "%s". Abstract definitions cannot be the target of references.', $this->currentId, $value)); } } return parent::processValue($value, $isRoot); diff --git a/vendor/symfony/dependency-injection/Compiler/Compiler.php b/vendor/symfony/dependency-injection/Compiler/Compiler.php index c9905a579..879fe7aea 100644 --- a/vendor/symfony/dependency-injection/Compiler/Compiler.php +++ b/vendor/symfony/dependency-injection/Compiler/Compiler.php @@ -12,6 +12,19 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\EnvParameterException; +use Exception; +use ReflectionMethod; +use ReflectionProperty; +use function func_get_arg; +use function func_num_args; +use function get_class; +use function sprintf; +use function str_replace; +use function strpos; +use function trigger_error; +use function trim; +use const E_USER_DEPRECATED; + /** * This class is used to remove circular dependencies between individual passes. * @@ -25,8 +38,8 @@ class Compiler private $serviceReferenceGraph; public function __construct() { - $this->passConfig = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\PassConfig(); - $this->serviceReferenceGraph = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraph(); + $this->passConfig = new PassConfig(); + $this->serviceReferenceGraph = new ServiceReferenceGraph(); } /** * Returns the PassConfig. @@ -56,8 +69,8 @@ public function getServiceReferenceGraph() public function getLoggingFormatter() { if (null === $this->loggingFormatter) { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ContainerBuilder::log() method instead.', __METHOD__), \E_USER_DEPRECATED); - $this->loggingFormatter = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\LoggingFormatter(); + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ContainerBuilder::log() method instead.', __METHOD__), E_USER_DEPRECATED); + $this->loggingFormatter = new LoggingFormatter(); } return $this->loggingFormatter; } @@ -67,15 +80,15 @@ public function getLoggingFormatter() * @param CompilerPassInterface $pass A compiler pass * @param string $type The type of the pass */ - public function addPass(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface $pass, $type = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION) + public function addPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION) { - if (\func_num_args() >= 3) { - $priority = \func_get_arg(2); + if (func_num_args() >= 3) { + $priority = func_get_arg(2); } else { if (__CLASS__ !== static::class) { - $r = new \ReflectionMethod($this, __FUNCTION__); + $r = new ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @\trigger_error(\sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), \E_USER_DEPRECATED); + @trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), E_USER_DEPRECATED); } } $priority = 0; @@ -91,18 +104,18 @@ public function addPass(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInj */ public function addLogMessage($string) { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ContainerBuilder::log() method instead.', __METHOD__), \E_USER_DEPRECATED); + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ContainerBuilder::log() method instead.', __METHOD__), E_USER_DEPRECATED); $this->log[] = $string; } /** * @final */ - public function log(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface $pass, $message) + public function log(CompilerPassInterface $pass, $message) { - if (\false !== \strpos($message, "\n")) { - $message = \str_replace("\n", "\n" . \get_class($pass) . ': ', \trim($message)); + if (false !== strpos($message, "\n")) { + $message = str_replace("\n", "\n" . get_class($pass) . ': ', trim($message)); } - $this->log[] = \get_class($pass) . ': ' . $message; + $this->log[] = get_class($pass) . ': ' . $message; } /** * Returns the log. @@ -116,25 +129,25 @@ public function getLog() /** * Run the Compiler and process all Passes. */ - public function compile(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function compile(ContainerBuilder $container) { try { foreach ($this->passConfig->getPasses() as $pass) { $pass->process($container); } - } catch (\Exception $e) { + } catch (Exception $e) { $usedEnvs = []; $prev = $e; do { $msg = $prev->getMessage(); if ($msg !== ($resolvedMsg = $container->resolveEnvPlaceholders($msg, null, $usedEnvs))) { - $r = new \ReflectionProperty($prev, 'message'); - $r->setAccessible(\true); + $r = new ReflectionProperty($prev, 'message'); + $r->setAccessible(true); $r->setValue($prev, $resolvedMsg); } } while ($prev = $prev->getPrevious()); if ($usedEnvs) { - $e = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\EnvParameterException($usedEnvs, $e); + $e = new EnvParameterException($usedEnvs, $e); } throw $e; } finally { diff --git a/vendor/symfony/dependency-injection/Compiler/CompilerPassInterface.php b/vendor/symfony/dependency-injection/Compiler/CompilerPassInterface.php index 2db1600b4..68d955b54 100644 --- a/vendor/symfony/dependency-injection/Compiler/CompilerPassInterface.php +++ b/vendor/symfony/dependency-injection/Compiler/CompilerPassInterface.php @@ -21,5 +21,5 @@ interface CompilerPassInterface /** * You can modify the container here before it is dumped to PHP code. */ - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container); + public function process(ContainerBuilder $container); } diff --git a/vendor/symfony/dependency-injection/Compiler/DecoratorServicePass.php b/vendor/symfony/dependency-injection/Compiler/DecoratorServicePass.php index 654726fa9..8c65ff036 100644 --- a/vendor/symfony/dependency-injection/Compiler/DecoratorServicePass.php +++ b/vendor/symfony/dependency-injection/Compiler/DecoratorServicePass.php @@ -12,6 +12,10 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Alias; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; +use SplPriorityQueue; +use function array_merge; +use const PHP_INT_MAX; + /** * Overwrites a service but keeps the overridden one. * @@ -19,12 +23,12 @@ * @author Fabien Potencier * @author Diego Saint Esteben */ -class DecoratorServicePass implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface +class DecoratorServicePass implements CompilerPassInterface { - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { - $definitions = new \SplPriorityQueue(); - $order = \PHP_INT_MAX; + $definitions = new SplPriorityQueue(); + $order = PHP_INT_MAX; foreach ($container->getDefinitions() as $id => $definition) { if (!($decorated = $definition->getDecoratedService())) { continue; @@ -32,8 +36,8 @@ public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInj $definitions->insert([$id, $definition], [$decorated[2], --$order]); } $decoratingDefinitions = []; - foreach ($definitions as list($id, $definition)) { - list($inner, $renamedId) = $definition->getDecoratedService(); + foreach ($definitions as [$id, $definition]) { + [$inner, $renamedId] = $definition->getDecoratedService(); $definition->setDecoratedService(null); if (!$renamedId) { $renamedId = $id . '.inner'; @@ -44,20 +48,20 @@ public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInj $alias = $container->getAlias($inner); $public = $alias->isPublic(); $private = $alias->isPrivate(); - $container->setAlias($renamedId, new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Alias($container->normalizeId($alias), \false)); + $container->setAlias($renamedId, new Alias($container->normalizeId($alias), false)); } else { $decoratedDefinition = $container->getDefinition($inner); $public = $decoratedDefinition->isPublic(); $private = $decoratedDefinition->isPrivate(); - $decoratedDefinition->setPublic(\false); + $decoratedDefinition->setPublic(false); $container->setDefinition($renamedId, $decoratedDefinition); $decoratingDefinitions[$inner] = $decoratedDefinition; } if (isset($decoratingDefinitions[$inner])) { $decoratingDefinition = $decoratingDefinitions[$inner]; - $definition->setTags(\array_merge($decoratingDefinition->getTags(), $definition->getTags())); - $autowiringTypes = $decoratingDefinition->getAutowiringTypes(\false); - if ($types = \array_merge($autowiringTypes, $definition->getAutowiringTypes(\false))) { + $definition->setTags(array_merge($decoratingDefinition->getTags(), $definition->getTags())); + $autowiringTypes = $decoratingDefinition->getAutowiringTypes(false); + if ($types = array_merge($autowiringTypes, $definition->getAutowiringTypes(false))) { $definition->setAutowiringTypes($types); } $decoratingDefinition->setTags([]); diff --git a/vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php b/vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php index a48b7b0ac..2303ff12a 100644 --- a/vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php +++ b/vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php @@ -12,24 +12,26 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; +use function reset; + /** * Throws an exception for any Definitions that have errors and still exist. * * @author Ryan Weaver */ -class DefinitionErrorExceptionPass extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass +class DefinitionErrorExceptionPass extends AbstractRecursivePass { /** * {@inheritdoc} */ - protected function processValue($value, $isRoot = \false) + protected function processValue($value, $isRoot = false) { - if (!$value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition || empty($value->getErrors())) { + if (!$value instanceof Definition || empty($value->getErrors())) { return parent::processValue($value, $isRoot); } // only show the first error so the user can focus on it $errors = $value->getErrors(); - $message = \reset($errors); - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException($message); + $message = reset($errors); + throw new RuntimeException($message); } } diff --git a/vendor/symfony/dependency-injection/Compiler/ExtensionCompilerPass.php b/vendor/symfony/dependency-injection/Compiler/ExtensionCompilerPass.php index 16bcea4a6..f7779b6e6 100644 --- a/vendor/symfony/dependency-injection/Compiler/ExtensionCompilerPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ExtensionCompilerPass.php @@ -17,15 +17,15 @@ * * @author Wouter J */ -class ExtensionCompilerPass implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface +class ExtensionCompilerPass implements CompilerPassInterface { /** * {@inheritdoc} */ - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { foreach ($container->getExtensions() as $extension) { - if (!$extension instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface) { + if (!$extension instanceof CompilerPassInterface) { continue; } $extension->process($container); diff --git a/vendor/symfony/dependency-injection/Compiler/FactoryReturnTypePass.php b/vendor/symfony/dependency-injection/Compiler/FactoryReturnTypePass.php index 209ad6fb3..2181be602 100644 --- a/vendor/symfony/dependency-injection/Compiler/FactoryReturnTypePass.php +++ b/vendor/symfony/dependency-injection/Compiler/FactoryReturnTypePass.php @@ -13,28 +13,41 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; +use ReflectionException; +use ReflectionFunction; +use ReflectionMethod; +use ReflectionNamedType; +use function file_exists; +use function get_parent_class; +use function is_string; +use function method_exists; +use function sprintf; +use function strtolower; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * @author Guilhem N. * * @deprecated since version 3.3, to be removed in 4.0. */ -class FactoryReturnTypePass implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface +class FactoryReturnTypePass implements CompilerPassInterface { private $resolveClassPass; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass $resolveClassPass = null) + public function __construct(ResolveClassPass $resolveClassPass = null) { if (null === $resolveClassPass) { - @\trigger_error('The ' . __CLASS__ . ' class is deprecated since Symfony 3.3 and will be removed in 4.0.', \E_USER_DEPRECATED); + @trigger_error('The ' . __CLASS__ . ' class is deprecated since Symfony 3.3 and will be removed in 4.0.', E_USER_DEPRECATED); } $this->resolveClassPass = $resolveClassPass; } /** * {@inheritdoc} */ - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { // works only since php 7.0 and hhvm 3.11 - if (!\method_exists(\ReflectionMethod::class, 'getReturnType')) { + if (!method_exists(ReflectionMethod::class, 'getReturnType')) { return; } $resolveClassPassChanges = null !== $this->resolveClassPass ? $this->resolveClassPass->getChanges() : []; @@ -42,7 +55,7 @@ public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInj $this->updateDefinition($container, $id, $definition, $resolveClassPassChanges); } } - private function updateDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container, $id, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition, array $resolveClassPassChanges, array $previous = []) + private function updateDefinition(ContainerBuilder $container, $id, Definition $definition, array $resolveClassPassChanges, array $previous = []) { // circular reference if (isset($previous[$id])) { @@ -53,18 +66,18 @@ private function updateDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\Dep return; } $class = null; - if (\is_string($factory)) { + if (is_string($factory)) { try { - $m = new \ReflectionFunction($factory); - if (\false !== $m->getFileName() && \file_exists($m->getFileName())) { + $m = new ReflectionFunction($factory); + if (false !== $m->getFileName() && file_exists($m->getFileName())) { $container->fileExists($m->getFileName()); } - } catch (\ReflectionException $e) { + } catch (ReflectionException $e) { return; } } else { - if ($factory[0] instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference) { - $previous[$id] = \true; + if ($factory[0] instanceof Reference) { + $previous[$id] = true; $factoryId = $container->normalizeId($factory[0]); $factoryDefinition = $container->findDefinition($factoryId); $this->updateDefinition($container, $factoryId, $factoryDefinition, $resolveClassPassChanges, $previous); @@ -72,28 +85,28 @@ private function updateDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\Dep } else { $class = $factory[0]; } - if (!($m = $container->getReflectionClass($class, \false))) { + if (!($m = $container->getReflectionClass($class, false))) { return; } try { $m = $m->getMethod($factory[1]); - } catch (\ReflectionException $e) { + } catch (ReflectionException $e) { return; } } $returnType = $m->getReturnType(); if (null !== $returnType && !$returnType->isBuiltin()) { - $returnType = $returnType instanceof \ReflectionNamedType ? $returnType->getName() : $returnType->__toString(); + $returnType = $returnType instanceof ReflectionNamedType ? $returnType->getName() : $returnType->__toString(); if (null !== $class) { $declaringClass = $m->getDeclaringClass()->getName(); - if ('self' === \strtolower($returnType)) { + if ('self' === strtolower($returnType)) { $returnType = $declaringClass; - } elseif ('parent' === \strtolower($returnType)) { - $returnType = \get_parent_class($declaringClass) ?: null; + } elseif ('parent' === strtolower($returnType)) { + $returnType = get_parent_class($declaringClass) ?: null; } } if (null !== $returnType && (!isset($resolveClassPassChanges[$id]) || $returnType !== $resolveClassPassChanges[$id])) { - @\trigger_error(\sprintf('Relying on its factory\'s return-type to define the class of service "%s" is deprecated since Symfony 3.3 and won\'t work in 4.0. Set the "class" attribute to "%s" on the service definition instead.', $id, $returnType), \E_USER_DEPRECATED); + @trigger_error(sprintf('Relying on its factory\'s return-type to define the class of service "%s" is deprecated since Symfony 3.3 and won\'t work in 4.0. Set the "class" attribute to "%s" on the service definition instead.', $id, $returnType), E_USER_DEPRECATED); } $definition->setClass($returnType); } diff --git a/vendor/symfony/dependency-injection/Compiler/InlineServiceDefinitionsPass.php b/vendor/symfony/dependency-injection/Compiler/InlineServiceDefinitionsPass.php index f822d3893..76fd20715 100644 --- a/vendor/symfony/dependency-injection/Compiler/InlineServiceDefinitionsPass.php +++ b/vendor/symfony/dependency-injection/Compiler/InlineServiceDefinitionsPass.php @@ -14,19 +14,29 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; +use function array_keys; +use function array_search; +use function array_slice; +use function array_unique; +use function count; +use function is_array; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * Inline service definitions where this is possible. * * @author Johannes M. Schmitt */ -class InlineServiceDefinitionsPass extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RepeatablePassInterface +class InlineServiceDefinitionsPass extends AbstractRecursivePass implements RepeatablePassInterface { private $cloningIds = []; private $inlinedServiceIds = []; /** * {@inheritdoc} */ - public function setRepeatedPass(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RepeatedPass $repeatedPass) + public function setRepeatedPass(RepeatedPass $repeatedPass) { // no-op for BC } @@ -41,42 +51,42 @@ public function setRepeatedPass(\_PhpScoper5ea00cc67502b\Symfony\Component\Depen */ public function getInlinedServiceIds() { - @\trigger_error('Calling InlineServiceDefinitionsPass::getInlinedServiceIds() is deprecated since Symfony 3.4 and will be removed in 4.0.', \E_USER_DEPRECATED); + @trigger_error('Calling InlineServiceDefinitionsPass::getInlinedServiceIds() is deprecated since Symfony 3.4 and will be removed in 4.0.', E_USER_DEPRECATED); return $this->inlinedServiceIds; } /** * {@inheritdoc} */ - protected function processValue($value, $isRoot = \false) + protected function processValue($value, $isRoot = false) { - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ArgumentInterface) { + if ($value instanceof ArgumentInterface) { // Reference found in ArgumentInterface::getValues() are not inlineable return $value; } - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition && $this->cloningIds) { + if ($value instanceof Definition && $this->cloningIds) { if ($value->isShared()) { return $value; } $value = clone $value; } - if (!$value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference || !$this->container->hasDefinition($id = $this->container->normalizeId($value))) { + if (!$value instanceof Reference || !$this->container->hasDefinition($id = $this->container->normalizeId($value))) { return parent::processValue($value, $isRoot); } $definition = $this->container->getDefinition($id); if (!$this->isInlineableDefinition($id, $definition, $this->container->getCompiler()->getServiceReferenceGraph())) { return $value; } - $this->container->log($this, \sprintf('Inlined service "%s" to "%s".', $id, $this->currentId)); + $this->container->log($this, sprintf('Inlined service "%s" to "%s".', $id, $this->currentId)); $this->inlinedServiceIds[$id][] = $this->currentId; if ($definition->isShared()) { return $definition; } if (isset($this->cloningIds[$id])) { - $ids = \array_keys($this->cloningIds); + $ids = array_keys($this->cloningIds); $ids[] = $id; - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException($id, \array_slice($ids, \array_search($id, $ids))); + throw new ServiceCircularReferenceException($id, array_slice($ids, array_search($id, $ids))); } - $this->cloningIds[$id] = \true; + $this->cloningIds[$id] = true; try { return $this->processValue($definition); } finally { @@ -88,40 +98,40 @@ protected function processValue($value, $isRoot = \false) * * @return bool If the definition is inlineable */ - private function isInlineableDefinition($id, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraph $graph) + private function isInlineableDefinition($id, Definition $definition, ServiceReferenceGraph $graph) { if ($definition->getErrors() || $definition->isDeprecated() || $definition->isLazy() || $definition->isSynthetic()) { - return \false; + return false; } if (!$definition->isShared()) { - return \true; + return true; } if ($definition->isPublic() || $definition->isPrivate()) { - return \false; + return false; } if (!$graph->hasNode($id)) { - return \true; + return true; } if ($this->currentId == $id) { - return \false; + return false; } $ids = []; - $isReferencedByConstructor = \false; + $isReferencedByConstructor = false; foreach ($graph->getNode($id)->getInEdges() as $edge) { $isReferencedByConstructor = $isReferencedByConstructor || $edge->isReferencedByConstructor(); if ($edge->isWeak() || $edge->isLazy()) { - return \false; + return false; } $ids[] = $edge->getSourceNode()->getId(); } if (!$ids) { - return \true; + return true; } - if (\count(\array_unique($ids)) > 1) { - return \false; + if (count(array_unique($ids)) > 1) { + return false; } - if (\count($ids) > 1 && \is_array($factory = $definition->getFactory()) && ($factory[0] instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference || $factory[0] instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition)) { - return \false; + if (count($ids) > 1 && is_array($factory = $definition->getFactory()) && ($factory[0] instanceof Reference || $factory[0] instanceof Definition)) { + return false; } return $this->container->getDefinition($ids[0])->isShared(); } diff --git a/vendor/symfony/dependency-injection/Compiler/LoggingFormatter.php b/vendor/symfony/dependency-injection/Compiler/LoggingFormatter.php index 5a011d9fa..fca65f7b8 100644 --- a/vendor/symfony/dependency-injection/Compiler/LoggingFormatter.php +++ b/vendor/symfony/dependency-injection/Compiler/LoggingFormatter.php @@ -10,7 +10,13 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler; -@\trigger_error('The ' . __NAMESPACE__ . '\\LoggingFormatter class is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ContainerBuilder::log() method instead.', \E_USER_DEPRECATED); +use function get_class; +use function implode; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + +@trigger_error('The ' . __NAMESPACE__ . '\\LoggingFormatter class is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ContainerBuilder::log() method instead.', E_USER_DEPRECATED); /** * Used to format logging messages during the compilation. * @@ -20,28 +26,28 @@ */ class LoggingFormatter { - public function formatRemoveService(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface $pass, $id, $reason) + public function formatRemoveService(CompilerPassInterface $pass, $id, $reason) { - return $this->format($pass, \sprintf('Removed service "%s"; reason: %s.', $id, $reason)); + return $this->format($pass, sprintf('Removed service "%s"; reason: %s.', $id, $reason)); } - public function formatInlineService(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface $pass, $id, $target) + public function formatInlineService(CompilerPassInterface $pass, $id, $target) { - return $this->format($pass, \sprintf('Inlined service "%s" to "%s".', $id, $target)); + return $this->format($pass, sprintf('Inlined service "%s" to "%s".', $id, $target)); } - public function formatUpdateReference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface $pass, $serviceId, $oldDestId, $newDestId) + public function formatUpdateReference(CompilerPassInterface $pass, $serviceId, $oldDestId, $newDestId) { - return $this->format($pass, \sprintf('Changed reference of service "%s" previously pointing to "%s" to "%s".', $serviceId, $oldDestId, $newDestId)); + return $this->format($pass, sprintf('Changed reference of service "%s" previously pointing to "%s" to "%s".', $serviceId, $oldDestId, $newDestId)); } - public function formatResolveInheritance(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface $pass, $childId, $parentId) + public function formatResolveInheritance(CompilerPassInterface $pass, $childId, $parentId) { - return $this->format($pass, \sprintf('Resolving inheritance for "%s" (parent: %s).', $childId, $parentId)); + return $this->format($pass, sprintf('Resolving inheritance for "%s" (parent: %s).', $childId, $parentId)); } - public function formatUnusedAutowiringPatterns(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface $pass, $id, array $patterns) + public function formatUnusedAutowiringPatterns(CompilerPassInterface $pass, $id, array $patterns) { - return $this->format($pass, \sprintf('Autowiring\'s patterns "%s" for service "%s" don\'t match any method.', \implode('", "', $patterns), $id)); + return $this->format($pass, sprintf('Autowiring\'s patterns "%s" for service "%s" don\'t match any method.', implode('", "', $patterns), $id)); } - public function format(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface $pass, $message) + public function format(CompilerPassInterface $pass, $message) { - return \sprintf('%s: %s', \get_class($pass), $message); + return sprintf('%s: %s', get_class($pass), $message); } } diff --git a/vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php b/vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php index a21ac582d..147b68824 100644 --- a/vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php +++ b/vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php @@ -19,24 +19,32 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; +use Exception; +use function get_class; +use function is_string; +use function serialize; +use function sprintf; +use function stripos; +use function strpos; + /** * Merges extension configs into the container builder. * * @author Fabien Potencier */ -class MergeExtensionConfigurationPass implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface +class MergeExtensionConfigurationPass implements CompilerPassInterface { /** * {@inheritdoc} */ - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { $parameters = $container->getParameterBag()->all(); $definitions = $container->getDefinitions(); $aliases = $container->getAliases(); $exprLangProviders = $container->getExpressionLanguageProviders(); foreach ($container->getExtensions() as $extension) { - if ($extension instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface) { + if ($extension instanceof PrependExtensionInterface) { $extension->prepend($container); } } @@ -46,29 +54,29 @@ public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInj continue; } $resolvingBag = $container->getParameterBag(); - if ($resolvingBag instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag && $extension instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Extension\Extension) { + if ($resolvingBag instanceof EnvPlaceholderParameterBag && $extension instanceof Extension) { // create a dedicated bag so that we can track env vars per-extension - $resolvingBag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationParameterBag($resolvingBag); + $resolvingBag = new MergeExtensionConfigurationParameterBag($resolvingBag); } $config = $resolvingBag->resolveValue($config); try { - $tmpContainer = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationContainerBuilder($extension, $resolvingBag); + $tmpContainer = new MergeExtensionConfigurationContainerBuilder($extension, $resolvingBag); $tmpContainer->setResourceTracking($container->isTrackingResources()); $tmpContainer->addObjectResource($extension); - if ($extension instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Extension\ConfigurationExtensionInterface && null !== ($configuration = $extension->getConfiguration($config, $tmpContainer))) { + if ($extension instanceof ConfigurationExtensionInterface && null !== ($configuration = $extension->getConfiguration($config, $tmpContainer))) { $tmpContainer->addObjectResource($configuration); } foreach ($exprLangProviders as $provider) { $tmpContainer->addExpressionLanguageProvider($provider); } $extension->load($config, $tmpContainer); - } catch (\Exception $e) { - if ($resolvingBag instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationParameterBag) { + } catch (Exception $e) { + if ($resolvingBag instanceof MergeExtensionConfigurationParameterBag) { $container->getParameterBag()->mergeEnvPlaceholders($resolvingBag); } throw $e; } - if ($resolvingBag instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationParameterBag) { + if ($resolvingBag instanceof MergeExtensionConfigurationParameterBag) { // don't keep track of env vars that are *overridden* when configs are merged $resolvingBag->freezeAfterProcessing($extension, $tmpContainer); } @@ -82,7 +90,7 @@ public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInj /** * @internal */ -class MergeExtensionConfigurationParameterBag extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag +class MergeExtensionConfigurationParameterBag extends EnvPlaceholderParameterBag { private $processedEnvPlaceholders; public function __construct(parent $parameterBag) @@ -90,7 +98,7 @@ public function __construct(parent $parameterBag) parent::__construct($parameterBag->all()); $this->mergeEnvPlaceholders($parameterBag); } - public function freezeAfterProcessing(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Extension\Extension $extension, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function freezeAfterProcessing(Extension $extension, ContainerBuilder $container) { if (!($config = $extension->getProcessedConfigs())) { // Extension::processConfiguration() wasn't called, we cannot know how configs were merged @@ -98,10 +106,10 @@ public function freezeAfterProcessing(\_PhpScoper5ea00cc67502b\Symfony\Component } $this->processedEnvPlaceholders = []; // serialize config and container to catch env vars nested in object graphs - $config = \serialize($config) . \serialize($container->getDefinitions()) . \serialize($container->getAliases()) . \serialize($container->getParameterBag()->all()); + $config = serialize($config) . serialize($container->getDefinitions()) . serialize($container->getAliases()) . serialize($container->getParameterBag()->all()); foreach (parent::getEnvPlaceholders() as $env => $placeholders) { foreach ($placeholders as $placeholder) { - if (\false !== \stripos($config, $placeholder)) { + if (false !== stripos($config, $placeholder)) { $this->processedEnvPlaceholders[$env] = $placeholders; break; } @@ -121,55 +129,55 @@ public function getEnvPlaceholders() * * @internal */ -class MergeExtensionConfigurationContainerBuilder extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder +class MergeExtensionConfigurationContainerBuilder extends ContainerBuilder { private $extensionClass; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Extension\ExtensionInterface $extension, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface $parameterBag = null) + public function __construct(ExtensionInterface $extension, ParameterBagInterface $parameterBag = null) { parent::__construct($parameterBag); - $this->extensionClass = \get_class($extension); + $this->extensionClass = get_class($extension); } /** * {@inheritdoc} */ - public function addCompilerPass(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface $pass, $type = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION) + public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException(\sprintf('You cannot add compiler pass "%s" from extension "%s". Compiler passes must be registered before the container is compiled.', \get_class($pass), $this->extensionClass)); + throw new LogicException(sprintf('You cannot add compiler pass "%s" from extension "%s". Compiler passes must be registered before the container is compiled.', get_class($pass), $this->extensionClass)); } /** * {@inheritdoc} */ - public function registerExtension(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Extension\ExtensionInterface $extension) + public function registerExtension(ExtensionInterface $extension) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException(\sprintf('You cannot register extension "%s" from "%s". Extensions must be registered before the container is compiled.', \get_class($extension), $this->extensionClass)); + throw new LogicException(sprintf('You cannot register extension "%s" from "%s". Extensions must be registered before the container is compiled.', get_class($extension), $this->extensionClass)); } /** * {@inheritdoc} */ - public function compile($resolveEnvPlaceholders = \false) + public function compile($resolveEnvPlaceholders = false) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException(\sprintf('Cannot compile the container in extension "%s".', $this->extensionClass)); + throw new LogicException(sprintf('Cannot compile the container in extension "%s".', $this->extensionClass)); } /** * {@inheritdoc} */ public function resolveEnvPlaceholders($value, $format = null, array &$usedEnvs = null) { - if (\true !== $format || !\is_string($value)) { + if (true !== $format || !is_string($value)) { return parent::resolveEnvPlaceholders($value, $format, $usedEnvs); } $bag = $this->getParameterBag(); $value = $bag->resolveValue($value); - if (!$bag instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag) { + if (!$bag instanceof EnvPlaceholderParameterBag) { return parent::resolveEnvPlaceholders($value, $format, $usedEnvs); } foreach ($bag->getEnvPlaceholders() as $env => $placeholders) { - if (\false === \strpos($env, ':')) { + if (false === strpos($env, ':')) { continue; } foreach ($placeholders as $placeholder) { - if (\false !== \stripos($value, $placeholder)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Using a cast in "env(%s)" is incompatible with resolution at compile time in "%s". The logic in the extension should be moved to a compiler pass, or an env parameter with no cast should be used instead.', $env, $this->extensionClass)); + if (false !== stripos($value, $placeholder)) { + throw new RuntimeException(sprintf('Using a cast in "env(%s)" is incompatible with resolution at compile time in "%s". The logic in the extension should be moved to a compiler pass, or an env parameter with no cast should be used instead.', $env, $this->extensionClass)); } } } diff --git a/vendor/symfony/dependency-injection/Compiler/PassConfig.php b/vendor/symfony/dependency-injection/Compiler/PassConfig.php index 1b8b3210b..503f7ca77 100644 --- a/vendor/symfony/dependency-injection/Compiler/PassConfig.php +++ b/vendor/symfony/dependency-injection/Compiler/PassConfig.php @@ -11,6 +11,17 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use ReflectionMethod; +use function array_merge; +use function call_user_func_array; +use function count; +use function func_get_arg; +use function func_num_args; +use function krsort; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * Compiler Pass Configuration. * @@ -33,11 +44,11 @@ class PassConfig private $removingPasses; public function __construct() { - $this->mergePass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass(); - $this->beforeOptimizationPasses = [100 => [$resolveClassPass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveInstanceofConditionalsPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RegisterEnvVarProcessorsPass()], -1000 => [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ExtensionCompilerPass()]]; - $this->optimizationPasses = [[new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RegisterServiceSubscribersPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\DecoratorServicePass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass(\false, \false), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveFactoryClassPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\FactoryReturnTypePass($resolveClassPass), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CheckDefinitionValidityPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveNamedArgumentsPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveBindingsPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass(\false), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveTaggedIteratorArgumentPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveServiceSubscribersPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveReferencesToAliasesPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveInvalidReferencesPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass(\true), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CheckCircularReferencesPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CheckReferenceValidityPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CheckArgumentsValidityPass(\false)]]; - $this->beforeRemovingPasses = [-100 => [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolvePrivatesPass()]]; - $this->removingPasses = [[new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RemovePrivateAliasesPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ReplaceAliasByActualDefinitionPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RemoveAbstractDefinitionsPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RepeatedPass([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\InlineServiceDefinitionsPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RemoveUnusedDefinitionsPass()]), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\DefinitionErrorExceptionPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveHotPathPass()]]; + $this->mergePass = new MergeExtensionConfigurationPass(); + $this->beforeOptimizationPasses = [100 => [$resolveClassPass = new ResolveClassPass(), new ResolveInstanceofConditionalsPass(), new RegisterEnvVarProcessorsPass()], -1000 => [new ExtensionCompilerPass()]]; + $this->optimizationPasses = [[new ResolveChildDefinitionsPass(), new ServiceLocatorTagPass(), new RegisterServiceSubscribersPass(), new DecoratorServicePass(), new ResolveParameterPlaceHoldersPass(false, false), new ResolveFactoryClassPass(), new FactoryReturnTypePass($resolveClassPass), new CheckDefinitionValidityPass(), new ResolveNamedArgumentsPass(), new AutowireRequiredMethodsPass(), new ResolveBindingsPass(), new AutowirePass(false), new ResolveTaggedIteratorArgumentPass(), new ResolveServiceSubscribersPass(), new ResolveReferencesToAliasesPass(), new ResolveInvalidReferencesPass(), new AnalyzeServiceReferencesPass(true), new CheckCircularReferencesPass(), new CheckReferenceValidityPass(), new CheckArgumentsValidityPass(false)]]; + $this->beforeRemovingPasses = [-100 => [new ResolvePrivatesPass()]]; + $this->removingPasses = [[new RemovePrivateAliasesPass(), new ReplaceAliasByActualDefinitionPass(), new RemoveAbstractDefinitionsPass(), new RepeatedPass([new AnalyzeServiceReferencesPass(), new InlineServiceDefinitionsPass(), new AnalyzeServiceReferencesPass(), new RemoveUnusedDefinitionsPass()]), new DefinitionErrorExceptionPass(), new CheckExceptionOnInvalidReferenceBehaviorPass(), new ResolveHotPathPass()]]; } /** * Returns all passes in order to be processed. @@ -46,7 +57,7 @@ public function __construct() */ public function getPasses() { - return \array_merge([$this->mergePass], $this->getBeforeOptimizationPasses(), $this->getOptimizationPasses(), $this->getBeforeRemovingPasses(), $this->getRemovingPasses(), $this->getAfterRemovingPasses()); + return array_merge([$this->mergePass], $this->getBeforeOptimizationPasses(), $this->getOptimizationPasses(), $this->getBeforeRemovingPasses(), $this->getRemovingPasses(), $this->getAfterRemovingPasses()); } /** * Adds a pass. @@ -56,22 +67,22 @@ public function getPasses() * * @throws InvalidArgumentException when a pass type doesn't exist */ - public function addPass(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface $pass, $type = self::TYPE_BEFORE_OPTIMIZATION) + public function addPass(CompilerPassInterface $pass, $type = self::TYPE_BEFORE_OPTIMIZATION) { - if (\func_num_args() >= 3) { - $priority = \func_get_arg(2); + if (func_num_args() >= 3) { + $priority = func_get_arg(2); } else { if (__CLASS__ !== static::class) { - $r = new \ReflectionMethod($this, __FUNCTION__); + $r = new ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @\trigger_error(\sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), \E_USER_DEPRECATED); + @trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), E_USER_DEPRECATED); } } $priority = 0; } $property = $type . 'Passes'; if (!isset($this->{$property})) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Invalid type "%s".', $type)); + throw new InvalidArgumentException(sprintf('Invalid type "%s".', $type)); } $passes =& $this->{$property}; if (!isset($passes[$priority])) { @@ -133,7 +144,7 @@ public function getMergePass() { return $this->mergePass; } - public function setMergePass(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface $pass) + public function setMergePass(CompilerPassInterface $pass) { $this->mergePass = $pass; } @@ -191,11 +202,11 @@ public function setRemovingPasses(array $passes) */ private function sortPasses(array $passes) { - if (0 === \count($passes)) { + if (0 === count($passes)) { return []; } - \krsort($passes); + krsort($passes); // Flatten the array - return \call_user_func_array('array_merge', $passes); + return call_user_func_array('array_merge', $passes); } } diff --git a/vendor/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php b/vendor/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php index 6b54d37c0..f043f383c 100644 --- a/vendor/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php +++ b/vendor/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php @@ -12,6 +12,9 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; +use function call_user_func_array; +use function krsort; + /** * Trait that allows a generic method to find and sort service by priority option in the tag. * @@ -33,16 +36,16 @@ trait PriorityTaggedServiceTrait * * @return Reference[] */ - private function findAndSortTaggedServices($tagName, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + private function findAndSortTaggedServices($tagName, ContainerBuilder $container) { $services = []; - foreach ($container->findTaggedServiceIds($tagName, \true) as $serviceId => $attributes) { + foreach ($container->findTaggedServiceIds($tagName, true) as $serviceId => $attributes) { $priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0; - $services[$priority][] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference($serviceId); + $services[$priority][] = new Reference($serviceId); } if ($services) { - \krsort($services); - $services = \call_user_func_array('array_merge', $services); + krsort($services); + $services = call_user_func_array('array_merge', $services); } return $services; } diff --git a/vendor/symfony/dependency-injection/Compiler/RegisterEnvVarProcessorsPass.php b/vendor/symfony/dependency-injection/Compiler/RegisterEnvVarProcessorsPass.php index c2cedb424..dc3a23105 100644 --- a/vendor/symfony/dependency-injection/Compiler/RegisterEnvVarProcessorsPass.php +++ b/vendor/symfony/dependency-injection/Compiler/RegisterEnvVarProcessorsPass.php @@ -18,48 +18,53 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator; +use function explode; +use function implode; +use function in_array; +use function sprintf; + /** * Creates the container.env_var_processors_locator service. * * @author Nicolas Grekas */ -class RegisterEnvVarProcessorsPass implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface +class RegisterEnvVarProcessorsPass implements CompilerPassInterface { private static $allowedTypes = ['array', 'bool', 'float', 'int', 'string']; - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { $bag = $container->getParameterBag(); $types = []; $processors = []; foreach ($container->findTaggedServiceIds('container.env_var_processor') as $id => $tags) { if (!($r = $container->getReflectionClass($class = $container->getDefinition($id)->getClass()))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id)); - } elseif (!$r->isSubclassOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\EnvVarProcessorInterface::class)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Service "%s" must implement interface "%s".', $id, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\EnvVarProcessorInterface::class)); + throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id)); + } elseif (!$r->isSubclassOf(EnvVarProcessorInterface::class)) { + throw new InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, EnvVarProcessorInterface::class)); } foreach ($class::getProvidedTypes() as $prefix => $type) { - $processors[$prefix] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference($id)); + $processors[$prefix] = new ServiceClosureArgument(new Reference($id)); $types[$prefix] = self::validateProvidedTypes($type, $class); } } - if ($bag instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag) { - foreach (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\EnvVarProcessor::getProvidedTypes() as $prefix => $type) { + if ($bag instanceof EnvPlaceholderParameterBag) { + foreach (EnvVarProcessor::getProvidedTypes() as $prefix => $type) { if (!isset($types[$prefix])) { - $types[$prefix] = self::validateProvidedTypes($type, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\EnvVarProcessor::class); + $types[$prefix] = self::validateProvidedTypes($type, EnvVarProcessor::class); } } $bag->setProvidedTypes($types); } if ($processors) { - $container->register('container.env_var_processors_locator', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator::class)->setPublic(\true)->setArguments([$processors]); + $container->register('container.env_var_processors_locator', ServiceLocator::class)->setPublic(true)->setArguments([$processors]); } } private static function validateProvidedTypes($types, $class) { - $types = \explode('|', $types); + $types = explode('|', $types); foreach ($types as $type) { - if (!\in_array($type, self::$allowedTypes)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Invalid type "%s" returned by "%s::getProvidedTypes()", expected one of "%s".', $type, $class, \implode('", "', self::$allowedTypes))); + if (!in_array($type, self::$allowedTypes)) { + throw new InvalidArgumentException(sprintf('Invalid type "%s" returned by "%s::getProvidedTypes()", expected one of "%s".', $type, $class, implode('", "', self::$allowedTypes))); } } return $types; diff --git a/vendor/symfony/dependency-injection/Compiler/RegisterServiceSubscribersPass.php b/vendor/symfony/dependency-injection/Compiler/RegisterServiceSubscribersPass.php index b8f49baeb..082215925 100644 --- a/vendor/symfony/dependency-injection/Compiler/RegisterServiceSubscribersPass.php +++ b/vendor/symfony/dependency-injection/Compiler/RegisterServiceSubscribersPass.php @@ -16,75 +16,90 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceSubscriberInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference; +use ReflectionMethod; +use function array_diff; +use function array_key_exists; +use function array_keys; +use function count; +use function gettype; +use function implode; +use function is_int; +use function is_string; +use function ksort; +use function preg_match; +use function sprintf; +use function str_replace; +use function substr; + /** * Compiler pass to register tagged services that require a service locator. * * @author Nicolas Grekas */ -class RegisterServiceSubscribersPass extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass +class RegisterServiceSubscribersPass extends AbstractRecursivePass { - protected function processValue($value, $isRoot = \false) + protected function processValue($value, $isRoot = false) { - if (!$value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition || $value->isAbstract() || $value->isSynthetic() || !$value->hasTag('container.service_subscriber')) { + if (!$value instanceof Definition || $value->isAbstract() || $value->isSynthetic() || !$value->hasTag('container.service_subscriber')) { return parent::processValue($value, $isRoot); } $serviceMap = []; $autowire = $value->isAutowired(); foreach ($value->getTag('container.service_subscriber') as $attributes) { if (!$attributes) { - $autowire = \true; + $autowire = true; continue; } - \ksort($attributes); - if ([] !== \array_diff(\array_keys($attributes), ['id', 'key'])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The "container.service_subscriber" tag accepts only the "key" and "id" attributes, "%s" given for service "%s".', \implode('", "', \array_keys($attributes)), $this->currentId)); + ksort($attributes); + if ([] !== array_diff(array_keys($attributes), ['id', 'key'])) { + throw new InvalidArgumentException(sprintf('The "container.service_subscriber" tag accepts only the "key" and "id" attributes, "%s" given for service "%s".', implode('", "', array_keys($attributes)), $this->currentId)); } - if (!\array_key_exists('id', $attributes)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Missing "id" attribute on "container.service_subscriber" tag with key="%s" for service "%s".', $attributes['key'], $this->currentId)); + if (!array_key_exists('id', $attributes)) { + throw new InvalidArgumentException(sprintf('Missing "id" attribute on "container.service_subscriber" tag with key="%s" for service "%s".', $attributes['key'], $this->currentId)); } - if (!\array_key_exists('key', $attributes)) { + if (!array_key_exists('key', $attributes)) { $attributes['key'] = $attributes['id']; } if (isset($serviceMap[$attributes['key']])) { continue; } - $serviceMap[$attributes['key']] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference($attributes['id']); + $serviceMap[$attributes['key']] = new Reference($attributes['id']); } $class = $value->getClass(); if (!($r = $this->container->getReflectionClass($class))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Class "%s" used for service "%s" cannot be found.', $class, $this->currentId)); + throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $this->currentId)); } - if (!$r->isSubclassOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceSubscriberInterface::class)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Service "%s" must implement interface "%s".', $this->currentId, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceSubscriberInterface::class)); + if (!$r->isSubclassOf(ServiceSubscriberInterface::class)) { + throw new InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $this->currentId, ServiceSubscriberInterface::class)); } $class = $r->name; $subscriberMap = []; - $declaringClass = (new \ReflectionMethod($class, 'getSubscribedServices'))->class; + $declaringClass = (new ReflectionMethod($class, 'getSubscribedServices'))->class; foreach ($class::getSubscribedServices() as $key => $type) { - if (!\is_string($type) || !\preg_match('/^\\??[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+(?:\\\\[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+)*+$/', $type)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('"%s::getSubscribedServices()" must return valid PHP types for service "%s" key "%s", "%s" returned.', $class, $this->currentId, $key, \is_string($type) ? $type : \gettype($type))); + if (!is_string($type) || !preg_match('/^\\??[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+(?:\\\\[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+)*+$/', $type)) { + throw new InvalidArgumentException(sprintf('"%s::getSubscribedServices()" must return valid PHP types for service "%s" key "%s", "%s" returned.', $class, $this->currentId, $key, is_string($type) ? $type : gettype($type))); } if ($optionalBehavior = '?' === $type[0]) { - $type = \substr($type, 1); - $optionalBehavior = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE; + $type = substr($type, 1); + $optionalBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE; } - if (\is_int($key)) { + if (is_int($key)) { $key = $type; } if (!isset($serviceMap[$key])) { if (!$autowire) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Service "%s" misses a "container.service_subscriber" tag with "key"/"id" attributes corresponding to entry "%s" as returned by "%s::getSubscribedServices()".', $this->currentId, $key, $class)); + throw new InvalidArgumentException(sprintf('Service "%s" misses a "container.service_subscriber" tag with "key"/"id" attributes corresponding to entry "%s" as returned by "%s::getSubscribedServices()".', $this->currentId, $key, $class)); } - $serviceMap[$key] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference($type); + $serviceMap[$key] = new Reference($type); } - $subscriberMap[$key] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference($this->container->normalizeId($serviceMap[$key]), $type, $declaringClass, $optionalBehavior ?: \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE); + $subscriberMap[$key] = new TypedReference($this->container->normalizeId($serviceMap[$key]), $type, $declaringClass, $optionalBehavior ?: ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE); unset($serviceMap[$key]); } - if ($serviceMap = \array_keys($serviceMap)) { - $message = \sprintf(1 < \count($serviceMap) ? 'keys "%s" do' : 'key "%s" does', \str_replace('%', '%%', \implode('", "', $serviceMap))); - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Service %s not exist in the map returned by "%s::getSubscribedServices()" for service "%s".', $message, $class, $this->currentId)); + if ($serviceMap = array_keys($serviceMap)) { + $message = sprintf(1 < count($serviceMap) ? 'keys "%s" do' : 'key "%s" does', str_replace('%', '%%', implode('", "', $serviceMap))); + throw new InvalidArgumentException(sprintf('Service %s not exist in the map returned by "%s::getSubscribedServices()" for service "%s".', $message, $class, $this->currentId)); } - $value->addTag('container.service_subscriber.locator', ['id' => (string) \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass::register($this->container, $subscriberMap, $this->currentId)]); + $value->addTag('container.service_subscriber.locator', ['id' => (string) ServiceLocatorTagPass::register($this->container, $subscriberMap, $this->currentId)]); return parent::processValue($value); } } diff --git a/vendor/symfony/dependency-injection/Compiler/RemoveAbstractDefinitionsPass.php b/vendor/symfony/dependency-injection/Compiler/RemoveAbstractDefinitionsPass.php index ff8f85db2..ebf664ccb 100644 --- a/vendor/symfony/dependency-injection/Compiler/RemoveAbstractDefinitionsPass.php +++ b/vendor/symfony/dependency-injection/Compiler/RemoveAbstractDefinitionsPass.php @@ -11,20 +11,22 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; +use function sprintf; + /** * Removes abstract Definitions. */ -class RemoveAbstractDefinitionsPass implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface +class RemoveAbstractDefinitionsPass implements CompilerPassInterface { /** * Removes abstract definitions from the ContainerBuilder. */ - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { foreach ($container->getDefinitions() as $id => $definition) { if ($definition->isAbstract()) { $container->removeDefinition($id); - $container->log($this, \sprintf('Removed service "%s"; reason: abstract.', $id)); + $container->log($this, sprintf('Removed service "%s"; reason: abstract.', $id)); } } } diff --git a/vendor/symfony/dependency-injection/Compiler/RemovePrivateAliasesPass.php b/vendor/symfony/dependency-injection/Compiler/RemovePrivateAliasesPass.php index 0c6295a8a..dc547c625 100644 --- a/vendor/symfony/dependency-injection/Compiler/RemovePrivateAliasesPass.php +++ b/vendor/symfony/dependency-injection/Compiler/RemovePrivateAliasesPass.php @@ -11,6 +11,8 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; +use function sprintf; + /** * Remove private aliases from the container. They were only used to establish * dependencies between services, and these dependencies have been resolved in @@ -18,19 +20,19 @@ * * @author Johannes M. Schmitt */ -class RemovePrivateAliasesPass implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface +class RemovePrivateAliasesPass implements CompilerPassInterface { /** * Removes private aliases from the ContainerBuilder. */ - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { foreach ($container->getAliases() as $id => $alias) { if ($alias->isPublic() || $alias->isPrivate()) { continue; } $container->removeAlias($id); - $container->log($this, \sprintf('Removed service "%s"; reason: private alias.', $id)); + $container->log($this, sprintf('Removed service "%s"; reason: private alias.', $id)); } } } diff --git a/vendor/symfony/dependency-injection/Compiler/RemoveUnusedDefinitionsPass.php b/vendor/symfony/dependency-injection/Compiler/RemoveUnusedDefinitionsPass.php index 827c553f6..4938f381d 100644 --- a/vendor/symfony/dependency-injection/Compiler/RemoveUnusedDefinitionsPass.php +++ b/vendor/symfony/dependency-injection/Compiler/RemoveUnusedDefinitionsPass.php @@ -11,28 +11,34 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; +use function array_unique; +use function count; +use function reset; +use function serialize; +use function sprintf; + /** * Removes unused service definitions from the container. * * @author Johannes M. Schmitt */ -class RemoveUnusedDefinitionsPass implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RepeatablePassInterface +class RemoveUnusedDefinitionsPass implements RepeatablePassInterface { private $repeatedPass; /** * {@inheritdoc} */ - public function setRepeatedPass(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RepeatedPass $repeatedPass) + public function setRepeatedPass(RepeatedPass $repeatedPass) { $this->repeatedPass = $repeatedPass; } /** * Processes the ContainerBuilder to remove unused definitions. */ - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { $graph = $container->getCompiler()->getServiceReferenceGraph(); - $hasChanged = \false; + $hasChanged = false; foreach ($container->getDefinitions() as $id => $definition) { if ($definition->isPublic() || $definition->isPrivate()) { continue; @@ -51,22 +57,22 @@ public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInj $referencingAliases[] = $node->getValue(); } } - $isReferenced = \count(\array_unique($sourceIds)) - \count($referencingAliases) > 0; + $isReferenced = count(array_unique($sourceIds)) - count($referencingAliases) > 0; } else { $referencingAliases = []; - $isReferenced = \false; + $isReferenced = false; } - if (1 === \count($referencingAliases) && \false === $isReferenced) { - $container->setDefinition((string) \reset($referencingAliases), $definition); + if (1 === count($referencingAliases) && false === $isReferenced) { + $container->setDefinition((string) reset($referencingAliases), $definition); $definition->setPublic(!$definition->isPrivate()); - $definition->setPrivate(\reset($referencingAliases)->isPrivate()); + $definition->setPrivate(reset($referencingAliases)->isPrivate()); $container->removeDefinition($id); - $container->log($this, \sprintf('Removed service "%s"; reason: replaces alias %s.', $id, \reset($referencingAliases))); - } elseif (0 === \count($referencingAliases) && \false === $isReferenced) { + $container->log($this, sprintf('Removed service "%s"; reason: replaces alias %s.', $id, reset($referencingAliases))); + } elseif (0 === count($referencingAliases) && false === $isReferenced) { $container->removeDefinition($id); - $container->resolveEnvPlaceholders(\serialize($definition)); - $container->log($this, \sprintf('Removed service "%s"; reason: unused.', $id)); - $hasChanged = \true; + $container->resolveEnvPlaceholders(serialize($definition)); + $container->log($this, sprintf('Removed service "%s"; reason: unused.', $id)); + $hasChanged = true; } } if ($hasChanged) { diff --git a/vendor/symfony/dependency-injection/Compiler/RepeatablePassInterface.php b/vendor/symfony/dependency-injection/Compiler/RepeatablePassInterface.php index ed09d059d..33f82bdee 100644 --- a/vendor/symfony/dependency-injection/Compiler/RepeatablePassInterface.php +++ b/vendor/symfony/dependency-injection/Compiler/RepeatablePassInterface.php @@ -16,7 +16,7 @@ * * @author Johannes M. Schmitt */ -interface RepeatablePassInterface extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface +interface RepeatablePassInterface extends CompilerPassInterface { - public function setRepeatedPass(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RepeatedPass $repeatedPass); + public function setRepeatedPass(RepeatedPass $repeatedPass); } diff --git a/vendor/symfony/dependency-injection/Compiler/RepeatedPass.php b/vendor/symfony/dependency-injection/Compiler/RepeatedPass.php index 8968bccce..e25a77240 100644 --- a/vendor/symfony/dependency-injection/Compiler/RepeatedPass.php +++ b/vendor/symfony/dependency-injection/Compiler/RepeatedPass.php @@ -17,12 +17,12 @@ * * @author Johannes M. Schmitt */ -class RepeatedPass implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface +class RepeatedPass implements CompilerPassInterface { /** * @var bool */ - private $repeat = \false; + private $repeat = false; private $passes; /** * @param RepeatablePassInterface[] $passes An array of RepeatablePassInterface objects @@ -32,8 +32,8 @@ class RepeatedPass implements \_PhpScoper5ea00cc67502b\Symfony\Component\Depende public function __construct(array $passes) { foreach ($passes as $pass) { - if (!$pass instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RepeatablePassInterface) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException('$passes must be an array of RepeatablePassInterface.'); + if (!$pass instanceof RepeatablePassInterface) { + throw new InvalidArgumentException('$passes must be an array of RepeatablePassInterface.'); } $pass->setRepeatedPass($this); } @@ -42,10 +42,10 @@ public function __construct(array $passes) /** * Process the repeatable passes that run more than once. */ - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { do { - $this->repeat = \false; + $this->repeat = false; foreach ($this->passes as $pass) { $pass->process($container); } @@ -56,7 +56,7 @@ public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInj */ public function setRepeat() { - $this->repeat = \true; + $this->repeat = true; } /** * Returns the passes. diff --git a/vendor/symfony/dependency-injection/Compiler/ReplaceAliasByActualDefinitionPass.php b/vendor/symfony/dependency-injection/Compiler/ReplaceAliasByActualDefinitionPass.php index fe89f5c42..2462cebd5 100644 --- a/vendor/symfony/dependency-injection/Compiler/ReplaceAliasByActualDefinitionPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ReplaceAliasByActualDefinitionPass.php @@ -13,13 +13,15 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; +use function sprintf; + /** * Replaces aliases with actual service definitions, effectively removing these * aliases. * * @author Johannes M. Schmitt */ -class ReplaceAliasByActualDefinitionPass extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass +class ReplaceAliasByActualDefinitionPass extends AbstractRecursivePass { private $replacements; /** @@ -27,7 +29,7 @@ class ReplaceAliasByActualDefinitionPass extends \_PhpScoper5ea00cc67502b\Symfon * * @throws InvalidArgumentException if the service definition does not exist */ - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { // First collect all alias targets that need to be replaced $seenAliasTargets = []; @@ -47,11 +49,11 @@ public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInj continue; } // Process new target - $seenAliasTargets[$targetId] = \true; + $seenAliasTargets[$targetId] = true; try { $definition = $container->getDefinition($targetId); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException $e) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Unable to replace alias "%s" with actual definition "%s".', $definitionId, $targetId), null, $e); + } catch (InvalidArgumentException $e) { + throw new InvalidArgumentException(sprintf('Unable to replace alias "%s" with actual definition "%s".', $definitionId, $targetId), null, $e); } if ($definition->isPublic() || $definition->isPrivate()) { continue; @@ -70,13 +72,13 @@ public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInj /** * {@inheritdoc} */ - protected function processValue($value, $isRoot = \false) + protected function processValue($value, $isRoot = false) { - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference && isset($this->replacements[$referenceId = $this->container->normalizeId($value)])) { + if ($value instanceof Reference && isset($this->replacements[$referenceId = $this->container->normalizeId($value)])) { // Perform the replacement $newId = $this->replacements[$referenceId]; - $value = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference($newId, $value->getInvalidBehavior()); - $this->container->log($this, \sprintf('Changed reference of service "%s" previously pointing to "%s" to "%s".', $this->currentId, $referenceId, $newId)); + $value = new Reference($newId, $value->getInvalidBehavior()); + $this->container->log($this, sprintf('Changed reference of service "%s" previously pointing to "%s" to "%s".', $this->currentId, $referenceId, $newId)); } return parent::processValue($value, $isRoot); } diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveBindingsPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveBindingsPass.php index 025d082cb..23d3f41ba 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveBindingsPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveBindingsPass.php @@ -18,10 +18,18 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\LazyProxy\ProxyHelper; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference; +use ReflectionFunctionAbstract; +use function array_key_exists; +use function array_pop; +use function count; +use function gettype; +use function ksort; +use function sprintf; + /** * @author Guilhem Niot */ -class ResolveBindingsPass extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass +class ResolveBindingsPass extends AbstractRecursivePass { private $usedBindings = []; private $unusedBindings = []; @@ -29,20 +37,20 @@ class ResolveBindingsPass extends \_PhpScoper5ea00cc67502b\Symfony\Component\Dep /** * {@inheritdoc} */ - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { $this->usedBindings = $container->getRemovedBindingIds(); try { parent::process($container); - foreach ($this->unusedBindings as list($key, $serviceId)) { - $message = \sprintf('Unused binding "%s" in service "%s".', $key, $serviceId); + foreach ($this->unusedBindings as [$key, $serviceId]) { + $message = sprintf('Unused binding "%s" in service "%s".', $key, $serviceId); if ($this->errorMessages) { - $message .= \sprintf("\nCould be related to%s:", 1 < \count($this->errorMessages) ? ' one of' : ''); + $message .= sprintf("\nCould be related to%s:", 1 < count($this->errorMessages) ? ' one of' : ''); } foreach ($this->errorMessages as $m) { $message .= "\n - " . $m; } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException($message); + throw new InvalidArgumentException($message); } } finally { $this->usedBindings = []; @@ -53,9 +61,9 @@ public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInj /** * {@inheritdoc} */ - protected function processValue($value, $isRoot = \false) + protected function processValue($value, $isRoot = false) { - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference && $value->getType() === $this->container->normalizeId($value)) { + if ($value instanceof TypedReference && $value->getType() === $this->container->normalizeId($value)) { // Already checked $bindings = $this->container->getDefinition($this->currentId)->getBindings(); if (isset($bindings[$value->getType()])) { @@ -63,13 +71,13 @@ protected function processValue($value, $isRoot = \false) } return parent::processValue($value, $isRoot); } - if (!$value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition || !($bindings = $value->getBindings())) { + if (!$value instanceof Definition || !($bindings = $value->getBindings())) { return parent::processValue($value, $isRoot); } foreach ($bindings as $key => $binding) { - list($bindingValue, $bindingId, $used) = $binding->getValues(); + [$bindingValue, $bindingId, $used] = $binding->getValues(); if ($used) { - $this->usedBindings[$bindingId] = \true; + $this->usedBindings[$bindingId] = true; unset($this->unusedBindings[$bindingId]); } elseif (!isset($this->usedBindings[$bindingId])) { $this->unusedBindings[$bindingId] = [$key, $this->currentId]; @@ -77,8 +85,8 @@ protected function processValue($value, $isRoot = \false) if (isset($key[0]) && '$' === $key[0]) { continue; } - if (null !== $bindingValue && !$bindingValue instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference && !$bindingValue instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Invalid value for binding key "%s" for service "%s": expected null, an instance of "%s" or an instance of "%s", "%s" given.', $key, $this->currentId, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition::class, \gettype($bindingValue))); + if (null !== $bindingValue && !$bindingValue instanceof Reference && !$bindingValue instanceof Definition) { + throw new InvalidArgumentException(sprintf('Invalid value for binding key "%s" for service "%s": expected null, an instance of "%s" or an instance of "%s", "%s" given.', $key, $this->currentId, Reference::class, Definition::class, gettype($bindingValue))); } } if ($value->isAbstract()) { @@ -86,22 +94,22 @@ protected function processValue($value, $isRoot = \false) } $calls = $value->getMethodCalls(); try { - if ($constructor = $this->getConstructor($value, \false)) { + if ($constructor = $this->getConstructor($value, false)) { $calls[] = [$constructor, $value->getArguments()]; } - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException $e) { + } catch (RuntimeException $e) { $this->errorMessages[] = $e->getMessage(); $this->container->getDefinition($this->currentId)->addError($e->getMessage()); return parent::processValue($value, $isRoot); } foreach ($calls as $i => $call) { - list($method, $arguments) = $call; - if ($method instanceof \ReflectionFunctionAbstract) { + [$method, $arguments] = $call; + if ($method instanceof ReflectionFunctionAbstract) { $reflectionMethod = $method; } else { try { $reflectionMethod = $this->getReflectionMethod($value, $method); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException $e) { + } catch (RuntimeException $e) { if ($value->getFactory()) { continue; } @@ -109,26 +117,26 @@ protected function processValue($value, $isRoot = \false) } } foreach ($reflectionMethod->getParameters() as $key => $parameter) { - if (\array_key_exists($key, $arguments) && '' !== $arguments[$key]) { + if (array_key_exists($key, $arguments) && '' !== $arguments[$key]) { continue; } - if (\array_key_exists('$' . $parameter->name, $bindings)) { + if (array_key_exists('$' . $parameter->name, $bindings)) { $arguments[$key] = $this->getBindingValue($bindings['$' . $parameter->name]); continue; } - $typeHint = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\LazyProxy\ProxyHelper::getTypeHint($reflectionMethod, $parameter, \true); + $typeHint = ProxyHelper::getTypeHint($reflectionMethod, $parameter, true); if (!isset($bindings[$typeHint])) { continue; } $arguments[$key] = $this->getBindingValue($bindings[$typeHint]); } if ($arguments !== $call[1]) { - \ksort($arguments); + ksort($arguments); $calls[$i][1] = $arguments; } } if ($constructor) { - list(, $arguments) = \array_pop($calls); + [, $arguments] = array_pop($calls); if ($arguments !== $value->getArguments()) { $value->setArguments($arguments); } @@ -138,10 +146,10 @@ protected function processValue($value, $isRoot = \false) } return parent::processValue($value, $isRoot); } - private function getBindingValue(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\BoundArgument $binding) + private function getBindingValue(BoundArgument $binding) { - list($bindingValue, $bindingId) = $binding->getValues(); - $this->usedBindings[$bindingId] = \true; + [$bindingValue, $bindingId] = $binding->getValues(); + $this->usedBindings[$bindingId] = true; unset($this->unusedBindings[$bindingId]); return $bindingValue; } diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php index 298d25af7..3b4ff16a2 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php @@ -15,6 +15,17 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ExceptionInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; +use ReflectionProperty; +use function array_merge; +use function array_search; +use function array_slice; +use function class_alias; +use function is_numeric; +use function sprintf; +use function strlen; +use function strpos; +use function substr; + /** * This replaces all ChildDefinition instances with their equivalent fully * merged Definition instance. @@ -22,12 +33,12 @@ * @author Johannes M. Schmitt * @author Nicolas Grekas */ -class ResolveChildDefinitionsPass extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass +class ResolveChildDefinitionsPass extends AbstractRecursivePass { private $currentPath; - protected function processValue($value, $isRoot = \false) + protected function processValue($value, $isRoot = false) { - if (!$value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition) { + if (!$value instanceof Definition) { return parent::processValue($value, $isRoot); } if ($isRoot) { @@ -35,7 +46,7 @@ protected function processValue($value, $isRoot = \false) // container to ensure we are not operating on stale data $value = $this->container->getDefinition($this->currentId); } - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition) { + if ($value instanceof ChildDefinition) { $this->currentPath = []; $value = $this->resolveDefinition($value); if ($isRoot) { @@ -51,50 +62,50 @@ protected function processValue($value, $isRoot = \false) * * @throws RuntimeException When the definition is invalid */ - private function resolveDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition $definition) + private function resolveDefinition(ChildDefinition $definition) { try { return $this->doResolveDefinition($definition); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException $e) { + } catch (ServiceCircularReferenceException $e) { throw $e; - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ExceptionInterface $e) { - $r = new \ReflectionProperty($e, 'message'); - $r->setAccessible(\true); - $r->setValue($e, \sprintf('Service "%s": %s', $this->currentId, $e->getMessage())); + } catch (ExceptionInterface $e) { + $r = new ReflectionProperty($e, 'message'); + $r->setAccessible(true); + $r->setValue($e, sprintf('Service "%s": %s', $this->currentId, $e->getMessage())); throw $e; } } - private function doResolveDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition $definition) + private function doResolveDefinition(ChildDefinition $definition) { if (!$this->container->has($parent = $definition->getParent())) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Parent definition "%s" does not exist.', $parent)); + throw new RuntimeException(sprintf('Parent definition "%s" does not exist.', $parent)); } - $searchKey = \array_search($parent, $this->currentPath); + $searchKey = array_search($parent, $this->currentPath); $this->currentPath[] = $parent; - if (\false !== $searchKey) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException($parent, \array_slice($this->currentPath, $searchKey)); + if (false !== $searchKey) { + throw new ServiceCircularReferenceException($parent, array_slice($this->currentPath, $searchKey)); } $parentDef = $this->container->findDefinition($parent); - if ($parentDef instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition) { + if ($parentDef instanceof ChildDefinition) { $id = $this->currentId; $this->currentId = $parent; $parentDef = $this->resolveDefinition($parentDef); $this->container->setDefinition($parent, $parentDef); $this->currentId = $id; } - $this->container->log($this, \sprintf('Resolving inheritance for "%s" (parent: %s).', $this->currentId, $parent)); - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(); + $this->container->log($this, sprintf('Resolving inheritance for "%s" (parent: %s).', $this->currentId, $parent)); + $def = new Definition(); // merge in parent definition // purposely ignored attributes: abstract, shared, tags, autoconfigured $def->setClass($parentDef->getClass()); $def->setArguments($parentDef->getArguments()); $def->setMethodCalls($parentDef->getMethodCalls()); $def->setProperties($parentDef->getProperties()); - if ($parentDef->getAutowiringTypes(\false)) { - $def->setAutowiringTypes($parentDef->getAutowiringTypes(\false)); + if ($parentDef->getAutowiringTypes(false)) { + $def->setAutowiringTypes($parentDef->getAutowiringTypes(false)); } if ($parentDef->isDeprecated()) { - $def->setDeprecated(\true, $parentDef->getDeprecationMessage('%service_id%')); + $def->setDeprecated(true, $parentDef->getDeprecationMessage('%service_id%')); } $def->setFactory($parentDef->getFactory()); $def->setConfigurator($parentDef->getConfigurator()); @@ -145,10 +156,10 @@ private function doResolveDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\ } // merge arguments foreach ($definition->getArguments() as $k => $v) { - if (\is_numeric($k)) { + if (is_numeric($k)) { $def->addArgument($v); - } elseif (0 === \strpos($k, 'index_')) { - $def->replaceArgument((int) \substr($k, \strlen('index_')), $v); + } elseif (0 === strpos($k, 'index_')) { + $def->replaceArgument((int) substr($k, strlen('index_')), $v); } else { $def->setArgument($k, $v); } @@ -159,10 +170,10 @@ private function doResolveDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\ } // append method calls if ($calls = $definition->getMethodCalls()) { - $def->setMethodCalls(\array_merge($def->getMethodCalls(), $calls)); + $def->setMethodCalls(array_merge($def->getMethodCalls(), $calls)); } // merge autowiring types - foreach ($definition->getAutowiringTypes(\false) as $autowiringType) { + foreach ($definition->getAutowiringTypes(false) as $autowiringType) { $def->addAutowiringType($autowiringType); } // these attributes are always taken from the child @@ -174,4 +185,4 @@ private function doResolveDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\ return $def; } } -\class_alias(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveDefinitionTemplatesPass::class); +class_alias(ResolveChildDefinitionsPass::class, ResolveDefinitionTemplatesPass::class); diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveClassPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveClassPass.php index e437ab9b8..46e2867f2 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveClassPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveClassPass.php @@ -13,26 +13,31 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use function class_exists; +use function preg_match; +use function sprintf; +use function strtolower; + /** * @author Nicolas Grekas */ -class ResolveClassPass implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface +class ResolveClassPass implements CompilerPassInterface { private $changes = []; /** * {@inheritdoc} */ - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { foreach ($container->getDefinitions() as $id => $definition) { if ($definition->isSynthetic() || null !== $definition->getClass()) { continue; } - if (\preg_match('/^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+(?:\\\\[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+)++$/', $id)) { - if ($definition instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition && !\class_exists($id)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Service definition "%s" has a parent but no class, and its name looks like a FQCN. Either the class is missing or you want to inherit it from the parent service. To resolve this ambiguity, please rename this service to a non-FQCN (e.g. using dots), or create the missing class.', $id)); + if (preg_match('/^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+(?:\\\\[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+)++$/', $id)) { + if ($definition instanceof ChildDefinition && !class_exists($id)) { + throw new InvalidArgumentException(sprintf('Service definition "%s" has a parent but no class, and its name looks like a FQCN. Either the class is missing or you want to inherit it from the parent service. To resolve this ambiguity, please rename this service to a non-FQCN (e.g. using dots), or create the missing class.', $id)); } - $this->changes[\strtolower($id)] = $id; + $this->changes[strtolower($id)] = $id; $definition->setClass($id); } } diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveDefinitionTemplatesPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveDefinitionTemplatesPass.php index ebdf38d8a..70b989f9f 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveDefinitionTemplatesPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveDefinitionTemplatesPass.php @@ -10,9 +10,13 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler; -@\trigger_error('The ' . __NAMESPACE__ . '\\ResolveDefinitionTemplatesPass class is deprecated since Symfony 3.4 and will be removed in 4.0. Use the ResolveChildDefinitionsPass class instead.', \E_USER_DEPRECATED); -\class_exists(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass::class); -if (\false) { +use function class_exists; +use function trigger_error; +use const E_USER_DEPRECATED; + +@trigger_error('The ' . __NAMESPACE__ . '\\ResolveDefinitionTemplatesPass class is deprecated since Symfony 3.4 and will be removed in 4.0. Use the ResolveChildDefinitionsPass class instead.', E_USER_DEPRECATED); +class_exists(ResolveChildDefinitionsPass::class); +if (false) { /** * This definition decorates another definition. * @@ -20,7 +24,7 @@ * * @deprecated The ResolveDefinitionTemplatesPass class is deprecated since version 3.4 and will be removed in 4.0. Use the ResolveChildDefinitionsPass class instead. */ - class ResolveDefinitionTemplatesPass extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass + class ResolveDefinitionTemplatesPass extends AbstractRecursivePass { } } diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveEnvPlaceholdersPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveEnvPlaceholdersPass.php index c7e39477f..a3333e38f 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveEnvPlaceholdersPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveEnvPlaceholdersPass.php @@ -11,28 +11,33 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; +use function array_combine; +use function array_keys; +use function is_array; +use function is_string; + /** * Replaces env var placeholders by their current values. */ -class ResolveEnvPlaceholdersPass extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass +class ResolveEnvPlaceholdersPass extends AbstractRecursivePass { - protected function processValue($value, $isRoot = \false) + protected function processValue($value, $isRoot = false) { - if (\is_string($value)) { - return $this->container->resolveEnvPlaceholders($value, \true); + if (is_string($value)) { + return $this->container->resolveEnvPlaceholders($value, true); } - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition) { + if ($value instanceof Definition) { $changes = $value->getChanges(); if (isset($changes['class'])) { - $value->setClass($this->container->resolveEnvPlaceholders($value->getClass(), \true)); + $value->setClass($this->container->resolveEnvPlaceholders($value->getClass(), true)); } if (isset($changes['file'])) { - $value->setFile($this->container->resolveEnvPlaceholders($value->getFile(), \true)); + $value->setFile($this->container->resolveEnvPlaceholders($value->getFile(), true)); } } $value = parent::processValue($value, $isRoot); - if ($value && \is_array($value) && !$isRoot) { - $value = \array_combine($this->container->resolveEnvPlaceholders(\array_keys($value), \true), $value); + if ($value && is_array($value) && !$isRoot) { + $value = array_combine($this->container->resolveEnvPlaceholders(array_keys($value), true), $value); } return $value; } diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveFactoryClassPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveFactoryClassPass.php index bca98ab45..18f095169 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveFactoryClassPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveFactoryClassPass.php @@ -12,19 +12,22 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; +use function is_array; +use function sprintf; + /** * @author Maxime Steinhausser */ -class ResolveFactoryClassPass extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass +class ResolveFactoryClassPass extends AbstractRecursivePass { /** * {@inheritdoc} */ - protected function processValue($value, $isRoot = \false) + protected function processValue($value, $isRoot = false) { - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition && \is_array($factory = $value->getFactory()) && null === $factory[0]) { + if ($value instanceof Definition && is_array($factory = $value->getFactory()) && null === $factory[0]) { if (null === ($class = $value->getClass())) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('The "%s" service is defined to be created by a factory, but is missing the factory class. Did you forget to define the factory or service class?', $this->currentId)); + throw new RuntimeException(sprintf('The "%s" service is defined to be created by a factory, but is missing the factory class. Did you forget to define the factory or service class?', $this->currentId)); } $factory[0] = $class; $value->setFactory($factory); diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveHotPathPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveHotPathPass.php index c63046f42..8e2f01c35 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveHotPathPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveHotPathPass.php @@ -19,7 +19,7 @@ * * @author Nicolas Grekas */ -class ResolveHotPathPass extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass +class ResolveHotPathPass extends AbstractRecursivePass { private $tagName; private $resolvedIds = []; @@ -30,7 +30,7 @@ public function __construct($tagName = 'container.hot_path') /** * {@inheritdoc} */ - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { try { parent::process($container); @@ -42,20 +42,20 @@ public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInj /** * {@inheritdoc} */ - protected function processValue($value, $isRoot = \false) + protected function processValue($value, $isRoot = false) { - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ArgumentInterface) { + if ($value instanceof ArgumentInterface) { return $value; } - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition && $isRoot && (isset($this->resolvedIds[$this->currentId]) || !$value->hasTag($this->tagName) || $value->isDeprecated())) { + if ($value instanceof Definition && $isRoot && (isset($this->resolvedIds[$this->currentId]) || !$value->hasTag($this->tagName) || $value->isDeprecated())) { return $value->isDeprecated() ? $value->clearTag($this->tagName) : $value; } - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference && \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder::IGNORE_ON_UNINITIALIZED_REFERENCE !== $value->getInvalidBehavior() && $this->container->has($id = $this->container->normalizeId($value))) { + if ($value instanceof Reference && ContainerBuilder::IGNORE_ON_UNINITIALIZED_REFERENCE !== $value->getInvalidBehavior() && $this->container->has($id = $this->container->normalizeId($value))) { $definition = $this->container->findDefinition($id); if (!$definition->hasTag($this->tagName) && !$definition->isDeprecated()) { - $this->resolvedIds[$id] = \true; + $this->resolvedIds[$id] = true; $definition->addTag($this->tagName); - parent::processValue($definition, \false); + parent::processValue($definition, false); } return $value; } diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveInstanceofConditionalsPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveInstanceofConditionalsPass.php index 712672630..8911a379a 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveInstanceofConditionalsPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveInstanceofConditionalsPass.php @@ -15,35 +15,44 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; +use function array_map; +use function count; +use function in_array; +use function is_subclass_of; +use function serialize; +use function sprintf; +use function substr_replace; +use function unserialize; + /** * Applies instanceof conditionals to definitions. * * @author Nicolas Grekas */ -class ResolveInstanceofConditionalsPass implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface +class ResolveInstanceofConditionalsPass implements CompilerPassInterface { /** * {@inheritdoc} */ - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { foreach ($container->getAutoconfiguredInstanceof() as $interface => $definition) { if ($definition->getArguments()) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Autoconfigured instanceof for type "%s" defines arguments but these are not supported and should be removed.', $interface)); + throw new InvalidArgumentException(sprintf('Autoconfigured instanceof for type "%s" defines arguments but these are not supported and should be removed.', $interface)); } if ($definition->getMethodCalls()) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Autoconfigured instanceof for type "%s" defines method calls but these are not supported and should be removed.', $interface)); + throw new InvalidArgumentException(sprintf('Autoconfigured instanceof for type "%s" defines method calls but these are not supported and should be removed.', $interface)); } } foreach ($container->getDefinitions() as $id => $definition) { - if ($definition instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition) { + if ($definition instanceof ChildDefinition) { // don't apply "instanceof" to children: it will be applied to their parent continue; } $container->setDefinition($id, $this->processDefinition($container, $id, $definition)); } } - private function processDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container, $id, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition) + private function processDefinition(ContainerBuilder $container, $id, Definition $definition) { $instanceofConditionals = $definition->getInstanceofConditionals(); $autoconfiguredInstanceof = $definition->isAutoconfigured() ? $container->getAutoconfiguredInstanceof() : []; @@ -59,16 +68,16 @@ private function processDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\De $instanceofTags = []; $reflectionClass = null; foreach ($conditionals as $interface => $instanceofDefs) { - if ($interface !== $class && !(null === $reflectionClass ? $reflectionClass = $container->getReflectionClass($class, \false) ?: \false : $reflectionClass)) { + if ($interface !== $class && !(null === $reflectionClass ? $reflectionClass = $container->getReflectionClass($class, false) ?: false : $reflectionClass)) { continue; } - if ($interface !== $class && !\is_subclass_of($class, $interface)) { + if ($interface !== $class && !is_subclass_of($class, $interface)) { continue; } foreach ($instanceofDefs as $key => $instanceofDef) { /** @var ChildDefinition $instanceofDef */ $instanceofDef = clone $instanceofDef; - $instanceofDef->setAbstract(\true)->setParent($parent ?: 'abstract.instanceof.' . $id); + $instanceofDef->setAbstract(true)->setParent($parent ?: 'abstract.instanceof.' . $id); $parent = 'instanceof.' . $interface . '.' . $key . '.' . $id; $container->setDefinition($parent, $instanceofDef); $instanceofTags[] = $instanceofDef->getTags(); @@ -83,19 +92,19 @@ private function processDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\De $abstract = $container->setDefinition('abstract.instanceof.' . $id, $definition); // cast Definition to ChildDefinition $definition->setBindings([]); - $definition = \serialize($definition); - $definition = \substr_replace($definition, '53', 2, 2); - $definition = \substr_replace($definition, 'Child', 44, 0); - $definition = \unserialize($definition); + $definition = serialize($definition); + $definition = substr_replace($definition, '53', 2, 2); + $definition = substr_replace($definition, 'Child', 44, 0); + $definition = unserialize($definition); $definition->setParent($parent); if (null !== $shared && !isset($definition->getChanges()['shared'])) { $definition->setShared($shared); } - $i = \count($instanceofTags); + $i = count($instanceofTags); while (0 <= --$i) { foreach ($instanceofTags[$i] as $k => $v) { foreach ($v as $v) { - if ($definition->hasTag($k) && \in_array($v, $definition->getTag($k))) { + if ($definition->hasTag($k) && in_array($v, $definition->getTag($k))) { continue; } $definition->addTag($k, $v); @@ -104,20 +113,20 @@ private function processDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\De } $definition->setBindings($bindings); // reset fields with "merge" behavior - $abstract->setBindings([])->setArguments([])->setMethodCalls([])->setDecoratedService(null)->setTags([])->setAbstract(\true); + $abstract->setBindings([])->setArguments([])->setMethodCalls([])->setDecoratedService(null)->setTags([])->setAbstract(true); } return $definition; } - private function mergeConditionals(array $autoconfiguredInstanceof, array $instanceofConditionals, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + private function mergeConditionals(array $autoconfiguredInstanceof, array $instanceofConditionals, ContainerBuilder $container) { // make each value an array of ChildDefinition - $conditionals = \array_map(function ($childDef) { + $conditionals = array_map(function ($childDef) { return [$childDef]; }, $autoconfiguredInstanceof); foreach ($instanceofConditionals as $interface => $instanceofDef) { // make sure the interface/class exists (but don't validate automaticInstanceofConditionals) if (!$container->getReflectionClass($interface)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('"%s" is set as an "instanceof" conditional, but it does not exist.', $interface)); + throw new RuntimeException(sprintf('"%s" is set as an "instanceof" conditional, but it does not exist.', $interface)); } if (!isset($autoconfiguredInstanceof[$interface])) { $conditionals[$interface] = []; diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveInvalidReferencesPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveInvalidReferencesPass.php index 28167e166..794740dcc 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveInvalidReferencesPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveInvalidReferencesPass.php @@ -17,23 +17,26 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; +use function array_values; +use function is_array; + /** * Emulates the invalid behavior if the reference is not found within the * container. * * @author Johannes M. Schmitt */ -class ResolveInvalidReferencesPass implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface +class ResolveInvalidReferencesPass implements CompilerPassInterface { private $container; private $signalingException; /** * Process the ContainerBuilder to resolve invalid references. */ - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { $this->container = $container; - $this->signalingException = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException('Invalid reference.'); + $this->signalingException = new RuntimeException('Invalid reference.'); try { $this->processValue($container->getDefinitions(), 1); } finally { @@ -47,28 +50,28 @@ public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInj */ private function processValue($value, $rootLevel = 0, $level = 0) { - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument) { + if ($value instanceof ServiceClosureArgument) { $value->setValues($this->processValue($value->getValues(), 1, 1)); - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ArgumentInterface) { + } elseif ($value instanceof ArgumentInterface) { $value->setValues($this->processValue($value->getValues(), $rootLevel, 1 + $level)); - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition) { + } elseif ($value instanceof Definition) { if ($value->isSynthetic() || $value->isAbstract()) { return $value; } $value->setArguments($this->processValue($value->getArguments(), 0)); $value->setProperties($this->processValue($value->getProperties(), 1)); $value->setMethodCalls($this->processValue($value->getMethodCalls(), 2)); - } elseif (\is_array($value)) { + } elseif (is_array($value)) { $i = 0; foreach ($value as $k => $v) { try { - if (\false !== $i && $k !== $i++) { - $i = \false; + if (false !== $i && $k !== $i++) { + $i = false; } if ($v !== ($processedValue = $this->processValue($v, $rootLevel, 1 + $level))) { $value[$k] = $processedValue; } - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException $e) { + } catch (RuntimeException $e) { if ($rootLevel < $level || $rootLevel && !$level) { unset($value[$k]); } elseif ($rootLevel) { @@ -79,18 +82,18 @@ private function processValue($value, $rootLevel = 0, $level = 0) } } // Ensure numerically indexed arguments have sequential numeric keys. - if (\false !== $i) { - $value = \array_values($value); + if (false !== $i) { + $value = array_values($value); } - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference) { + } elseif ($value instanceof Reference) { if ($this->container->has($value)) { return $value; } $invalidBehavior = $value->getInvalidBehavior(); // resolve invalid behavior - if (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::NULL_ON_INVALID_REFERENCE === $invalidBehavior) { + if (ContainerInterface::NULL_ON_INVALID_REFERENCE === $invalidBehavior) { $value = null; - } elseif (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE === $invalidBehavior) { + } elseif (ContainerInterface::IGNORE_ON_INVALID_REFERENCE === $invalidBehavior) { if (0 < $level || $rootLevel) { throw $this->signalingException; } diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveNamedArgumentsPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveNamedArgumentsPass.php index 3dc0f3503..065079f0b 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveNamedArgumentsPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveNamedArgumentsPass.php @@ -14,35 +14,43 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\LazyProxy\ProxyHelper; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; +use ReflectionMethod; +use function array_key_exists; +use function array_pop; +use function gettype; +use function is_int; +use function ksort; +use function sprintf; + /** * Resolves named arguments to their corresponding numeric index. * * @author Kévin Dunglas */ -class ResolveNamedArgumentsPass extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass +class ResolveNamedArgumentsPass extends AbstractRecursivePass { /** * {@inheritdoc} */ - protected function processValue($value, $isRoot = \false) + protected function processValue($value, $isRoot = false) { - if (!$value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition) { + if (!$value instanceof Definition) { return parent::processValue($value, $isRoot); } $calls = $value->getMethodCalls(); $calls[] = ['__construct', $value->getArguments()]; foreach ($calls as $i => $call) { - list($method, $arguments) = $call; + [$method, $arguments] = $call; $parameters = null; $resolvedArguments = []; foreach ($arguments as $key => $argument) { - if (\is_int($key)) { + if (is_int($key)) { $resolvedArguments[$key] = $argument; continue; } if (null === $parameters) { $r = $this->getReflectionMethod($value, $method); - $class = $r instanceof \ReflectionMethod ? $r->class : $this->currentId; + $class = $r instanceof ReflectionMethod ? $r->class : $this->currentId; $method = $r->getName(); $parameters = $r->getParameters(); } @@ -53,28 +61,28 @@ protected function processValue($value, $isRoot = \false) continue 2; } } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Invalid service "%s": method "%s()" has no argument named "%s". Check your service definition.', $this->currentId, $class !== $this->currentId ? $class . '::' . $method : $method, $key)); + throw new InvalidArgumentException(sprintf('Invalid service "%s": method "%s()" has no argument named "%s". Check your service definition.', $this->currentId, $class !== $this->currentId ? $class . '::' . $method : $method, $key)); } - if (null !== $argument && !$argument instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference && !$argument instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Invalid service "%s": the value of argument "%s" of method "%s()" must be null, an instance of "%s" or an instance of "%s", "%s" given.', $this->currentId, $key, $class !== $this->currentId ? $class . '::' . $method : $method, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition::class, \gettype($argument))); + if (null !== $argument && !$argument instanceof Reference && !$argument instanceof Definition) { + throw new InvalidArgumentException(sprintf('Invalid service "%s": the value of argument "%s" of method "%s()" must be null, an instance of "%s" or an instance of "%s", "%s" given.', $this->currentId, $key, $class !== $this->currentId ? $class . '::' . $method : $method, Reference::class, Definition::class, gettype($argument))); } - $typeFound = \false; + $typeFound = false; foreach ($parameters as $j => $p) { - if (!\array_key_exists($j, $resolvedArguments) && \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\LazyProxy\ProxyHelper::getTypeHint($r, $p, \true) === $key) { + if (!array_key_exists($j, $resolvedArguments) && ProxyHelper::getTypeHint($r, $p, true) === $key) { $resolvedArguments[$j] = $argument; - $typeFound = \true; + $typeFound = true; } } if (!$typeFound) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Invalid service "%s": method "%s()" has no argument type-hinted as "%s". Check your service definition.', $this->currentId, $class !== $this->currentId ? $class . '::' . $method : $method, $key)); + throw new InvalidArgumentException(sprintf('Invalid service "%s": method "%s()" has no argument type-hinted as "%s". Check your service definition.', $this->currentId, $class !== $this->currentId ? $class . '::' . $method : $method, $key)); } } if ($resolvedArguments !== $call[1]) { - \ksort($resolvedArguments); + ksort($resolvedArguments); $calls[$i][1] = $resolvedArguments; } } - list(, $arguments) = \array_pop($calls); + [, $arguments] = array_pop($calls); if ($arguments !== $value->getArguments()) { $value->setArguments($arguments); } diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveParameterPlaceHoldersPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveParameterPlaceHoldersPass.php index 17fb2620b..8f1f4d21c 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveParameterPlaceHoldersPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveParameterPlaceHoldersPass.php @@ -13,17 +13,22 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; +use function array_combine; +use function array_keys; +use function is_array; +use function is_string; + /** * Resolves all parameter placeholders "%somevalue%" to their real values. * * @author Johannes M. Schmitt */ -class ResolveParameterPlaceHoldersPass extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass +class ResolveParameterPlaceHoldersPass extends AbstractRecursivePass { private $bag; private $resolveArrays; private $throwOnResolveException; - public function __construct($resolveArrays = \true, $throwOnResolveException = \true) + public function __construct($resolveArrays = true, $throwOnResolveException = true) { $this->resolveArrays = $resolveArrays; $this->throwOnResolveException = $throwOnResolveException; @@ -33,7 +38,7 @@ public function __construct($resolveArrays = \true, $throwOnResolveException = \ * * @throws ParameterNotFoundException */ - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { $this->bag = $container->getParameterBag(); try { @@ -44,28 +49,28 @@ public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInj $aliases[$this->bag->resolveValue($name)] = $target; } $container->setAliases($aliases); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException $e) { + } catch (ParameterNotFoundException $e) { $e->setSourceId($this->currentId); throw $e; } $this->bag->resolve(); $this->bag = null; } - protected function processValue($value, $isRoot = \false) + protected function processValue($value, $isRoot = false) { - if (\is_string($value)) { + if (is_string($value)) { try { $v = $this->bag->resolveValue($value); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException $e) { + } catch (ParameterNotFoundException $e) { if ($this->throwOnResolveException) { throw $e; } $v = null; $this->container->getDefinition($this->currentId)->addError($e->getMessage()); } - return $this->resolveArrays || !$v || !\is_array($v) ? $v : $value; + return $this->resolveArrays || !$v || !is_array($v) ? $v : $value; } - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition) { + if ($value instanceof Definition) { $value->setBindings($this->processValue($value->getBindings())); $changes = $value->getChanges(); if (isset($changes['class'])) { @@ -76,8 +81,8 @@ protected function processValue($value, $isRoot = \false) } } $value = parent::processValue($value, $isRoot); - if ($value && \is_array($value)) { - $value = \array_combine($this->bag->resolveValue(\array_keys($value)), $value); + if ($value && is_array($value)) { + $value = array_combine($this->bag->resolveValue(array_keys($value)), $value); } return $value; } diff --git a/vendor/symfony/dependency-injection/Compiler/ResolvePrivatesPass.php b/vendor/symfony/dependency-injection/Compiler/ResolvePrivatesPass.php index dd87a2811..cf86af7c5 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolvePrivatesPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolvePrivatesPass.php @@ -14,23 +14,23 @@ /** * @author Nicolas Grekas */ -class ResolvePrivatesPass implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface +class ResolvePrivatesPass implements CompilerPassInterface { /** * {@inheritdoc} */ - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { foreach ($container->getDefinitions() as $id => $definition) { if ($definition->isPrivate()) { - $definition->setPublic(\false); - $definition->setPrivate(\true); + $definition->setPublic(false); + $definition->setPrivate(true); } } foreach ($container->getAliases() as $id => $alias) { if ($alias->isPrivate()) { - $alias->setPublic(\false); - $alias->setPrivate(\true); + $alias->setPublic(false); + $alias->setPrivate(true); } } } diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveReferencesToAliasesPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveReferencesToAliasesPass.php index 4b7faed6d..39c2f6c07 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveReferencesToAliasesPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveReferencesToAliasesPass.php @@ -13,17 +13,20 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; +use function array_keys; +use function array_merge; + /** * Replaces all references to aliases with references to the actual service. * * @author Johannes M. Schmitt */ -class ResolveReferencesToAliasesPass extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass +class ResolveReferencesToAliasesPass extends AbstractRecursivePass { /** * {@inheritdoc} */ - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { parent::process($container); foreach ($container->getAliases() as $id => $alias) { @@ -36,12 +39,12 @@ public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInj /** * {@inheritdoc} */ - protected function processValue($value, $isRoot = \false) + protected function processValue($value, $isRoot = false) { - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference) { + if ($value instanceof Reference) { $defId = $this->getDefinitionId($id = $this->container->normalizeId($value), $this->container); if ($defId !== $id) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference($defId, $value->getInvalidBehavior()); + return new Reference($defId, $value->getInvalidBehavior()); } } return parent::processValue($value); @@ -53,14 +56,14 @@ protected function processValue($value, $isRoot = \false) * * @return string The definition id with aliases resolved */ - private function getDefinitionId($id, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + private function getDefinitionId($id, ContainerBuilder $container) { $seen = []; while ($container->hasAlias($id)) { if (isset($seen[$id])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException($id, \array_merge(\array_keys($seen), [$id])); + throw new ServiceCircularReferenceException($id, array_merge(array_keys($seen), [$id])); } - $seen[$id] = \true; + $seen[$id] = true; $id = $container->normalizeId($container->getAlias($id)); } return $id; diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveServiceSubscribersPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveServiceSubscribersPass.php index ded28fc2d..475eb4cb8 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveServiceSubscribersPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveServiceSubscribersPass.php @@ -18,15 +18,15 @@ * * @author Nicolas Grekas */ -class ResolveServiceSubscribersPass extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass +class ResolveServiceSubscribersPass extends AbstractRecursivePass { private $serviceLocator; - protected function processValue($value, $isRoot = \false) + protected function processValue($value, $isRoot = false) { - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference && $this->serviceLocator && \_PhpScoper5ea00cc67502b\Psr\Container\ContainerInterface::class === $this->container->normalizeId($value)) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference($this->serviceLocator); + if ($value instanceof Reference && $this->serviceLocator && ContainerInterface::class === $this->container->normalizeId($value)) { + return new Reference($this->serviceLocator); } - if (!$value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition) { + if (!$value instanceof Definition) { return parent::processValue($value, $isRoot); } $serviceLocator = $this->serviceLocator; diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveTaggedIteratorArgumentPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveTaggedIteratorArgumentPass.php index 69338cf0a..ce5f058cb 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveTaggedIteratorArgumentPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveTaggedIteratorArgumentPass.php @@ -16,15 +16,15 @@ * * @author Roland Franssen */ -class ResolveTaggedIteratorArgumentPass extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass +class ResolveTaggedIteratorArgumentPass extends AbstractRecursivePass { use PriorityTaggedServiceTrait; /** * {@inheritdoc} */ - protected function processValue($value, $isRoot = \false) + protected function processValue($value, $isRoot = false) { - if (!$value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument) { + if (!$value instanceof TaggedIteratorArgument) { return parent::processValue($value, $isRoot); } $value->setValues($this->findAndSortTaggedServices($value->getTag(), $this->container)); diff --git a/vendor/symfony/dependency-injection/Compiler/ServiceLocatorTagPass.php b/vendor/symfony/dependency-injection/Compiler/ServiceLocatorTagPass.php index f680e4d28..2bfe34d7a 100644 --- a/vendor/symfony/dependency-injection/Compiler/ServiceLocatorTagPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ServiceLocatorTagPass.php @@ -17,53 +17,61 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator; +use function get_class; +use function gettype; +use function is_array; +use function is_int; +use function is_object; +use function ksort; +use function sprintf; + /** * Applies the "container.service_locator" tag by wrapping references into ServiceClosureArgument instances. * * @author Nicolas Grekas */ -final class ServiceLocatorTagPass extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass +final class ServiceLocatorTagPass extends AbstractRecursivePass { - protected function processValue($value, $isRoot = \false) + protected function processValue($value, $isRoot = false) { - if (!$value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition || !$value->hasTag('container.service_locator')) { + if (!$value instanceof Definition || !$value->hasTag('container.service_locator')) { return parent::processValue($value, $isRoot); } if (!$value->getClass()) { - $value->setClass(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator::class); + $value->setClass(ServiceLocator::class); } $arguments = $value->getArguments(); - if (!isset($arguments[0]) || !\is_array($arguments[0])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Invalid definition for service "%s": an array of references is expected as first argument when the "container.service_locator" tag is set.', $this->currentId)); + if (!isset($arguments[0]) || !is_array($arguments[0])) { + throw new InvalidArgumentException(sprintf('Invalid definition for service "%s": an array of references is expected as first argument when the "container.service_locator" tag is set.', $this->currentId)); } $i = 0; foreach ($arguments[0] as $k => $v) { - if ($v instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument) { + if ($v instanceof ServiceClosureArgument) { continue; } - if (!$v instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Invalid definition for service "%s": an array of references is expected as first argument when the "container.service_locator" tag is set, "%s" found for key "%s".', $this->currentId, \is_object($v) ? \get_class($v) : \gettype($v), $k)); + if (!$v instanceof Reference) { + throw new InvalidArgumentException(sprintf('Invalid definition for service "%s": an array of references is expected as first argument when the "container.service_locator" tag is set, "%s" found for key "%s".', $this->currentId, is_object($v) ? get_class($v) : gettype($v), $k)); } if ($i === $k) { unset($arguments[0][$k]); $k = (string) $v; ++$i; - } elseif (\is_int($k)) { + } elseif (is_int($k)) { $i = null; } - $arguments[0][$k] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument($v); + $arguments[0][$k] = new ServiceClosureArgument($v); } - \ksort($arguments[0]); + ksort($arguments[0]); $value->setArguments($arguments); - $id = 'service_locator.' . \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder::hash($value); + $id = 'service_locator.' . ContainerBuilder::hash($value); if ($isRoot) { if ($id !== $this->currentId) { - $this->container->setAlias($id, new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Alias($this->currentId, \false)); + $this->container->setAlias($id, new Alias($this->currentId, false)); } return $value; } - $this->container->setDefinition($id, $value->setPublic(\false)); - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference($id); + $this->container->setDefinition($id, $value->setPublic(false)); + return new Reference($id); } /** * @param Reference[] $refMap @@ -71,20 +79,20 @@ protected function processValue($value, $isRoot = \false) * * @return Reference */ - public static function register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container, array $refMap, $callerId = null) + public static function register(ContainerBuilder $container, array $refMap, $callerId = null) { foreach ($refMap as $id => $ref) { - if (!$ref instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Invalid service locator definition: only services can be referenced, "%s" found for key "%s". Inject parameter values using constructors instead.', \is_object($ref) ? \get_class($ref) : \gettype($ref), $id)); + if (!$ref instanceof Reference) { + throw new InvalidArgumentException(sprintf('Invalid service locator definition: only services can be referenced, "%s" found for key "%s". Inject parameter values using constructors instead.', is_object($ref) ? get_class($ref) : gettype($ref), $id)); } - $refMap[$id] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument($ref); + $refMap[$id] = new ServiceClosureArgument($ref); } - \ksort($refMap); - $locator = (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator::class))->addArgument($refMap)->setPublic(\false)->addTag('container.service_locator'); + ksort($refMap); + $locator = (new Definition(ServiceLocator::class))->addArgument($refMap)->setPublic(false)->addTag('container.service_locator'); if (null !== $callerId && $container->hasDefinition($callerId)) { $locator->setBindings($container->getDefinition($callerId)->getBindings()); } - if (!$container->hasDefinition($id = 'service_locator.' . \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder::hash($locator))) { + if (!$container->hasDefinition($id = 'service_locator.' . ContainerBuilder::hash($locator))) { $container->setDefinition($id, $locator); } if (null !== $callerId) { @@ -92,8 +100,8 @@ public static function register(\_PhpScoper5ea00cc67502b\Symfony\Component\Depen // Locators are shared when they hold the exact same list of factories; // to have them specialized per consumer service, we use a cloning factory // to derivate customized instances from the prototype one. - $container->register($id .= '.' . $callerId, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator::class)->setPublic(\false)->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference($locatorId), 'withContext'])->addArgument($callerId)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('service_container')); + $container->register($id .= '.' . $callerId, ServiceLocator::class)->setPublic(false)->setFactory([new Reference($locatorId), 'withContext'])->addArgument($callerId)->addArgument(new Reference('service_container')); } - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference($id); + return new Reference($id); } } diff --git a/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraph.php b/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraph.php index af7515faa..f93b3a739 100644 --- a/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraph.php +++ b/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraph.php @@ -11,6 +11,10 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use function func_get_arg; +use function func_num_args; +use function sprintf; + /** * This is a directed graph of your services. * @@ -50,7 +54,7 @@ public function hasNode($id) public function getNode($id) { if (!isset($this->nodes[$id])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('There is no node with id "%s".', $id)); + throw new InvalidArgumentException(sprintf('There is no node with id "%s".', $id)); } return $this->nodes[$id]; } @@ -84,15 +88,15 @@ public function clear() */ public function connect($sourceId, $sourceValue, $destId, $destValue = null, $reference = null) { - $lazy = \func_num_args() >= 6 ? \func_get_arg(5) : \false; - $weak = \func_num_args() >= 7 ? \func_get_arg(6) : \false; - $byConstructor = \func_num_args() >= 8 ? \func_get_arg(7) : \false; + $lazy = func_num_args() >= 6 ? func_get_arg(5) : false; + $weak = func_num_args() >= 7 ? func_get_arg(6) : false; + $byConstructor = func_num_args() >= 8 ? func_get_arg(7) : false; if (null === $sourceId || null === $destId) { return; } $sourceNode = $this->createNode($sourceId, $sourceValue); $destNode = $this->createNode($destId, $destValue); - $edge = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraphEdge($sourceNode, $destNode, $reference, $lazy, $weak, $byConstructor); + $edge = new ServiceReferenceGraphEdge($sourceNode, $destNode, $reference, $lazy, $weak, $byConstructor); $sourceNode->addOutEdge($edge); $destNode->addInEdge($edge); } @@ -109,6 +113,6 @@ private function createNode($id, $value) if (isset($this->nodes[$id]) && $this->nodes[$id]->getValue() === $value) { return $this->nodes[$id]; } - return $this->nodes[$id] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraphNode($id, $value); + return $this->nodes[$id] = new ServiceReferenceGraphNode($id, $value); } } diff --git a/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphEdge.php b/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphEdge.php index 0993c236d..11dea26b0 100644 --- a/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphEdge.php +++ b/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphEdge.php @@ -31,7 +31,7 @@ class ServiceReferenceGraphEdge * @param bool $weak * @param bool $byConstructor */ - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraphNode $sourceNode, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraphNode $destNode, $value = null, $lazy = \false, $weak = \false, $byConstructor = \false) + public function __construct(ServiceReferenceGraphNode $sourceNode, ServiceReferenceGraphNode $destNode, $value = null, $lazy = false, $weak = false, $byConstructor = false) { $this->sourceNode = $sourceNode; $this->destNode = $destNode; diff --git a/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphNode.php b/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphNode.php index 9573eeccc..6e70fd0d8 100644 --- a/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphNode.php +++ b/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphNode.php @@ -34,11 +34,11 @@ public function __construct($id, $value) $this->id = $id; $this->value = $value; } - public function addInEdge(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraphEdge $edge) + public function addInEdge(ServiceReferenceGraphEdge $edge) { $this->inEdges[] = $edge; } - public function addOutEdge(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraphEdge $edge) + public function addOutEdge(ServiceReferenceGraphEdge $edge) { $this->outEdges[] = $edge; } @@ -49,7 +49,7 @@ public function addOutEdge(\_PhpScoper5ea00cc67502b\Symfony\Component\Dependency */ public function isAlias() { - return $this->value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Alias; + return $this->value instanceof Alias; } /** * Checks if the value of this node is a Definition. @@ -58,7 +58,7 @@ public function isAlias() */ public function isDefinition() { - return $this->value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; + return $this->value instanceof Definition; } /** * Returns the identifier. diff --git a/vendor/symfony/dependency-injection/Compiler/index.php b/vendor/symfony/dependency-injection/Compiler/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Compiler/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Config/AutowireServiceResource.php b/vendor/symfony/dependency-injection/Config/AutowireServiceResource.php index 92ded018b..c89645779 100644 --- a/vendor/symfony/dependency-injection/Config/AutowireServiceResource.php +++ b/vendor/symfony/dependency-injection/Config/AutowireServiceResource.php @@ -10,13 +10,24 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Config; -@\trigger_error('The ' . __NAMESPACE__ . '\\AutowireServiceResource class is deprecated since Symfony 3.3 and will be removed in 4.0. Use ContainerBuilder::getReflectionClass() instead.', \E_USER_DEPRECATED); +@trigger_error('The ' . __NAMESPACE__ . '\\AutowireServiceResource class is deprecated since Symfony 3.3 and will be removed in 4.0. Use ContainerBuilder::getReflectionClass() instead.', E_USER_DEPRECATED); use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\SelfCheckingResourceInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass; +use ReflectionClass; +use ReflectionException; +use Serializable; +use function file_exists; +use function filemtime; +use function serialize; +use function trigger_error; +use function unserialize; +use const E_USER_DEPRECATED; +use const PHP_VERSION_ID; + /** * @deprecated since version 3.3, to be removed in 4.0. Use ContainerBuilder::getReflectionClass() instead. */ -class AutowireServiceResource implements \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\SelfCheckingResourceInterface, \Serializable +class AutowireServiceResource implements SelfCheckingResourceInterface, Serializable { private $class; private $filePath; @@ -29,20 +40,20 @@ public function __construct($class, $path, array $autowiringMetadata) } public function isFresh($timestamp) { - if (!\file_exists($this->filePath)) { - return \false; + if (!file_exists($this->filePath)) { + return false; } // has the file *not* been modified? Definitely fresh - if (@\filemtime($this->filePath) <= $timestamp) { - return \true; + if (@filemtime($this->filePath) <= $timestamp) { + return true; } try { - $reflectionClass = new \ReflectionClass($this->class); - } catch (\ReflectionException $e) { + $reflectionClass = new ReflectionClass($this->class); + } catch (ReflectionException $e) { // the class does not exist anymore! - return \false; + return false; } - return (array) $this === (array) \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass::createResourceForClass($reflectionClass); + return (array) $this === (array) AutowirePass::createResourceForClass($reflectionClass); } public function __toString() { @@ -53,17 +64,17 @@ public function __toString() */ public function serialize() { - return \serialize([$this->class, $this->filePath, $this->autowiringMetadata]); + return serialize([$this->class, $this->filePath, $this->autowiringMetadata]); } /** * @internal */ public function unserialize($serialized) { - if (\PHP_VERSION_ID >= 70000) { - list($this->class, $this->filePath, $this->autowiringMetadata) = \unserialize($serialized, ['allowed_classes' => \false]); + if (PHP_VERSION_ID >= 70000) { + [$this->class, $this->filePath, $this->autowiringMetadata] = unserialize($serialized, ['allowed_classes' => false]); } else { - list($this->class, $this->filePath, $this->autowiringMetadata) = \unserialize($serialized); + [$this->class, $this->filePath, $this->autowiringMetadata] = unserialize($serialized); } } /** diff --git a/vendor/symfony/dependency-injection/Config/ContainerParametersResource.php b/vendor/symfony/dependency-injection/Config/ContainerParametersResource.php index 27c35109a..01629dc53 100644 --- a/vendor/symfony/dependency-injection/Config/ContainerParametersResource.php +++ b/vendor/symfony/dependency-injection/Config/ContainerParametersResource.php @@ -11,12 +11,17 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Config; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ResourceInterface; +use Serializable; +use function md5; +use function serialize; +use function unserialize; + /** * Tracks container parameters. * * @author Maxime Steinhausser */ -class ContainerParametersResource implements \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ResourceInterface, \Serializable +class ContainerParametersResource implements ResourceInterface, Serializable { private $parameters; /** @@ -31,21 +36,21 @@ public function __construct(array $parameters) */ public function __toString() { - return 'container_parameters_' . \md5(\serialize($this->parameters)); + return 'container_parameters_' . md5(serialize($this->parameters)); } /** * @internal */ public function serialize() { - return \serialize($this->parameters); + return serialize($this->parameters); } /** * @internal */ public function unserialize($serialized) { - $this->parameters = \unserialize($serialized); + $this->parameters = unserialize($serialized); } /** * @return array Tracked parameters diff --git a/vendor/symfony/dependency-injection/Config/ContainerParametersResourceChecker.php b/vendor/symfony/dependency-injection/Config/ContainerParametersResourceChecker.php index c4bbf5138..b4636c388 100644 --- a/vendor/symfony/dependency-injection/Config/ContainerParametersResourceChecker.php +++ b/vendor/symfony/dependency-injection/Config/ContainerParametersResourceChecker.php @@ -16,31 +16,31 @@ /** * @author Maxime Steinhausser */ -class ContainerParametersResourceChecker implements \_PhpScoper5ea00cc67502b\Symfony\Component\Config\ResourceCheckerInterface +class ContainerParametersResourceChecker implements ResourceCheckerInterface { /** @var ContainerInterface */ private $container; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface $container) + public function __construct(ContainerInterface $container) { $this->container = $container; } /** * {@inheritdoc} */ - public function supports(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ResourceInterface $metadata) + public function supports(ResourceInterface $metadata) { - return $metadata instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Config\ContainerParametersResource; + return $metadata instanceof ContainerParametersResource; } /** * {@inheritdoc} */ - public function isFresh(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ResourceInterface $resource, $timestamp) + public function isFresh(ResourceInterface $resource, $timestamp) { foreach ($resource->getParameters() as $key => $value) { if (!$this->container->hasParameter($key) || $this->container->getParameter($key) !== $value) { - return \false; + return false; } } - return \true; + return true; } } diff --git a/vendor/symfony/dependency-injection/Config/index.php b/vendor/symfony/dependency-injection/Config/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Config/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Container.php b/vendor/symfony/dependency-injection/Container.php index a734beb93..1dbd58ef4 100644 --- a/vendor/symfony/dependency-injection/Container.php +++ b/vendor/symfony/dependency-injection/Container.php @@ -18,6 +18,31 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; +use Closure; +use Exception; +use ReflectionMethod; +use function array_key_exists; +use function array_keys; +use function array_map; +use function array_merge; +use function array_unique; +use function get_class_methods; +use function is_string; +use function levenshtein; +use function method_exists; +use function preg_match; +use function preg_replace; +use function sprintf; +use function str_replace; +use function strlen; +use function strpos; +use function strtolower; +use function strtr; +use function substr; +use function trigger_error; +use function ucwords; +use const E_USER_DEPRECATED; + /** * Container is a dependency injection container. * @@ -35,7 +60,7 @@ * @author Fabien Potencier * @author Johannes M. Schmitt */ -class Container implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ResettableContainerInterface +class Container implements ResettableContainerInterface { protected $parameterBag; protected $services = []; @@ -55,11 +80,11 @@ class Container implements \_PhpScoper5ea00cc67502b\Symfony\Component\Dependency protected $normalizedIds = []; private $underscoreMap = ['_' => '', '.' => '_', '\\' => '_']; private $envCache = []; - private $compiled = \false; + private $compiled = false; private $getEnv; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface $parameterBag = null) + public function __construct(ParameterBagInterface $parameterBag = null) { - $this->parameterBag = $parameterBag ?: new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag(); + $this->parameterBag = $parameterBag ?: new EnvPlaceholderParameterBag(); } /** * Compiles the container. @@ -72,8 +97,8 @@ public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\Dependenc public function compile() { $this->parameterBag->resolve(); - $this->parameterBag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag($this->parameterBag->all()); - $this->compiled = \true; + $this->parameterBag = new FrozenParameterBag($this->parameterBag->all()); + $this->compiled = true; } /** * Returns true if the container is compiled. @@ -93,8 +118,8 @@ public function isCompiled() */ public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return $this->parameterBag instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return $this->parameterBag instanceof FrozenParameterBag; } /** * Gets the service container parameter bag. @@ -151,29 +176,29 @@ public function setParameter($name, $value) public function set($id, $service) { // Runs the internal initializer; used by the dumped container to include always-needed files - if (isset($this->privates['service_container']) && $this->privates['service_container'] instanceof \Closure) { + if (isset($this->privates['service_container']) && $this->privates['service_container'] instanceof Closure) { $initialize = $this->privates['service_container']; unset($this->privates['service_container']); $initialize(); } $id = $this->normalizeId($id); if ('service_container' === $id) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException('You cannot set service "service_container".'); + throw new InvalidArgumentException('You cannot set service "service_container".'); } if (isset($this->privates[$id]) || !(isset($this->fileMap[$id]) || isset($this->methodMap[$id]))) { if (!isset($this->privates[$id]) && !isset($this->getRemovedIds()[$id])) { // no-op } elseif (null === $service) { - @\trigger_error(\sprintf('The "%s" service is private, unsetting it is deprecated since Symfony 3.2 and will fail in 4.0.', $id), \E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s" service is private, unsetting it is deprecated since Symfony 3.2 and will fail in 4.0.', $id), E_USER_DEPRECATED); unset($this->privates[$id]); } else { - @\trigger_error(\sprintf('The "%s" service is private, replacing it is deprecated since Symfony 3.2 and will fail in 4.0.', $id), \E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s" service is private, replacing it is deprecated since Symfony 3.2 and will fail in 4.0.', $id), E_USER_DEPRECATED); } } elseif (isset($this->services[$id])) { if (null === $service) { - @\trigger_error(\sprintf('The "%s" service is already initialized, unsetting it is deprecated since Symfony 3.3 and will fail in 4.0.', $id), \E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s" service is already initialized, unsetting it is deprecated since Symfony 3.3 and will fail in 4.0.', $id), E_USER_DEPRECATED); } else { - @\trigger_error(\sprintf('The "%s" service is already initialized, replacing it is deprecated since Symfony 3.3 and will fail in 4.0.', $id), \E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s" service is already initialized, replacing it is deprecated since Symfony 3.3 and will fail in 4.0.', $id), E_USER_DEPRECATED); } } if (isset($this->aliases[$id])) { @@ -196,19 +221,19 @@ public function has($id) { for ($i = 2;;) { if (isset($this->privates[$id])) { - @\trigger_error(\sprintf('The "%s" service is private, checking for its existence is deprecated since Symfony 3.2 and will fail in 4.0.', $id), \E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s" service is private, checking for its existence is deprecated since Symfony 3.2 and will fail in 4.0.', $id), E_USER_DEPRECATED); } if (isset($this->aliases[$id])) { $id = $this->aliases[$id]; } if (isset($this->services[$id])) { - return \true; + return true; } if ('service_container' === $id) { - return \true; + return true; } if (isset($this->fileMap[$id]) || isset($this->methodMap[$id])) { - return \true; + return true; } if (--$i && $id !== ($normalizedId = $this->normalizeId($id))) { $id = $normalizedId; @@ -216,11 +241,11 @@ public function has($id) } // We only check the convention-based factory in a compiled container (i.e. a child class other than a ContainerBuilder, // and only when the dumper has not generated the method map (otherwise the method map is considered to be fully populated by the dumper) - if (!$this->methodMap && !$this instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder && __CLASS__ !== static::class && \method_exists($this, 'get' . \strtr($id, $this->underscoreMap) . 'Service')) { - @\trigger_error('Generating a dumped container without populating the method map is deprecated since Symfony 3.2 and will be unsupported in 4.0. Update your dumper to generate the method map.', \E_USER_DEPRECATED); - return \true; + if (!$this->methodMap && !$this instanceof ContainerBuilder && __CLASS__ !== static::class && method_exists($this, 'get' . strtr($id, $this->underscoreMap) . 'Service')) { + @trigger_error('Generating a dumped container without populating the method map is deprecated since Symfony 3.2 and will be unsupported in 4.0. Update your dumper to generate the method map.', E_USER_DEPRECATED); + return true; } - return \false; + return false; } } /** @@ -236,7 +261,7 @@ public function has($id) * * @throws ServiceCircularReferenceException When a circular reference is detected * @throws ServiceNotFoundException When the service is not defined - * @throws \Exception if an exception has been thrown when the service has been resolved + * @throws Exception if an exception has been thrown when the service has been resolved * * @see Reference */ @@ -248,7 +273,7 @@ public function get($id, $invalidBehavior = 1) // calling $this->normalizeId($id) unless necessary. for ($i = 2;;) { if (isset($this->privates[$id])) { - @\trigger_error(\sprintf('The "%s" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead.', $id), \E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead.', $id), E_USER_DEPRECATED); } if (isset($this->aliases[$id])) { $id = $this->aliases[$id]; @@ -261,9 +286,9 @@ public function get($id, $invalidBehavior = 1) return $this; } if (isset($this->loading[$id])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException($id, \array_merge(\array_keys($this->loading), [$id])); + throw new ServiceCircularReferenceException($id, array_merge(array_keys($this->loading), [$id])); } - $this->loading[$id] = \true; + $this->loading[$id] = true; try { if (isset($this->fileMap[$id])) { return 4 === $invalidBehavior ? null : $this->load($this->fileMap[$id]); @@ -273,14 +298,14 @@ public function get($id, $invalidBehavior = 1) unset($this->loading[$id]); $id = $normalizedId; continue; - } elseif (!$this->methodMap && !$this instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder && __CLASS__ !== static::class && \method_exists($this, $method = 'get' . \strtr($id, $this->underscoreMap) . 'Service')) { + } elseif (!$this->methodMap && !$this instanceof ContainerBuilder && __CLASS__ !== static::class && method_exists($this, $method = 'get' . strtr($id, $this->underscoreMap) . 'Service')) { // We only check the convention-based factory in a compiled container (i.e. a child class other than a ContainerBuilder, // and only when the dumper has not generated the method map (otherwise the method map is considered to be fully populated by the dumper) - @\trigger_error('Generating a dumped container without populating the method map is deprecated since Symfony 3.2 and will be unsupported in 4.0. Update your dumper to generate the method map.', \E_USER_DEPRECATED); + @trigger_error('Generating a dumped container without populating the method map is deprecated since Symfony 3.2 and will be unsupported in 4.0. Update your dumper to generate the method map.', E_USER_DEPRECATED); return 4 === $invalidBehavior ? null : $this->{$method}(); } break; - } catch (\Exception $e) { + } catch (Exception $e) { unset($this->services[$id]); throw $e; } finally { @@ -289,22 +314,22 @@ public function get($id, $invalidBehavior = 1) } if (1 === $invalidBehavior) { if (!$id) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException($id); + throw new ServiceNotFoundException($id); } if (isset($this->syntheticIds[$id])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException($id, null, null, [], \sprintf('The "%s" service is synthetic, it needs to be set at boot time before it can be used.', $id)); + throw new ServiceNotFoundException($id, null, null, [], sprintf('The "%s" service is synthetic, it needs to be set at boot time before it can be used.', $id)); } if (isset($this->getRemovedIds()[$id])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException($id, null, null, [], \sprintf('The "%s" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.', $id)); + throw new ServiceNotFoundException($id, null, null, [], sprintf('The "%s" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.', $id)); } $alternatives = []; foreach ($this->getServiceIds() as $knownId) { - $lev = \levenshtein($id, $knownId); - if ($lev <= \strlen($id) / 3 || \false !== \strpos($knownId, $id)) { + $lev = levenshtein($id, $knownId); + if ($lev <= strlen($id) / 3 || false !== strpos($knownId, $id)) { $alternatives[] = $knownId; } } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException($id, null, null, $alternatives); + throw new ServiceNotFoundException($id, null, null, $alternatives); } } /** @@ -318,13 +343,13 @@ public function initialized($id) { $id = $this->normalizeId($id); if (isset($this->privates[$id])) { - @\trigger_error(\sprintf('Checking for the initialization of the "%s" private service is deprecated since Symfony 3.4 and won\'t be supported anymore in Symfony 4.0.', $id), \E_USER_DEPRECATED); + @trigger_error(sprintf('Checking for the initialization of the "%s" private service is deprecated since Symfony 3.4 and won\'t be supported anymore in Symfony 4.0.', $id), E_USER_DEPRECATED); } if (isset($this->aliases[$id])) { $id = $this->aliases[$id]; } if ('service_container' === $id) { - return \false; + return false; } return isset($this->services[$id]); } @@ -343,18 +368,18 @@ public function reset() public function getServiceIds() { $ids = []; - if (!$this->methodMap && !$this instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder && __CLASS__ !== static::class) { + if (!$this->methodMap && !$this instanceof ContainerBuilder && __CLASS__ !== static::class) { // We only check the convention-based factory in a compiled container (i.e. a child class other than a ContainerBuilder, // and only when the dumper has not generated the method map (otherwise the method map is considered to be fully populated by the dumper) - @\trigger_error('Generating a dumped container without populating the method map is deprecated since Symfony 3.2 and will be unsupported in 4.0. Update your dumper to generate the method map.', \E_USER_DEPRECATED); - foreach (\get_class_methods($this) as $method) { - if (\preg_match('/^get(.+)Service$/', $method, $match)) { + @trigger_error('Generating a dumped container without populating the method map is deprecated since Symfony 3.2 and will be unsupported in 4.0. Update your dumper to generate the method map.', E_USER_DEPRECATED); + foreach (get_class_methods($this) as $method) { + if (preg_match('/^get(.+)Service$/', $method, $match)) { $ids[] = self::underscore($match[1]); } } } $ids[] = 'service_container'; - return \array_map('strval', \array_unique(\array_merge($ids, \array_keys($this->methodMap), \array_keys($this->fileMap), \array_keys($this->aliases), \array_keys($this->services)))); + return array_map('strval', array_unique(array_merge($ids, array_keys($this->methodMap), array_keys($this->fileMap), array_keys($this->aliases), array_keys($this->services)))); } /** * Gets service ids that existed at compile time. @@ -374,7 +399,7 @@ public function getRemovedIds() */ public static function camelize($id) { - return \strtr(\ucwords(\strtr($id, ['_' => ' ', '.' => '_ ', '\\' => '_ '])), [' ' => '']); + return strtr(ucwords(strtr($id, ['_' => ' ', '.' => '_ ', '\\' => '_ '])), [' ' => '']); } /** * A string to underscore. @@ -385,7 +410,7 @@ public static function camelize($id) */ public static function underscore($id) { - return \strtolower(\preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\\d])([A-Z])/'], ['\\1_\\2', '\\1_\\2'], \str_replace('_', '.', $id))); + return strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\\d])([A-Z])/'], ['\\1_\\2', '\\1_\\2'], str_replace('_', '.', $id))); } /** * Creates a service by requiring its factory file. @@ -406,29 +431,29 @@ protected function load($file) protected function getEnv($name) { if (isset($this->resolving[$envName = "env({$name})"])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException(\array_keys($this->resolving)); + throw new ParameterCircularReferenceException(array_keys($this->resolving)); } - if (isset($this->envCache[$name]) || \array_key_exists($name, $this->envCache)) { + if (isset($this->envCache[$name]) || array_key_exists($name, $this->envCache)) { return $this->envCache[$name]; } if (!$this->has($id = 'container.env_var_processors_locator')) { - $this->set($id, new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator([])); + $this->set($id, new ServiceLocator([])); } if (!$this->getEnv) { - $this->getEnv = new \ReflectionMethod($this, __FUNCTION__); - $this->getEnv->setAccessible(\true); + $this->getEnv = new ReflectionMethod($this, __FUNCTION__); + $this->getEnv->setAccessible(true); $this->getEnv = $this->getEnv->getClosure($this); } $processors = $this->get($id); - if (\false !== ($i = \strpos($name, ':'))) { - $prefix = \substr($name, 0, $i); - $localName = \substr($name, 1 + $i); + if (false !== ($i = strpos($name, ':'))) { + $prefix = substr($name, 0, $i); + $localName = substr($name, 1 + $i); } else { $prefix = 'string'; $localName = $name; } - $processor = $processors->has($prefix) ? $processors->get($prefix) : new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\EnvVarProcessor($this); - $this->resolving[$envName] = \true; + $processor = $processors->has($prefix) ? $processors->get($prefix) : new EnvVarProcessor($this); + $this->resolving[$envName] = true; try { return $this->envCache[$name] = $processor->getEnv($prefix, $localName, $this->getEnv); } finally { @@ -446,13 +471,13 @@ protected function getEnv($name) */ public function normalizeId($id) { - if (!\is_string($id)) { + if (!is_string($id)) { $id = (string) $id; } - if (isset($this->normalizedIds[$normalizedId = \strtolower($id)])) { + if (isset($this->normalizedIds[$normalizedId = strtolower($id)])) { $normalizedId = $this->normalizedIds[$normalizedId]; if ($id !== $normalizedId) { - @\trigger_error(\sprintf('Service identifiers will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.3.', $id, $normalizedId), \E_USER_DEPRECATED); + @trigger_error(sprintf('Service identifiers will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.3.', $id, $normalizedId), E_USER_DEPRECATED); } } else { $normalizedId = $this->normalizedIds[$normalizedId] = $id; diff --git a/vendor/symfony/dependency-injection/ContainerAwareInterface.php b/vendor/symfony/dependency-injection/ContainerAwareInterface.php index 32c27344e..286a61b12 100644 --- a/vendor/symfony/dependency-injection/ContainerAwareInterface.php +++ b/vendor/symfony/dependency-injection/ContainerAwareInterface.php @@ -20,5 +20,5 @@ interface ContainerAwareInterface /** * Sets the container. */ - public function setContainer(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface $container = null); + public function setContainer(ContainerInterface $container = null); } diff --git a/vendor/symfony/dependency-injection/ContainerAwareTrait.php b/vendor/symfony/dependency-injection/ContainerAwareTrait.php index 2c3ba4f4e..cc5f054e9 100644 --- a/vendor/symfony/dependency-injection/ContainerAwareTrait.php +++ b/vendor/symfony/dependency-injection/ContainerAwareTrait.php @@ -21,7 +21,7 @@ trait ContainerAwareTrait * @var ContainerInterface */ protected $container; - public function setContainer(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface $container = null) + public function setContainer(ContainerInterface $container = null) { $this->container = $container; } diff --git a/vendor/symfony/dependency-injection/ContainerBuilder.php b/vendor/symfony/dependency-injection/ContainerBuilder.php index 0829e33f3..68f4e3448 100644 --- a/vendor/symfony/dependency-injection/ContainerBuilder.php +++ b/vendor/symfony/dependency-injection/ContainerBuilder.php @@ -41,12 +41,59 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; +use Exception; +use ReflectionClass; +use ReflectionException; +use ReflectionMethod; +use function array_diff; +use function array_keys; +use function array_map; +use function array_merge; +use function array_search; +use function array_slice; +use function array_unique; +use function array_unshift; +use function array_values; +use function base64_encode; +use function call_user_func; +use function call_user_func_array; +use function class_exists; +use function file_exists; +use function func_get_arg; +use function func_num_args; +use function get_class; +use function gettype; +use function hash; +use function interface_exists; +use function is_array; +use function is_callable; +use function is_dir; +use function is_numeric; +use function is_object; +use function is_string; +use function realpath; +use function serialize; +use function spl_object_hash; +use function sprintf; +use function str_ireplace; +use function str_replace; +use function strcspn; +use function stripos; +use function strlen; +use function strpbrk; +use function strpos; +use function strtolower; +use function substr; +use function trigger_error; +use const DIRECTORY_SEPARATOR; +use const E_USER_DEPRECATED; + /** * ContainerBuilder is a DI container that provides an API to easily describe services. * * @author Fabien Potencier */ -class ContainerBuilder extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TaggedContainerInterface +class ContainerBuilder extends Container implements TaggedContainerInterface { /** * @var ExtensionInterface[] @@ -105,17 +152,17 @@ class ContainerBuilder extends \_PhpScoper5ea00cc67502b\Symfony\Component\Depend private $autoconfiguredInstanceof = []; private $removedIds = []; private $removedBindingIds = []; - private static $internalTypes = ['int' => \true, 'float' => \true, 'string' => \true, 'bool' => \true, 'resource' => \true, 'object' => \true, 'array' => \true, 'null' => \true, 'callable' => \true, 'iterable' => \true, 'mixed' => \true]; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface $parameterBag = null) + private static $internalTypes = ['int' => true, 'float' => true, 'string' => true, 'bool' => true, 'resource' => true, 'object' => true, 'array' => true, 'null' => true, 'callable' => true, 'iterable' => true, 'mixed' => true]; + public function __construct(ParameterBagInterface $parameterBag = null) { parent::__construct($parameterBag); - $this->trackResources = \interface_exists('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Resource\\ResourceInterface'); - $this->setDefinition('service_container', (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::class))->setSynthetic(\true)->setPublic(\true)); - $this->setAlias(\_PhpScoper5ea00cc67502b\Psr\Container\ContainerInterface::class, new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Alias('service_container', \false)); - $this->setAlias(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::class, new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Alias('service_container', \false)); + $this->trackResources = interface_exists('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Resource\\ResourceInterface'); + $this->setDefinition('service_container', (new Definition(ContainerInterface::class))->setSynthetic(true)->setPublic(true)); + $this->setAlias(PsrContainerInterface::class, new Alias('service_container', false)); + $this->setAlias(ContainerInterface::class, new Alias('service_container', false)); } /** - * @var \ReflectionClass[] a list of class reflectors + * @var ReflectionClass[] a list of class reflectors */ private $classReflectors; /** @@ -142,14 +189,14 @@ public function isTrackingResources() /** * Sets the instantiator to be used when fetching proxies. */ - public function setProxyInstantiator(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\LazyProxy\Instantiator\InstantiatorInterface $proxyInstantiator) + public function setProxyInstantiator(InstantiatorInterface $proxyInstantiator) { $this->proxyInstantiator = $proxyInstantiator; } - public function registerExtension(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Extension\ExtensionInterface $extension) + public function registerExtension(ExtensionInterface $extension) { $this->extensions[$extension->getAlias()] = $extension; - if (\false !== $extension->getNamespace()) { + if (false !== $extension->getNamespace()) { $this->extensionsByNs[$extension->getNamespace()] = $extension; } } @@ -170,7 +217,7 @@ public function getExtension($name) if (isset($this->extensionsByNs[$name])) { return $this->extensionsByNs[$name]; } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException(\sprintf('Container extension "%s" is not registered.', $name)); + throw new LogicException(sprintf('Container extension "%s" is not registered.', $name)); } /** * Returns all registered extensions. @@ -199,17 +246,17 @@ public function hasExtension($name) */ public function getResources() { - return \array_values($this->resources); + return array_values($this->resources); } /** * @return $this */ - public function addResource(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ResourceInterface $resource) + public function addResource(ResourceInterface $resource) { if (!$this->trackResources) { return $this; } - if ($resource instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\GlobResource && $this->inVendors($resource->getPrefix())) { + if ($resource instanceof GlobResource && $this->inVendors($resource->getPrefix())) { return $this; } $this->resources[(string) $resource] = $resource; @@ -240,25 +287,25 @@ public function setResources(array $resources) public function addObjectResource($object) { if ($this->trackResources) { - if (\is_object($object)) { - $object = \get_class($object); + if (is_object($object)) { + $object = get_class($object); } if (!isset($this->classReflectors[$object])) { - $this->classReflectors[$object] = new \ReflectionClass($object); + $this->classReflectors[$object] = new ReflectionClass($object); } $class = $this->classReflectors[$object]; foreach ($class->getInterfaceNames() as $name) { if (null === ($interface =& $this->classReflectors[$name])) { - $interface = new \ReflectionClass($name); + $interface = new ReflectionClass($name); } $file = $interface->getFileName(); - if (\false !== $file && \file_exists($file)) { + if (false !== $file && file_exists($file)) { $this->fileExists($file); } } do { $file = $class->getFileName(); - if (\false !== $file && \file_exists($file)) { + if (false !== $file && file_exists($file)) { $this->fileExists($file); } foreach ($class->getTraitNames() as $name) { @@ -275,9 +322,9 @@ public function addObjectResource($object) * * @deprecated since version 3.3, to be removed in 4.0. Use addObjectResource() or getReflectionClass() instead. */ - public function addClassResource(\ReflectionClass $class) + public function addClassResource(ReflectionClass $class) { - @\trigger_error('The ' . __METHOD__ . '() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the addObjectResource() or the getReflectionClass() method instead.', \E_USER_DEPRECATED); + @trigger_error('The ' . __METHOD__ . '() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the addObjectResource() or the getReflectionClass() method instead.', E_USER_DEPRECATED); return $this->addObjectResource($class->name); } /** @@ -286,13 +333,13 @@ public function addClassResource(\ReflectionClass $class) * @param string $class * @param bool $throw * - * @return \ReflectionClass|null + * @return ReflectionClass|null * - * @throws \ReflectionException when a parent class/interface/trait is not found and $throw is true + * @throws ReflectionException when a parent class/interface/trait is not found and $throw is true * * @final */ - public function getReflectionClass($class, $throw = \true) + public function getReflectionClass($class, $throw = true) { if (!($class = $this->getParameterBag()->resolveValue($class))) { return null; @@ -304,24 +351,24 @@ public function getReflectionClass($class, $throw = \true) try { if (isset($this->classReflectors[$class])) { $classReflector = $this->classReflectors[$class]; - } elseif (\class_exists(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ClassExistenceResource::class)) { - $resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ClassExistenceResource($class, \false); - $classReflector = $resource->isFresh(0) ? \false : new \ReflectionClass($class); + } elseif (class_exists(ClassExistenceResource::class)) { + $resource = new ClassExistenceResource($class, false); + $classReflector = $resource->isFresh(0) ? false : new ReflectionClass($class); } else { - $classReflector = \class_exists($class) ? new \ReflectionClass($class) : \false; + $classReflector = class_exists($class) ? new ReflectionClass($class) : false; } - } catch (\ReflectionException $e) { + } catch (ReflectionException $e) { if ($throw) { throw $e; } } if ($this->trackResources) { if (!$classReflector) { - $this->addResource($resource ?: new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ClassExistenceResource($class, \false)); + $this->addResource($resource ?: new ClassExistenceResource($class, false)); } elseif (!$classReflector->isInternal()) { $path = $classReflector->getFileName(); if (!$this->inVendors($path)) { - $this->addResource(new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ReflectionClassResource($classReflector, $this->vendors)); + $this->addResource(new ReflectionClassResource($classReflector, $this->vendors)); } } $this->classReflectors[$class] = $classReflector; @@ -339,24 +386,24 @@ public function getReflectionClass($class, $throw = \true) * * @final */ - public function fileExists($path, $trackContents = \true) + public function fileExists($path, $trackContents = true) { - $exists = \file_exists($path); + $exists = file_exists($path); if (!$this->trackResources || $this->inVendors($path)) { return $exists; } if (!$exists) { - $this->addResource(new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\FileExistenceResource($path)); + $this->addResource(new FileExistenceResource($path)); return $exists; } - if (\is_dir($path)) { + if (is_dir($path)) { if ($trackContents) { - $this->addResource(new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\DirectoryResource($path, \is_string($trackContents) ? $trackContents : null)); + $this->addResource(new DirectoryResource($path, is_string($trackContents) ? $trackContents : null)); } else { - $this->addResource(new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\GlobResource($path, '/*', \false)); + $this->addResource(new GlobResource($path, '/*', false)); } } elseif ($trackContents) { - $this->addResource(new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\FileResource($path)); + $this->addResource(new FileResource($path)); } return $exists; } @@ -374,9 +421,9 @@ public function fileExists($path, $trackContents = \true) public function loadFromExtension($extension, array $values = null) { if ($this->isCompiled()) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\BadMethodCallException('Cannot load from an extension on a compiled container.'); + throw new BadMethodCallException('Cannot load from an extension on a compiled container.'); } - if (\func_num_args() < 2) { + if (func_num_args() < 2) { $values = []; } $namespace = $this->getExtension($extension)->getAlias(); @@ -392,15 +439,15 @@ public function loadFromExtension($extension, array $values = null) * * @return $this */ - public function addCompilerPass(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface $pass, $type = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION) + public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION) { - if (\func_num_args() >= 3) { - $priority = \func_get_arg(2); + if (func_num_args() >= 3) { + $priority = func_get_arg(2); } else { if (__CLASS__ !== static::class) { - $r = new \ReflectionMethod($this, __FUNCTION__); + $r = new ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @\trigger_error(\sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), \E_USER_DEPRECATED); + @trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), E_USER_DEPRECATED); } } $priority = 0; @@ -426,7 +473,7 @@ public function getCompilerPassConfig() public function getCompiler() { if (null === $this->compiler) { - $this->compiler = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\Compiler(); + $this->compiler = new Compiler(); } return $this->compiler; } @@ -443,7 +490,7 @@ public function set($id, $service) $id = $this->normalizeId($id); if ($this->isCompiled() && (isset($this->definitions[$id]) && !$this->definitions[$id]->isSynthetic())) { // setting a synthetic service on a compiled container is alright - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\BadMethodCallException(\sprintf('Setting service "%s" for an unknown or non-synthetic service definition on a compiled container is not allowed.', $id)); + throw new BadMethodCallException(sprintf('Setting service "%s" for an unknown or non-synthetic service definition on a compiled container is not allowed.', $id)); } unset($this->definitions[$id], $this->aliasDefinitions[$id], $this->removedIds[$id]); parent::set($id, $service); @@ -457,7 +504,7 @@ public function removeDefinition($id) { if (isset($this->definitions[$id = $this->normalizeId($id)])) { unset($this->definitions[$id]); - $this->removedIds[$id] = \true; + $this->removedIds[$id] = true; } } /** @@ -483,35 +530,35 @@ public function has($id) * @throws InvalidArgumentException when no definitions are available * @throws ServiceCircularReferenceException When a circular reference is detected * @throws ServiceNotFoundException When the service is not defined - * @throws \Exception + * @throws Exception * * @see Reference */ - public function get($id, $invalidBehavior = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) + public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) { if ($this->isCompiled() && isset($this->removedIds[$id = $this->normalizeId($id)])) { - @\trigger_error(\sprintf('Fetching the "%s" private service or alias is deprecated since Symfony 3.4 and will fail in 4.0. Make it public instead.', $id), \E_USER_DEPRECATED); + @trigger_error(sprintf('Fetching the "%s" private service or alias is deprecated since Symfony 3.4 and will fail in 4.0. Make it public instead.', $id), E_USER_DEPRECATED); } return $this->doGet($id, $invalidBehavior); } - private function doGet($id, $invalidBehavior = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, array &$inlineServices = null, $isConstructorArgument = \false) + private function doGet($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, array &$inlineServices = null, $isConstructorArgument = false) { $id = $this->normalizeId($id); if (isset($inlineServices[$id])) { return $inlineServices[$id]; } if (null === $inlineServices) { - $isConstructorArgument = \true; + $isConstructorArgument = true; $inlineServices = []; } try { - if (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $invalidBehavior) { + if (ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $invalidBehavior) { return parent::get($id, $invalidBehavior); } - if ($service = parent::get($id, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::NULL_ON_INVALID_REFERENCE)) { + if ($service = parent::get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)) { return $service; } - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException $e) { + } catch (ServiceCircularReferenceException $e) { if ($isConstructorArgument) { throw $e; } @@ -521,14 +568,14 @@ private function doGet($id, $invalidBehavior = \_PhpScoper5ea00cc67502b\Symfony\ } try { $definition = $this->getDefinition($id); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException $e) { - if (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) { + } catch (ServiceNotFoundException $e) { + if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) { return null; } throw $e; } if ($isConstructorArgument) { - $this->loading[$id] = \true; + $this->loading[$id] = true; } try { return $this->createService($definition, $inlineServices, $isConstructorArgument, $id); @@ -561,7 +608,7 @@ private function doGet($id, $invalidBehavior = \_PhpScoper5ea00cc67502b\Symfony\ public function merge(self $container) { if ($this->isCompiled()) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\BadMethodCallException('Cannot merge on a compiled container.'); + throw new BadMethodCallException('Cannot merge on a compiled container.'); } $this->addDefinitions($container->getDefinitions()); $this->addAliases($container->getAliases()); @@ -575,9 +622,9 @@ public function merge(self $container) if (!isset($this->extensionConfigs[$name])) { $this->extensionConfigs[$name] = []; } - $this->extensionConfigs[$name] = \array_merge($this->extensionConfigs[$name], $container->getExtensionConfig($name)); + $this->extensionConfigs[$name] = array_merge($this->extensionConfigs[$name], $container->getExtensionConfig($name)); } - if ($this->getParameterBag() instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag && $container->getParameterBag() instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag) { + if ($this->getParameterBag() instanceof EnvPlaceholderParameterBag && $container->getParameterBag() instanceof EnvPlaceholderParameterBag) { $envPlaceholders = $container->getParameterBag()->getEnvPlaceholders(); $this->getParameterBag()->mergeEnvPlaceholders($container->getParameterBag()); } else { @@ -595,7 +642,7 @@ public function merge(self $container) } foreach ($container->getAutoconfiguredInstanceof() as $interface => $childDefinition) { if (isset($this->autoconfiguredInstanceof[$interface])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('"%s" has already been autoconfigured and merge() does not support merging autoconfiguration for the same class/interface.', $interface)); + throw new InvalidArgumentException(sprintf('"%s" has already been autoconfigured and merge() does not support merging autoconfiguration for the same class/interface.', $interface)); } $this->autoconfiguredInstanceof[$interface] = $childDefinition; } @@ -625,7 +672,7 @@ public function prependExtensionConfig($name, array $config) if (!isset($this->extensionConfigs[$name])) { $this->extensionConfigs[$name] = []; } - \array_unshift($this->extensionConfigs[$name], $config); + array_unshift($this->extensionConfigs[$name], $config); } /** * Compiles the container. @@ -648,16 +695,16 @@ public function prependExtensionConfig($name, array $config) */ public function compile() { - if (1 <= \func_num_args()) { - $resolveEnvPlaceholders = \func_get_arg(0); + if (1 <= func_num_args()) { + $resolveEnvPlaceholders = func_get_arg(0); } else { if (__CLASS__ !== static::class) { - $r = new \ReflectionMethod($this, __FUNCTION__); + $r = new ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName() && (1 > $r->getNumberOfParameters() || 'resolveEnvPlaceholders' !== $r->getParameters()[0]->name)) { - @\trigger_error(\sprintf('The %s::compile() method expects a first "$resolveEnvPlaceholders" argument since Symfony 3.3. It will be made mandatory in 4.0.', static::class), \E_USER_DEPRECATED); + @trigger_error(sprintf('The %s::compile() method expects a first "$resolveEnvPlaceholders" argument since Symfony 3.3. It will be made mandatory in 4.0.', static::class), E_USER_DEPRECATED); } } - $resolveEnvPlaceholders = \false; + $resolveEnvPlaceholders = false; } $compiler = $this->getCompiler(); if ($this->trackResources) { @@ -666,8 +713,8 @@ public function compile() } } $bag = $this->getParameterBag(); - if ($resolveEnvPlaceholders && $bag instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag) { - $compiler->addPass(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveEnvPlaceholdersPass(), \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_AFTER_REMOVING, -1000); + if ($resolveEnvPlaceholders && $bag instanceof EnvPlaceholderParameterBag) { + $compiler->addPass(new ResolveEnvPlaceholdersPass(), PassConfig::TYPE_AFTER_REMOVING, -1000); } $compiler->compile($this); foreach ($this->definitions as $id => $definition) { @@ -676,16 +723,16 @@ public function compile() } } $this->extensionConfigs = []; - if ($bag instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag) { + if ($bag instanceof EnvPlaceholderParameterBag) { if ($resolveEnvPlaceholders) { - $this->parameterBag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag($this->resolveEnvPlaceholders($bag->all(), \true)); + $this->parameterBag = new ParameterBag($this->resolveEnvPlaceholders($bag->all(), true)); } $this->envPlaceholders = $bag->getEnvPlaceholders(); } parent::compile(); foreach ($this->definitions + $this->aliasDefinitions as $id => $definition) { if (!$definition->isPublic() || $definition->isPrivate()) { - $this->removedIds[$id] = \true; + $this->removedIds[$id] = true; } } } @@ -694,7 +741,7 @@ public function compile() */ public function getServiceIds() { - return \array_map('strval', \array_unique(\array_merge(\array_keys($this->getDefinitions()), \array_keys($this->aliasDefinitions), parent::getServiceIds()))); + return array_map('strval', array_unique(array_merge(array_keys($this->getDefinitions()), array_keys($this->aliasDefinitions), parent::getServiceIds()))); } /** * Gets removed service or alias ids. @@ -736,16 +783,16 @@ public function setAliases(array $aliases) public function setAlias($alias, $id) { $alias = $this->normalizeId($alias); - if ('' === $alias || '\\' === \substr($alias, -1) || \strlen($alias) !== \strcspn($alias, "\0\r\n'")) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Invalid alias id: "%s".', $alias)); + if ('' === $alias || '\\' === substr($alias, -1) || strlen($alias) !== strcspn($alias, "\0\r\n'")) { + throw new InvalidArgumentException(sprintf('Invalid alias id: "%s".', $alias)); } - if (\is_string($id)) { - $id = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Alias($this->normalizeId($id)); - } elseif (!$id instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Alias) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException('$id must be a string, or an Alias object.'); + if (is_string($id)) { + $id = new Alias($this->normalizeId($id)); + } elseif (!$id instanceof Alias) { + throw new InvalidArgumentException('$id must be a string, or an Alias object.'); } if ($alias === (string) $id) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('An alias can not reference itself, got a circular reference on "%s".', $alias)); + throw new InvalidArgumentException(sprintf('An alias can not reference itself, got a circular reference on "%s".', $alias)); } unset($this->definitions[$alias], $this->removedIds[$alias]); return $this->aliasDefinitions[$alias] = $id; @@ -759,7 +806,7 @@ public function removeAlias($alias) { if (isset($this->aliasDefinitions[$alias = $this->normalizeId($alias)])) { unset($this->aliasDefinitions[$alias]); - $this->removedIds[$alias] = \true; + $this->removedIds[$alias] = true; } } /** @@ -795,7 +842,7 @@ public function getAlias($id) { $id = $this->normalizeId($id); if (!isset($this->aliasDefinitions[$id])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The service alias "%s" does not exist.', $id)); + throw new InvalidArgumentException(sprintf('The service alias "%s" does not exist.', $id)); } return $this->aliasDefinitions[$id]; } @@ -812,7 +859,7 @@ public function getAlias($id) */ public function register($id, $class = null) { - return $this->setDefinition($id, new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition($class)); + return $this->setDefinition($id, new Definition($class)); } /** * Registers an autowired service definition. @@ -827,7 +874,7 @@ public function register($id, $class = null) */ public function autowire($id, $class = null) { - return $this->setDefinition($id, (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition($class))->setAutowired(\true)); + return $this->setDefinition($id, (new Definition($class))->setAutowired(true)); } /** * Adds the service definitions. @@ -869,14 +916,14 @@ public function getDefinitions() * * @throws BadMethodCallException When this ContainerBuilder is compiled */ - public function setDefinition($id, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition) + public function setDefinition($id, Definition $definition) { if ($this->isCompiled()) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\BadMethodCallException('Adding definition to a compiled container is not allowed.'); + throw new BadMethodCallException('Adding definition to a compiled container is not allowed.'); } $id = $this->normalizeId($id); - if ('' === $id || '\\' === \substr($id, -1) || \strlen($id) !== \strcspn($id, "\0\r\n'")) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Invalid service id: "%s".', $id)); + if ('' === $id || '\\' === substr($id, -1) || strlen($id) !== strcspn($id, "\0\r\n'")) { + throw new InvalidArgumentException(sprintf('Invalid service id: "%s".', $id)); } unset($this->aliasDefinitions[$id], $this->removedIds[$id]); return $this->definitions[$id] = $definition; @@ -905,7 +952,7 @@ public function getDefinition($id) { $id = $this->normalizeId($id); if (!isset($this->definitions[$id])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException($id); + throw new ServiceNotFoundException($id); } return $this->definitions[$id]; } @@ -927,10 +974,10 @@ public function findDefinition($id) while (isset($this->aliasDefinitions[$id])) { $id = (string) $this->aliasDefinitions[$id]; if (isset($seen[$id])) { - $seen = \array_values($seen); - $seen = \array_slice($seen, \array_search($id, $seen)); + $seen = array_values($seen); + $seen = array_slice($seen, array_search($id, $seen)); $seen[] = $id; - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException($id, $seen); + throw new ServiceCircularReferenceException($id, $seen); } $seen[$id] = $id; } @@ -949,23 +996,23 @@ public function findDefinition($id) * @throws RuntimeException When the service is a synthetic service * @throws InvalidArgumentException When configure callable is not callable */ - private function createService(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition, array &$inlineServices, $isConstructorArgument = \false, $id = null, $tryProxy = \true) + private function createService(Definition $definition, array &$inlineServices, $isConstructorArgument = false, $id = null, $tryProxy = true) { - if (null === $id && isset($inlineServices[$h = \spl_object_hash($definition)])) { + if (null === $id && isset($inlineServices[$h = spl_object_hash($definition)])) { return $inlineServices[$h]; } - if ($definition instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Constructing service "%s" from a parent definition is not supported at build time.', $id)); + if ($definition instanceof ChildDefinition) { + throw new RuntimeException(sprintf('Constructing service "%s" from a parent definition is not supported at build time.', $id)); } if ($definition->isSynthetic()) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('You have requested a synthetic service ("%s"). The DIC does not know how to construct this service.', $id)); + throw new RuntimeException(sprintf('You have requested a synthetic service ("%s"). The DIC does not know how to construct this service.', $id)); } if ($definition->isDeprecated()) { - @\trigger_error($definition->getDeprecationMessage($id), \E_USER_DEPRECATED); + @trigger_error($definition->getDeprecationMessage($id), E_USER_DEPRECATED); } - if ($tryProxy && $definition->isLazy() && !($tryProxy = !($proxy = $this->proxyInstantiator) || $proxy instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\LazyProxy\Instantiator\RealServiceInstantiator)) { + if ($tryProxy && $definition->isLazy() && !($tryProxy = !($proxy = $this->proxyInstantiator) || $proxy instanceof RealServiceInstantiator)) { $proxy = $proxy->instantiateProxy($this, $definition, $id, function () use($definition, &$inlineServices, $id) { - return $this->createService($definition, $inlineServices, \true, $id, \false); + return $this->createService($definition, $inlineServices, true, $id, false); }); $this->shareService($definition, $proxy, $id, $inlineServices); return $proxy; @@ -976,31 +1023,31 @@ private function createService(\_PhpScoper5ea00cc67502b\Symfony\Component\Depend } $arguments = $this->doResolveServices($parameterBag->unescapeValue($parameterBag->resolveValue($definition->getArguments())), $inlineServices, $isConstructorArgument); if (null !== ($factory = $definition->getFactory())) { - if (\is_array($factory)) { + if (is_array($factory)) { $factory = [$this->doResolveServices($parameterBag->resolveValue($factory[0]), $inlineServices, $isConstructorArgument), $factory[1]]; - } elseif (!\is_string($factory)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Cannot create service "%s" because of invalid factory.', $id)); + } elseif (!is_string($factory)) { + throw new RuntimeException(sprintf('Cannot create service "%s" because of invalid factory.', $id)); } } if (null !== $id && $definition->isShared() && isset($this->services[$id]) && ($tryProxy || !$definition->isLazy())) { return $this->services[$id]; } if (null !== $factory) { - $service = \call_user_func_array($factory, $arguments); - if (!$definition->isDeprecated() && \is_array($factory) && \is_string($factory[0])) { - $r = new \ReflectionClass($factory[0]); - if (0 < \strpos($r->getDocComment(), "\n * @deprecated ")) { - @\trigger_error(\sprintf('The "%s" service relies on the deprecated "%s" factory class. It should either be deprecated or its factory upgraded.', $id, $r->name), \E_USER_DEPRECATED); + $service = call_user_func_array($factory, $arguments); + if (!$definition->isDeprecated() && is_array($factory) && is_string($factory[0])) { + $r = new ReflectionClass($factory[0]); + if (0 < strpos($r->getDocComment(), "\n * @deprecated ")) { + @trigger_error(sprintf('The "%s" service relies on the deprecated "%s" factory class. It should either be deprecated or its factory upgraded.', $id, $r->name), E_USER_DEPRECATED); } } } else { - $r = new \ReflectionClass($class = $parameterBag->resolveValue($definition->getClass())); + $r = new ReflectionClass($class = $parameterBag->resolveValue($definition->getClass())); $service = null === $r->getConstructor() ? $r->newInstance() : $r->newInstanceArgs($arguments); // don't trigger deprecations for internal uses // @deprecated since version 3.3, to be removed in 4.0 along with the deprecated class - $deprecationWhitelist = ['event_dispatcher' => \_PhpScoper5ea00cc67502b\Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher::class]; - if (!$definition->isDeprecated() && 0 < \strpos($r->getDocComment(), "\n * @deprecated ") && (!isset($deprecationWhitelist[$id]) || $deprecationWhitelist[$id] !== $class)) { - @\trigger_error(\sprintf('The "%s" service relies on the deprecated "%s" class. It should either be deprecated or its implementation upgraded.', $id, $r->name), \E_USER_DEPRECATED); + $deprecationWhitelist = ['event_dispatcher' => ContainerAwareEventDispatcher::class]; + if (!$definition->isDeprecated() && 0 < strpos($r->getDocComment(), "\n * @deprecated ") && (!isset($deprecationWhitelist[$id]) || $deprecationWhitelist[$id] !== $class)) { + @trigger_error(sprintf('The "%s" service relies on the deprecated "%s" class. It should either be deprecated or its implementation upgraded.', $id, $r->name), E_USER_DEPRECATED); } } if ($tryProxy || !$definition->isLazy()) { @@ -1015,18 +1062,18 @@ private function createService(\_PhpScoper5ea00cc67502b\Symfony\Component\Depend $this->callMethod($service, $call, $inlineServices); } if ($callable = $definition->getConfigurator()) { - if (\is_array($callable)) { + if (is_array($callable)) { $callable[0] = $parameterBag->resolveValue($callable[0]); - if ($callable[0] instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference) { + if ($callable[0] instanceof Reference) { $callable[0] = $this->doGet((string) $callable[0], $callable[0]->getInvalidBehavior(), $inlineServices); - } elseif ($callable[0] instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition) { + } elseif ($callable[0] instanceof Definition) { $callable[0] = $this->createService($callable[0], $inlineServices); } } - if (!\is_callable($callable)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The configure callable for class "%s" is not a callable.', \get_class($service))); + if (!is_callable($callable)) { + throw new InvalidArgumentException(sprintf('The configure callable for class "%s" is not a callable.', get_class($service))); } - \call_user_func($callable, $service); + call_user_func($callable, $service); } return $service; } @@ -1042,19 +1089,19 @@ public function resolveServices($value) { return $this->doResolveServices($value); } - private function doResolveServices($value, array &$inlineServices = [], $isConstructorArgument = \false) + private function doResolveServices($value, array &$inlineServices = [], $isConstructorArgument = false) { - if (\is_array($value)) { + if (is_array($value)) { foreach ($value as $k => $v) { $value[$k] = $this->doResolveServices($v, $inlineServices, $isConstructorArgument); } - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument) { + } elseif ($value instanceof ServiceClosureArgument) { $reference = $value->getValues()[0]; $value = function () use($reference) { return $this->resolveServices($reference); }; - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument) { - $value = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator(function () use($value) { + } elseif ($value instanceof IteratorArgument) { + $value = new RewindableGenerator(function () use($value) { foreach ($value->getValues() as $k => $v) { foreach (self::getServiceConditionals($v) as $s) { if (!$this->has($s)) { @@ -1062,7 +1109,7 @@ private function doResolveServices($value, array &$inlineServices = [], $isConst } } foreach (self::getInitializedConditionals($v) as $s) { - if (!$this->doGet($s, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE)) { + if (!$this->doGet($s, ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE)) { continue 2; } } @@ -1077,7 +1124,7 @@ private function doResolveServices($value, array &$inlineServices = [], $isConst } } foreach (self::getInitializedConditionals($v) as $s) { - if (!$this->doGet($s, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE)) { + if (!$this->doGet($s, ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE)) { continue 2; } } @@ -1085,13 +1132,13 @@ private function doResolveServices($value, array &$inlineServices = [], $isConst } return $count; }); - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference) { + } elseif ($value instanceof Reference) { $value = $this->doGet((string) $value, $value->getInvalidBehavior(), $inlineServices, $isConstructorArgument); - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition) { + } elseif ($value instanceof Definition) { $value = $this->createService($value, $inlineServices, $isConstructorArgument); - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Parameter) { + } elseif ($value instanceof Parameter) { $value = $this->getParameter((string) $value); - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression) { + } elseif ($value instanceof Expression) { $value = $this->getExpressionLanguage()->evaluate($value, ['container' => $this]); } return $value; @@ -1115,14 +1162,14 @@ private function doResolveServices($value, array &$inlineServices = [], $isConst * * @return array An array of tags with the tagged service as key, holding a list of attribute arrays */ - public function findTaggedServiceIds($name, $throwOnAbstract = \false) + public function findTaggedServiceIds($name, $throwOnAbstract = false) { $this->usedTags[] = $name; $tags = []; foreach ($this->getDefinitions() as $id => $definition) { if ($definition->hasTag($name)) { if ($throwOnAbstract && $definition->isAbstract()) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The service "%s" tagged "%s" must not be abstract.', $id, $name)); + throw new InvalidArgumentException(sprintf('The service "%s" tagged "%s" must not be abstract.', $id, $name)); } $tags[$id] = $definition->getTag($name); } @@ -1138,9 +1185,9 @@ public function findTags() { $tags = []; foreach ($this->getDefinitions() as $id => $definition) { - $tags = \array_merge(\array_keys($definition->getTags()), $tags); + $tags = array_merge(array_keys($definition->getTags()), $tags); } - return \array_unique($tags); + return array_unique($tags); } /** * Returns all tags not queried by findTaggedServiceIds. @@ -1149,9 +1196,9 @@ public function findTags() */ public function findUnusedTags() { - return \array_values(\array_diff($this->findTags(), $this->usedTags)); + return array_values(array_diff($this->findTags(), $this->usedTags)); } - public function addExpressionLanguageProvider(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface $provider) + public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider) { $this->expressionLanguageProviders[] = $provider; } @@ -1172,7 +1219,7 @@ public function getExpressionLanguageProviders() public function registerForAutoconfiguration($interface) { if (!isset($this->autoconfiguredInstanceof[$interface])) { - $this->autoconfiguredInstanceof[$interface] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition(''); + $this->autoconfiguredInstanceof[$interface] = new ChildDefinition(''); } return $this->autoconfiguredInstanceof[$interface]; } @@ -1202,37 +1249,37 @@ public function resolveEnvPlaceholders($value, $format = null, array &$usedEnvs $format = '%%env(%s)%%'; } $bag = $this->getParameterBag(); - if (\true === $format) { + if (true === $format) { $value = $bag->resolveValue($value); } - if (\is_array($value)) { + if (is_array($value)) { $result = []; foreach ($value as $k => $v) { - $result[\is_string($k) ? $this->resolveEnvPlaceholders($k, $format, $usedEnvs) : $k] = $this->resolveEnvPlaceholders($v, $format, $usedEnvs); + $result[is_string($k) ? $this->resolveEnvPlaceholders($k, $format, $usedEnvs) : $k] = $this->resolveEnvPlaceholders($v, $format, $usedEnvs); } return $result; } - if (!\is_string($value) || 38 > \strlen($value)) { + if (!is_string($value) || 38 > strlen($value)) { return $value; } - $envPlaceholders = $bag instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag ? $bag->getEnvPlaceholders() : $this->envPlaceholders; - $completed = \false; + $envPlaceholders = $bag instanceof EnvPlaceholderParameterBag ? $bag->getEnvPlaceholders() : $this->envPlaceholders; + $completed = false; foreach ($envPlaceholders as $env => $placeholders) { foreach ($placeholders as $placeholder) { - if (\false !== \stripos($value, $placeholder)) { - if (\true === $format) { + if (false !== stripos($value, $placeholder)) { + if (true === $format) { $resolved = $bag->escapeValue($this->getEnv($env)); } else { - $resolved = \sprintf($format, $env); + $resolved = sprintf($format, $env); } if ($placeholder === $value) { $value = $resolved; - $completed = \true; + $completed = true; } else { - if (!\is_string($resolved) && !\is_numeric($resolved)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('A string value must be composed of strings and/or numbers, but found parameter "env(%s)" of type "%s" inside string value "%s".', $env, \gettype($resolved), $this->resolveEnvPlaceholders($value))); + if (!is_string($resolved) && !is_numeric($resolved)) { + throw new RuntimeException(sprintf('A string value must be composed of strings and/or numbers, but found parameter "env(%s)" of type "%s" inside string value "%s".', $env, gettype($resolved), $this->resolveEnvPlaceholders($value))); } - $value = \str_ireplace($placeholder, $resolved, $value); + $value = str_ireplace($placeholder, $resolved, $value); } $usedEnvs[$env] = $env; $this->envCounters[$env] = isset($this->envCounters[$env]) ? 1 + $this->envCounters[$env] : 1; @@ -1252,7 +1299,7 @@ public function resolveEnvPlaceholders($value, $format = null, array &$usedEnvs public function getEnvCounters() { $bag = $this->getParameterBag(); - $envPlaceholders = $bag instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag ? $bag->getEnvPlaceholders() : $this->envPlaceholders; + $envPlaceholders = $bag instanceof EnvPlaceholderParameterBag ? $bag->getEnvPlaceholders() : $this->envPlaceholders; foreach ($envPlaceholders as $env => $placeholders) { if (!isset($this->envCounters[$env])) { $this->envCounters[$env] = 0; @@ -1276,7 +1323,7 @@ public function getNormalizedIds() /** * @final */ - public function log(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface $pass, $message) + public function log(CompilerPassInterface $pass, $message) { $this->getCompiler()->log($pass, $this->resolveEnvPlaceholders($message)); } @@ -1285,7 +1332,7 @@ public function log(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjecti */ public function normalizeId($id) { - if (!\is_string($id)) { + if (!is_string($id)) { $id = (string) $id; } return isset($this->definitions[$id]) || isset($this->aliasDefinitions[$id]) || isset($this->removedIds[$id]) ? $id : parent::normalizeId($id); @@ -1312,8 +1359,8 @@ public function removeBindings($id) { if ($this->hasDefinition($id)) { foreach ($this->getDefinition($id)->getBindings() as $key => $binding) { - list(, $bindingId) = $binding->getValues(); - $this->removedBindingIds[(int) $bindingId] = \true; + [, $bindingId] = $binding->getValues(); + $this->removedBindingIds[(int) $bindingId] = true; } } } @@ -1329,11 +1376,11 @@ public function removeBindings($id) public static function getServiceConditionals($value) { $services = []; - if (\is_array($value)) { + if (is_array($value)) { foreach ($value as $v) { - $services = \array_unique(\array_merge($services, self::getServiceConditionals($v))); + $services = array_unique(array_merge($services, self::getServiceConditionals($v))); } - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference && \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE === $value->getInvalidBehavior()) { + } elseif ($value instanceof Reference && ContainerInterface::IGNORE_ON_INVALID_REFERENCE === $value->getInvalidBehavior()) { $services[] = (string) $value; } return $services; @@ -1350,11 +1397,11 @@ public static function getServiceConditionals($value) public static function getInitializedConditionals($value) { $services = []; - if (\is_array($value)) { + if (is_array($value)) { foreach ($value as $v) { - $services = \array_unique(\array_merge($services, self::getInitializedConditionals($v))); + $services = array_unique(array_merge($services, self::getInitializedConditionals($v))); } - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference && \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $value->getInvalidBehavior()) { + } elseif ($value instanceof Reference && ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $value->getInvalidBehavior()) { $services[] = (string) $value; } return $services; @@ -1368,8 +1415,8 @@ public static function getInitializedConditionals($value) */ public static function hash($value) { - $hash = \substr(\base64_encode(\hash('sha256', \serialize($value), \true)), 0, 7); - return \str_replace(['/', '+'], ['.', '_'], \strtolower($hash)); + $hash = substr(base64_encode(hash('sha256', serialize($value), true)), 0, 7); + return str_replace(['/', '+'], ['.', '_'], strtolower($hash)); } /** * {@inheritdoc} @@ -1378,18 +1425,18 @@ protected function getEnv($name) { $value = parent::getEnv($name); $bag = $this->getParameterBag(); - if (!\is_string($value) || !$bag instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag) { + if (!is_string($value) || !$bag instanceof EnvPlaceholderParameterBag) { return $value; } foreach ($bag->getEnvPlaceholders() as $env => $placeholders) { if (isset($placeholders[$value])) { - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag($bag->all()); + $bag = new ParameterBag($bag->all()); return $bag->unescapeValue($bag->get("env({$name})")); } } - $this->resolving["env({$name})"] = \true; + $this->resolving["env({$name})"] = true; try { - return $bag->unescapeValue($this->resolveEnvPlaceholders($bag->escapeValue($value), \true)); + return $bag->unescapeValue($this->resolveEnvPlaceholders($bag->escapeValue($value), true)); } finally { unset($this->resolving["env({$name})"]); } @@ -1402,11 +1449,11 @@ private function callMethod($service, $call, array &$inlineServices) } } foreach (self::getInitializedConditionals($call[1]) as $s) { - if (!$this->doGet($s, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE, $inlineServices)) { + if (!$this->doGet($s, ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE, $inlineServices)) { return; } } - \call_user_func_array([$service, $call[0]], $this->doResolveServices($this->getParameterBag()->unescapeValue($this->getParameterBag()->resolveValue($call[1])), $inlineServices)); + call_user_func_array([$service, $call[0]], $this->doResolveServices($this->getParameterBag()->unescapeValue($this->getParameterBag()->resolveValue($call[1])), $inlineServices)); } /** * Shares a given service in the container. @@ -1414,9 +1461,9 @@ private function callMethod($service, $call, array &$inlineServices) * @param mixed $service * @param string|null $id */ - private function shareService(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition, $service, $id, array &$inlineServices) + private function shareService(Definition $definition, $service, $id, array &$inlineServices) { - $inlineServices[null !== $id ? $id : \spl_object_hash($definition)] = $service; + $inlineServices[null !== $id ? $id : spl_object_hash($definition)] = $service; if (null !== $id && $definition->isShared()) { $this->services[$id] = $service; unset($this->loading[$id]); @@ -1425,26 +1472,26 @@ private function shareService(\_PhpScoper5ea00cc67502b\Symfony\Component\Depende private function getExpressionLanguage() { if (null === $this->expressionLanguage) { - if (!\class_exists('_PhpScoper5ea00cc67502b\\Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage')) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.'); + if (!class_exists('_PhpScoper5ea00cc67502b\\Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage')) { + throw new RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.'); } - $this->expressionLanguage = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ExpressionLanguage(null, $this->expressionLanguageProviders); + $this->expressionLanguage = new ExpressionLanguage(null, $this->expressionLanguageProviders); } return $this->expressionLanguage; } private function inVendors($path) { if (null === $this->vendors) { - $resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ComposerResource(); + $resource = new ComposerResource(); $this->vendors = $resource->getVendors(); $this->addResource($resource); } - $path = \realpath($path) ?: $path; + $path = realpath($path) ?: $path; foreach ($this->vendors as $vendor) { - if (0 === \strpos($path, $vendor) && \false !== \strpbrk(\substr($path, \strlen($vendor), 1), '/' . \DIRECTORY_SEPARATOR)) { - return \true; + if (0 === strpos($path, $vendor) && false !== strpbrk(substr($path, strlen($vendor), 1), '/' . DIRECTORY_SEPARATOR)) { + return true; } } - return \false; + return false; } } diff --git a/vendor/symfony/dependency-injection/ContainerInterface.php b/vendor/symfony/dependency-injection/ContainerInterface.php index ce8ca9aad..91063867d 100644 --- a/vendor/symfony/dependency-injection/ContainerInterface.php +++ b/vendor/symfony/dependency-injection/ContainerInterface.php @@ -20,7 +20,7 @@ * @author Fabien Potencier * @author Johannes M. Schmitt */ -interface ContainerInterface extends \_PhpScoper5ea00cc67502b\Psr\Container\ContainerInterface +interface ContainerInterface extends PsrContainerInterface { const EXCEPTION_ON_INVALID_REFERENCE = 1; const NULL_ON_INVALID_REFERENCE = 2; diff --git a/vendor/symfony/dependency-injection/Definition.php b/vendor/symfony/dependency-injection/Definition.php index 818c2d4e3..a200a8572 100644 --- a/vendor/symfony/dependency-injection/Definition.php +++ b/vendor/symfony/dependency-injection/Definition.php @@ -13,6 +13,21 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\BoundArgument; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\OutOfBoundsException; +use function array_key_exists; +use function array_keys; +use function count; +use function explode; +use function func_get_arg; +use function func_num_args; +use function is_int; +use function is_string; +use function preg_match; +use function sprintf; +use function str_replace; +use function strpos; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * Definition represents a service definition. * @@ -23,22 +38,22 @@ class Definition private $class; private $file; private $factory; - private $shared = \true; - private $deprecated = \false; + private $shared = true; + private $deprecated = false; private $deprecationTemplate; private $properties = []; private $calls = []; private $instanceof = []; - private $autoconfigured = \false; + private $autoconfigured = false; private $configurator; private $tags = []; - private $public = \true; - private $private = \true; - private $synthetic = \false; - private $abstract = \false; - private $lazy = \false; + private $public = true; + private $private = true; + private $synthetic = false; + private $abstract = false; + private $lazy = false; private $decoratedService; - private $autowired = \false; + private $autowired = false; private $autowiringTypes = []; private $changes = []; private $bindings = []; @@ -86,9 +101,9 @@ public function setChanges(array $changes) */ public function setFactory($factory) { - $this->changes['factory'] = \true; - if (\is_string($factory) && \false !== \strpos($factory, '::')) { - $factory = \explode('::', $factory, 2); + $this->changes['factory'] = true; + if (is_string($factory) && false !== strpos($factory, '::')) { + $factory = explode('::', $factory, 2); } $this->factory = $factory; return $this; @@ -116,9 +131,9 @@ public function getFactory() public function setDecoratedService($id, $renamedId = null, $priority = 0) { if ($renamedId && $id === $renamedId) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The decorated service inner name for "%s" must be different than the service name itself.', $id)); + throw new InvalidArgumentException(sprintf('The decorated service inner name for "%s" must be different than the service name itself.', $id)); } - $this->changes['decorated_service'] = \true; + $this->changes['decorated_service'] = true; if (null === $id) { $this->decoratedService = null; } else { @@ -144,7 +159,7 @@ public function getDecoratedService() */ public function setClass($class) { - $this->changes['class'] = \true; + $this->changes['class'] = true; $this->class = $class; return $this; } @@ -223,14 +238,14 @@ public function addArgument($argument) */ public function replaceArgument($index, $argument) { - if (0 === \count($this->arguments)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\OutOfBoundsException('Cannot replace arguments if none have been configured yet.'); + if (0 === count($this->arguments)) { + throw new OutOfBoundsException('Cannot replace arguments if none have been configured yet.'); } - if (\is_int($index) && ($index < 0 || $index > \count($this->arguments) - 1)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\OutOfBoundsException(\sprintf('The index "%d" is not in the range [0, %d].', $index, \count($this->arguments) - 1)); + if (is_int($index) && ($index < 0 || $index > count($this->arguments) - 1)) { + throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d].', $index, count($this->arguments) - 1)); } - if (!\array_key_exists($index, $this->arguments)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\OutOfBoundsException(\sprintf('The argument "%s" doesn\'t exist.', $index)); + if (!array_key_exists($index, $this->arguments)) { + throw new OutOfBoundsException(sprintf('The argument "%s" doesn\'t exist.', $index)); } $this->arguments[$index] = $argument; return $this; @@ -268,8 +283,8 @@ public function getArguments() */ public function getArgument($index) { - if (!\array_key_exists($index, $this->arguments)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\OutOfBoundsException(\sprintf('The argument "%s" doesn\'t exist.', $index)); + if (!array_key_exists($index, $this->arguments)) { + throw new OutOfBoundsException(sprintf('The argument "%s" doesn\'t exist.', $index)); } return $this->arguments[$index]; } @@ -299,7 +314,7 @@ public function setMethodCalls(array $calls = []) public function addMethodCall($method, array $arguments = []) { if (empty($method)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException('Method name cannot be empty.'); + throw new InvalidArgumentException('Method name cannot be empty.'); } $this->calls[] = [$method, $arguments]; return $this; @@ -332,10 +347,10 @@ public function hasMethodCall($method) { foreach ($this->calls as $call) { if ($call[0] === $method) { - return \true; + return true; } } - return \false; + return false; } /** * Gets the methods to call after service initialization. @@ -376,7 +391,7 @@ public function getInstanceofConditionals() */ public function setAutoconfigured($autoconfigured) { - $this->changes['autoconfigured'] = \true; + $this->changes['autoconfigured'] = true; $this->autoconfigured = $autoconfigured; return $this; } @@ -472,7 +487,7 @@ public function clearTags() */ public function setFile($file) { - $this->changes['file'] = \true; + $this->changes['file'] = true; $this->file = $file; return $this; } @@ -494,7 +509,7 @@ public function getFile() */ public function setShared($shared) { - $this->changes['shared'] = \true; + $this->changes['shared'] = true; $this->shared = (bool) $shared; return $this; } @@ -516,9 +531,9 @@ public function isShared() */ public function setPublic($boolean) { - $this->changes['public'] = \true; + $this->changes['public'] = true; $this->public = (bool) $boolean; - $this->private = \false; + $this->private = false; return $this; } /** @@ -565,7 +580,7 @@ public function isPrivate() */ public function setLazy($lazy) { - $this->changes['lazy'] = \true; + $this->changes['lazy'] = true; $this->lazy = (bool) $lazy; return $this; } @@ -635,18 +650,18 @@ public function isAbstract() * * @throws InvalidArgumentException when the message template is invalid */ - public function setDeprecated($status = \true, $template = null) + public function setDeprecated($status = true, $template = null) { if (null !== $template) { - if (\preg_match('#[\\r\\n]|\\*/#', $template)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException('Invalid characters found in deprecation template.'); + if (preg_match('#[\\r\\n]|\\*/#', $template)) { + throw new InvalidArgumentException('Invalid characters found in deprecation template.'); } - if (\false === \strpos($template, '%service_id%')) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException('The deprecation template must contain the "%service_id%" placeholder.'); + if (false === strpos($template, '%service_id%')) { + throw new InvalidArgumentException('The deprecation template must contain the "%service_id%" placeholder.'); } $this->deprecationTemplate = $template; } - $this->changes['deprecated'] = \true; + $this->changes['deprecated'] = true; $this->deprecated = (bool) $status; return $this; } @@ -669,7 +684,7 @@ public function isDeprecated() */ public function getDeprecationMessage($id) { - return \str_replace('%service_id%', $id, $this->deprecationTemplate ?: self::$defaultDeprecationTemplate); + return str_replace('%service_id%', $id, $this->deprecationTemplate ?: self::$defaultDeprecationTemplate); } /** * Sets a configurator to call after the service is fully initialized. @@ -680,9 +695,9 @@ public function getDeprecationMessage($id) */ public function setConfigurator($configurator) { - $this->changes['configurator'] = \true; - if (\is_string($configurator) && \false !== \strpos($configurator, '::')) { - $configurator = \explode('::', $configurator, 2); + $this->changes['configurator'] = true; + if (is_string($configurator) && false !== strpos($configurator, '::')) { + $configurator = explode('::', $configurator, 2); } $this->configurator = $configurator; return $this; @@ -707,10 +722,10 @@ public function getConfigurator() */ public function setAutowiringTypes(array $types) { - @\trigger_error('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead.', \E_USER_DEPRECATED); + @trigger_error('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead.', E_USER_DEPRECATED); $this->autowiringTypes = []; foreach ($types as $type) { - $this->autowiringTypes[$type] = \true; + $this->autowiringTypes[$type] = true; } return $this; } @@ -732,7 +747,7 @@ public function isAutowired() */ public function setAutowired($autowired) { - $this->changes['autowired'] = \true; + $this->changes['autowired'] = true; $this->autowired = (bool) $autowired; return $this; } @@ -745,10 +760,10 @@ public function setAutowired($autowired) */ public function getAutowiringTypes() { - if (1 > \func_num_args() || \func_get_arg(0)) { - @\trigger_error('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead.', \E_USER_DEPRECATED); + if (1 > func_num_args() || func_get_arg(0)) { + @trigger_error('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead.', E_USER_DEPRECATED); } - return \array_keys($this->autowiringTypes); + return array_keys($this->autowiringTypes); } /** * Adds a type that will default to this definition. @@ -761,8 +776,8 @@ public function getAutowiringTypes() */ public function addAutowiringType($type) { - @\trigger_error(\sprintf('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead for "%s".', $type), \E_USER_DEPRECATED); - $this->autowiringTypes[$type] = \true; + @trigger_error(sprintf('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead for "%s".', $type), E_USER_DEPRECATED); + $this->autowiringTypes[$type] = true; return $this; } /** @@ -776,7 +791,7 @@ public function addAutowiringType($type) */ public function removeAutowiringType($type) { - @\trigger_error(\sprintf('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead for "%s".', $type), \E_USER_DEPRECATED); + @trigger_error(sprintf('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead for "%s".', $type), E_USER_DEPRECATED); unset($this->autowiringTypes[$type]); return $this; } @@ -791,7 +806,7 @@ public function removeAutowiringType($type) */ public function hasAutowiringType($type) { - @\trigger_error(\sprintf('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead for "%s".', $type), \E_USER_DEPRECATED); + @trigger_error(sprintf('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead for "%s".', $type), E_USER_DEPRECATED); return isset($this->autowiringTypes[$type]); } /** @@ -815,8 +830,8 @@ public function getBindings() public function setBindings(array $bindings) { foreach ($bindings as $key => $binding) { - if (!$binding instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\BoundArgument) { - $bindings[$key] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\BoundArgument($binding); + if (!$binding instanceof BoundArgument) { + $bindings[$key] = new BoundArgument($binding); } } $this->bindings = $bindings; diff --git a/vendor/symfony/dependency-injection/DefinitionDecorator.php b/vendor/symfony/dependency-injection/DefinitionDecorator.php index 4bd94620a..759560c1b 100644 --- a/vendor/symfony/dependency-injection/DefinitionDecorator.php +++ b/vendor/symfony/dependency-injection/DefinitionDecorator.php @@ -10,9 +10,13 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection; -@\trigger_error('The ' . __NAMESPACE__ . '\\DefinitionDecorator class is deprecated since Symfony 3.3 and will be removed in 4.0. Use the Symfony\\Component\\DependencyInjection\\ChildDefinition class instead.', \E_USER_DEPRECATED); -\class_exists(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition::class); -if (\false) { +use function class_exists; +use function trigger_error; +use const E_USER_DEPRECATED; + +@trigger_error('The ' . __NAMESPACE__ . '\\DefinitionDecorator class is deprecated since Symfony 3.3 and will be removed in 4.0. Use the Symfony\\Component\\DependencyInjection\\ChildDefinition class instead.', E_USER_DEPRECATED); +class_exists(ChildDefinition::class); +if (false) { /** * This definition decorates another definition. * @@ -20,7 +24,7 @@ * * @deprecated The DefinitionDecorator class is deprecated since version 3.3 and will be removed in 4.0. Use the Symfony\Component\DependencyInjection\ChildDefinition class instead. */ - class DefinitionDecorator extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition + class DefinitionDecorator extends Definition { } } diff --git a/vendor/symfony/dependency-injection/Dumper/Dumper.php b/vendor/symfony/dependency-injection/Dumper/Dumper.php index 038f69eb0..49eb3cdb8 100644 --- a/vendor/symfony/dependency-injection/Dumper/Dumper.php +++ b/vendor/symfony/dependency-injection/Dumper/Dumper.php @@ -16,10 +16,10 @@ * * @author Fabien Potencier */ -abstract class Dumper implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\DumperInterface +abstract class Dumper implements DumperInterface { protected $container; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function __construct(ContainerBuilder $container) { $this->container = $container; } diff --git a/vendor/symfony/dependency-injection/Dumper/GraphvizDumper.php b/vendor/symfony/dependency-injection/Dumper/GraphvizDumper.php index cad585f96..e22053325 100644 --- a/vendor/symfony/dependency-injection/Dumper/GraphvizDumper.php +++ b/vendor/symfony/dependency-injection/Dumper/GraphvizDumper.php @@ -17,6 +17,19 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Parameter; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; +use function array_key_exists; +use function array_merge; +use function get_class; +use function implode; +use function is_array; +use function is_string; +use function preg_match; +use function preg_replace; +use function sprintf; +use function str_replace; +use function strtolower; +use function substr; + /** * GraphvizDumper dumps a service container as a graphviz file. * @@ -26,7 +39,7 @@ * * @author Fabien Potencier */ -class GraphvizDumper extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\Dumper +class GraphvizDumper extends Dumper { private $nodes; private $edges; @@ -50,15 +63,15 @@ public function dump(array $options = []) { foreach (['graph', 'node', 'edge', 'node.instance', 'node.definition', 'node.missing'] as $key) { if (isset($options[$key])) { - $this->options[$key] = \array_merge($this->options[$key], $options[$key]); + $this->options[$key] = array_merge($this->options[$key], $options[$key]); } } $this->nodes = $this->findNodes(); $this->edges = []; foreach ($this->container->getDefinitions() as $id => $definition) { - $this->edges[$id] = \array_merge($this->findEdges($id, $definition->getArguments(), \true, ''), $this->findEdges($id, $definition->getProperties(), \false, '')); + $this->edges[$id] = array_merge($this->findEdges($id, $definition->getArguments(), true, ''), $this->findEdges($id, $definition->getProperties(), false, '')); foreach ($definition->getMethodCalls() as $call) { - $this->edges[$id] = \array_merge($this->edges[$id], $this->findEdges($id, $call[1], \false, $call[0] . '()')); + $this->edges[$id] = array_merge($this->edges[$id], $this->findEdges($id, $call[1], false, $call[0] . '()')); } } return $this->container->resolveEnvPlaceholders($this->startDot() . $this->addNodes() . $this->addEdges() . $this->endDot(), '__ENV_%s__'); @@ -73,7 +86,7 @@ private function addNodes() $code = ''; foreach ($this->nodes as $id => $node) { $aliases = $this->getAliases($id); - $code .= \sprintf(" node_%s [label=\"%s\\n%s\\n\", shape=%s%s];\n", $this->dotize($id), $id . ($aliases ? ' (' . \implode(', ', $aliases) . ')' : ''), $node['class'], $this->options['node']['shape'], $this->addAttributes($node['attributes'])); + $code .= sprintf(" node_%s [label=\"%s\\n%s\\n\", shape=%s%s];\n", $this->dotize($id), $id . ($aliases ? ' (' . implode(', ', $aliases) . ')' : ''), $node['class'], $this->options['node']['shape'], $this->addAttributes($node['attributes'])); } return $code; } @@ -87,7 +100,7 @@ private function addEdges() $code = ''; foreach ($this->edges as $id => $edges) { foreach ($edges as $edge) { - $code .= \sprintf(" node_%s -> node_%s [label=\"%s\" style=\"%s\"%s];\n", $this->dotize($id), $this->dotize($edge['to']), $edge['name'], $edge['required'] ? 'filled' : 'dashed', $edge['lazy'] ? ' color="#9999ff"' : ''); + $code .= sprintf(" node_%s -> node_%s [label=\"%s\" style=\"%s\"%s];\n", $this->dotize($id), $this->dotize($edge['to']), $edge['name'], $edge['required'] ? 'filled' : 'dashed', $edge['lazy'] ? ' color="#9999ff"' : ''); } } return $code; @@ -102,16 +115,16 @@ private function addEdges() * * @return array An array of edges */ - private function findEdges($id, array $arguments, $required, $name, $lazy = \false) + private function findEdges($id, array $arguments, $required, $name, $lazy = false) { $edges = []; foreach ($arguments as $argument) { - if ($argument instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Parameter) { + if ($argument instanceof Parameter) { $argument = $this->container->hasParameter($argument) ? $this->container->getParameter($argument) : null; - } elseif (\is_string($argument) && \preg_match('/^%([^%]+)%$/', $argument, $match)) { + } elseif (is_string($argument) && preg_match('/^%([^%]+)%$/', $argument, $match)) { $argument = $this->container->hasParameter($match[1]) ? $this->container->getParameter($match[1]) : null; } - if ($argument instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference) { + if ($argument instanceof Reference) { $lazyEdge = $lazy; if (!$this->container->has((string) $argument)) { $this->nodes[(string) $argument] = ['name' => $name, 'required' => $required, 'class' => '', 'attributes' => $this->options['node.missing']]; @@ -119,15 +132,15 @@ private function findEdges($id, array $arguments, $required, $name, $lazy = \fal $lazyEdge = $lazy || $this->container->getDefinition((string) $argument)->isLazy(); } $edges[] = ['name' => $name, 'required' => $required, 'to' => $argument, 'lazy' => $lazyEdge]; - } elseif ($argument instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ArgumentInterface) { - $edges = \array_merge($edges, $this->findEdges($id, $argument->getValues(), $required, $name, \true)); - } elseif ($argument instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition) { - $edges = \array_merge($edges, $this->findEdges($id, $argument->getArguments(), $required, ''), $this->findEdges($id, $argument->getProperties(), \false, '')); + } elseif ($argument instanceof ArgumentInterface) { + $edges = array_merge($edges, $this->findEdges($id, $argument->getValues(), $required, $name, true)); + } elseif ($argument instanceof Definition) { + $edges = array_merge($edges, $this->findEdges($id, $argument->getArguments(), $required, ''), $this->findEdges($id, $argument->getProperties(), false, '')); foreach ($argument->getMethodCalls() as $call) { - $edges = \array_merge($edges, $this->findEdges($id, $call[1], \false, $call[0] . '()')); + $edges = array_merge($edges, $this->findEdges($id, $call[1], false, $call[0] . '()')); } - } elseif (\is_array($argument)) { - $edges = \array_merge($edges, $this->findEdges($id, $argument, $required, $name, $lazy)); + } elseif (is_array($argument)) { + $edges = array_merge($edges, $this->findEdges($id, $argument, $required, $name, $lazy)); } } return $edges; @@ -143,30 +156,30 @@ private function findNodes() $container = $this->cloneContainer(); foreach ($container->getDefinitions() as $id => $definition) { $class = $definition->getClass(); - if ('\\' === \substr($class, 0, 1)) { - $class = \substr($class, 1); + if ('\\' === substr($class, 0, 1)) { + $class = substr($class, 1); } try { $class = $this->container->getParameterBag()->resolveValue($class); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException $e) { + } catch (ParameterNotFoundException $e) { } - $nodes[$id] = ['class' => \str_replace('\\', '\\\\', $class), 'attributes' => \array_merge($this->options['node.definition'], ['style' => $definition->isShared() ? 'filled' : 'dotted'])]; - $container->setDefinition($id, new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass')); + $nodes[$id] = ['class' => str_replace('\\', '\\\\', $class), 'attributes' => array_merge($this->options['node.definition'], ['style' => $definition->isShared() ? 'filled' : 'dotted'])]; + $container->setDefinition($id, new Definition('stdClass')); } foreach ($container->getServiceIds() as $id) { - if (\array_key_exists($id, $container->getAliases())) { + if (array_key_exists($id, $container->getAliases())) { continue; } if (!$container->hasDefinition($id)) { - $nodes[$id] = ['class' => \str_replace('\\', '\\\\', \get_class($container->get($id))), 'attributes' => $this->options['node.instance']]; + $nodes[$id] = ['class' => str_replace('\\', '\\\\', get_class($container->get($id))), 'attributes' => $this->options['node.instance']]; } } return $nodes; } private function cloneContainer() { - $parameterBag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag($this->container->getParameterBag()->all()); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder($parameterBag); + $parameterBag = new ParameterBag($this->container->getParameterBag()->all()); + $container = new ContainerBuilder($parameterBag); $container->setDefinitions($this->container->getDefinitions()); $container->setAliases($this->container->getAliases()); $container->setResources($this->container->getResources()); @@ -182,7 +195,7 @@ private function cloneContainer() */ private function startDot() { - return \sprintf("digraph sc {\n %s\n node [%s];\n edge [%s];\n\n", $this->addOptions($this->options['graph']), $this->addOptions($this->options['node']), $this->addOptions($this->options['edge'])); + return sprintf("digraph sc {\n %s\n node [%s];\n edge [%s];\n\n", $this->addOptions($this->options['graph']), $this->addOptions($this->options['node']), $this->addOptions($this->options['edge'])); } /** * Returns the end dot. @@ -204,9 +217,9 @@ private function addAttributes(array $attributes) { $code = []; foreach ($attributes as $k => $v) { - $code[] = \sprintf('%s="%s"', $k, $v); + $code[] = sprintf('%s="%s"', $k, $v); } - return $code ? ', ' . \implode(', ', $code) : ''; + return $code ? ', ' . implode(', ', $code) : ''; } /** * Adds options. @@ -219,9 +232,9 @@ private function addOptions(array $options) { $code = []; foreach ($options as $k => $v) { - $code[] = \sprintf('%s="%s"', $k, $v); + $code[] = sprintf('%s="%s"', $k, $v); } - return \implode(' ', $code); + return implode(' ', $code); } /** * Dotizes an identifier. @@ -232,7 +245,7 @@ private function addOptions(array $options) */ private function dotize($id) { - return \strtolower(\preg_replace('/\\W/i', '_', $id)); + return strtolower(preg_replace('/\\W/i', '_', $id)); } /** * Compiles an array of aliases for a specified service id. diff --git a/vendor/symfony/dependency-injection/Dumper/PhpDumper.php b/vendor/symfony/dependency-injection/Dumper/PhpDumper.php index da5f392e3..33a471c78 100644 --- a/vendor/symfony/dependency-injection/Dumper/PhpDumper.php +++ b/vendor/symfony/dependency-injection/Dumper/PhpDumper.php @@ -32,13 +32,71 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Variable; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression; use _PhpScoper5ea00cc67502b\Symfony\Component\HttpKernel\Kernel; +use SplObjectStorage; +use function array_combine; +use function array_diff_key; +use function array_fill; +use function array_filter; +use function array_flip; +use function array_keys; +use function array_map; +use function array_merge; +use function array_pop; +use function array_reverse; +use function array_search; +use function class_exists; +use function count; +use function dirname; +use function end; +use function explode; +use function get_class; +use function hash; +use function implode; +use function in_array; +use function is_array; +use function is_dir; +use function is_object; +use function is_resource; +use function is_scalar; +use function is_string; +use function key; +use function ksort; +use function ltrim; +use function method_exists; +use function min; +use function preg_match; +use function preg_quote; +use function preg_replace; +use function preg_replace_callback; +use function realpath; +use function rtrim; +use function sort; +use function sprintf; +use function str_repeat; +use function str_replace; +use function stripcslashes; +use function strlen; +use function strpos; +use function strrpos; +use function strtolower; +use function strtr; +use function substr; +use function substr_replace; +use function time; +use function trigger_error; +use function ucfirst; +use function var_export; +use const DIRECTORY_SEPARATOR; +use const E_USER_DEPRECATED; +use const PREG_OFFSET_CAPTURE; + /** * PhpDumper dumps a service container as a PHP class. * * @author Fabien Potencier * @author Johannes M. Schmitt */ -class PhpDumper extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\Dumper +class PhpDumper extends Dumper { /** * Characters that might appear in the generated variable name as first character. @@ -73,17 +131,17 @@ class PhpDumper extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInj /** * {@inheritdoc} */ - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function __construct(ContainerBuilder $container) { if (!$container->isCompiled()) { - @\trigger_error('Dumping an uncompiled ContainerBuilder is deprecated since Symfony 3.3 and will not be supported anymore in 4.0. Compile the container beforehand.', \E_USER_DEPRECATED); + @trigger_error('Dumping an uncompiled ContainerBuilder is deprecated since Symfony 3.3 and will not be supported anymore in 4.0. Compile the container beforehand.', E_USER_DEPRECATED); } parent::__construct($container); } /** * Sets the dumper to be used when dumping proxies in the generated container. */ - public function setProxyDumper(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface $proxyDumper) + public function setProxyDumper(ProxyDumper $proxyDumper) { $this->proxyDumper = $proxyDumper; } @@ -105,36 +163,36 @@ public function dump(array $options = []) { $this->targetDirRegex = null; $this->inlinedRequires = []; - $options = \array_merge(['class' => 'ProjectServiceContainer', 'base_class' => 'Container', 'namespace' => '', 'as_files' => \false, 'debug' => \true, 'hot_path_tag' => 'container.hot_path', 'inline_class_loader_parameter' => 'container.dumper.inline_class_loader', 'build_time' => \time()], $options); + $options = array_merge(['class' => 'ProjectServiceContainer', 'base_class' => 'Container', 'namespace' => '', 'as_files' => false, 'debug' => true, 'hot_path_tag' => 'container.hot_path', 'inline_class_loader_parameter' => 'container.dumper.inline_class_loader', 'build_time' => time()], $options); $this->namespace = $options['namespace']; $this->asFiles = $options['as_files']; $this->hotPathTag = $options['hot_path_tag']; $this->inlineRequires = $options['inline_class_loader_parameter'] && $this->container->hasParameter($options['inline_class_loader_parameter']) && $this->container->getParameter($options['inline_class_loader_parameter']); - if (0 !== \strpos($baseClass = $options['base_class'], '\\') && 'Container' !== $baseClass) { - $baseClass = \sprintf('%s\\%s', $options['namespace'] ? '\\' . $options['namespace'] : '', $baseClass); + if (0 !== strpos($baseClass = $options['base_class'], '\\') && 'Container' !== $baseClass) { + $baseClass = sprintf('%s\\%s', $options['namespace'] ? '\\' . $options['namespace'] : '', $baseClass); $baseClassWithNamespace = $baseClass; } elseif ('Container' === $baseClass) { - $baseClassWithNamespace = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container::class; + $baseClassWithNamespace = Container::class; } else { $baseClassWithNamespace = $baseClass; } - $this->initializeMethodNamesMap('Container' === $baseClass ? \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container::class : $baseClass); - if ($this->getProxyDumper() instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\NullDumper) { - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass(\true, \false))->process($this->container); + $this->initializeMethodNamesMap('Container' === $baseClass ? Container::class : $baseClass); + if ($this->getProxyDumper() instanceof NullDumper) { + (new AnalyzeServiceReferencesPass(true, false))->process($this->container); try { - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CheckCircularReferencesPass())->process($this->container); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException $e) { + (new CheckCircularReferencesPass())->process($this->container); + } catch (ServiceCircularReferenceException $e) { $path = $e->getPath(); - \end($path); - $path[\key($path)] .= '". Try running "composer require symfony/proxy-manager-bridge'; - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException($e->getServiceId(), $path); + end($path); + $path[key($path)] .= '". Try running "composer require symfony/proxy-manager-bridge'; + throw new ServiceCircularReferenceException($e->getServiceId(), $path); } } - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass(\false, !$this->getProxyDumper() instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\NullDumper))->process($this->container); + (new AnalyzeServiceReferencesPass(false, !$this->getProxyDumper() instanceof NullDumper))->process($this->container); $checkedNodes = []; $this->circularReferences = []; foreach ($this->container->getCompiler()->getServiceReferenceGraph()->getNodes() as $id => $node) { - if (!$node->getValue() instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition) { + if (!$node->getValue() instanceof Definition) { continue; } if (!isset($checkedNodes[$id])) { @@ -144,23 +202,23 @@ public function dump(array $options = []) $this->container->getCompiler()->getServiceReferenceGraph()->clear(); $checkedNodes = []; $this->docStar = $options['debug'] ? '*' : ''; - if (!empty($options['file']) && \is_dir($dir = \dirname($options['file']))) { + if (!empty($options['file']) && is_dir($dir = dirname($options['file']))) { // Build a regexp where the first root dirs are mandatory, // but every other sub-dir is optional up to the full path in $dir // Mandate at least 1 root dir and not more than 5 optional dirs. - $dir = \explode(\DIRECTORY_SEPARATOR, \realpath($dir)); - $i = \count($dir); - if (2 + (int) ('\\' === \DIRECTORY_SEPARATOR) <= $i) { + $dir = explode(DIRECTORY_SEPARATOR, realpath($dir)); + $i = count($dir); + if (2 + (int) ('\\' === DIRECTORY_SEPARATOR) <= $i) { $regex = ''; - $lastOptionalDir = $i > 8 ? $i - 5 : 2 + (int) ('\\' === \DIRECTORY_SEPARATOR); + $lastOptionalDir = $i > 8 ? $i - 5 : 2 + (int) ('\\' === DIRECTORY_SEPARATOR); $this->targetDirMaxMatches = $i - $lastOptionalDir; while (--$i >= $lastOptionalDir) { - $regex = \sprintf('(%s%s)?', \preg_quote(\DIRECTORY_SEPARATOR . $dir[$i], '#'), $regex); + $regex = sprintf('(%s%s)?', preg_quote(DIRECTORY_SEPARATOR . $dir[$i], '#'), $regex); } do { - $regex = \preg_quote(\DIRECTORY_SEPARATOR . $dir[$i], '#') . $regex; + $regex = preg_quote(DIRECTORY_SEPARATOR . $dir[$i], '#') . $regex; } while (0 < --$i); - $this->targetDirRegex = '#' . \preg_quote($dir[0], '#') . $regex . '#'; + $this->targetDirRegex = '#' . preg_quote($dir[0], '#') . $regex . '#'; } } $code = $this->startClass($options['class'], $baseClass, $baseClassWithNamespace) . $this->addServices() . $this->addDefaultParametersMethod() . $this->endClass(); @@ -174,8 +232,8 @@ public function dump(array $options = []) EOF; $files = []; - if ($ids = \array_keys($this->container->getRemovedIds())) { - \sort($ids); + if ($ids = array_keys($this->container->getRemovedIds())) { + sort($ids); $c = "doExport($id) . " => true,\n"; @@ -189,16 +247,16 @@ public function dump(array $options = []) $files[$file] = " $c) { $code["Container{$hash}/{$file}"] = $c; } - \array_pop($code); - $code["Container{$hash}/{$options['class']}.php"] = \substr_replace($files[$options['class'] . '.php'], "namespace ? "\nnamespace {$this->namespace};\n" : ''; $time = $options['build_time']; - $id = \hash('crc32', $hash . $time); + $id = hash('crc32', $hash . $time); $code[$options['class'] . '.php'] = <<proxyDumper) { - $this->proxyDumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\NullDumper(); + $this->proxyDumper = new NullDumper(); } return $this->proxyDumper; } - private function analyzeCircularReferences($sourceId, array $edges, &$checkedNodes, &$currentPath = [], $byConstructor = \true) + private function analyzeCircularReferences($sourceId, array $edges, &$checkedNodes, &$currentPath = [], $byConstructor = true) { - $checkedNodes[$sourceId] = \true; + $checkedNodes[$sourceId] = true; $currentPath[$sourceId] = $byConstructor; foreach ($edges as $edge) { $node = $edge->getDestNode(); $id = $node->getId(); - if (!$node->getValue() instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition || $sourceId === $id || $edge->isLazy() || $edge->isWeak()) { + if (!$node->getValue() instanceof Definition || $sourceId === $id || $edge->isLazy() || $edge->isWeak()) { // no-op } elseif (isset($currentPath[$id])) { $this->addCircularReferences($id, $currentPath, $edge->isReferencedByConstructor()); @@ -289,7 +347,7 @@ private function addCircularReferences($id, $currentPath, $byConstructor) { $currentPath[$id] = $byConstructor; $circularRefs = []; - foreach (\array_reverse($currentPath) as $parentId => $v) { + foreach (array_reverse($currentPath) as $parentId => $v) { $byConstructor = $byConstructor && $v; $circularRefs[] = $parentId; if ($parentId === $id) { @@ -309,7 +367,7 @@ private function collectLineage($class, array &$lineage) if (isset($lineage[$class])) { return; } - if (!($r = $this->container->getReflectionClass($class, \false))) { + if (!($r = $this->container->getReflectionClass($class, false))) { return; } if ($this->container instanceof $class) { @@ -328,15 +386,15 @@ private function collectLineage($class, array &$lineage) foreach ($r->getTraits() as $parent) { $this->collectLineage($parent->name, $lineage); } - $lineage[$class] = \substr($exportedFile, 1, -1); + $lineage[$class] = substr($exportedFile, 1, -1); } private function generateProxyClasses() { $alreadyGenerated = []; $definitions = $this->container->getDefinitions(); - $strip = '' === $this->docStar && \method_exists('_PhpScoper5ea00cc67502b\\Symfony\\Component\\HttpKernel\\Kernel', 'stripComments'); + $strip = '' === $this->docStar && method_exists('_PhpScoper5ea00cc67502b\\Symfony\\Component\\HttpKernel\\Kernel', 'stripComments'); $proxyDumper = $this->getProxyDumper(); - \ksort($definitions); + ksort($definitions); foreach ($definitions as $definition) { if (!$proxyDumper->isProxyCandidate($definition)) { continue; @@ -344,7 +402,7 @@ private function generateProxyClasses() if (isset($alreadyGenerated[$class = $definition->getClass()])) { continue; } - $alreadyGenerated[$class] = \true; + $alreadyGenerated[$class] = true; // register class' reflector for resource tracking $this->container->getReflectionClass($class); if ("\n" === ($proxyCode = "\n" . $proxyDumper->getProxyCode($definition))) { @@ -352,9 +410,9 @@ private function generateProxyClasses() } if ($strip) { $proxyCode = " $proxyCode); + (yield sprintf('%s.php', explode(' ', $proxyCode, 3)[1]) => $proxyCode); } } /** @@ -362,28 +420,28 @@ private function generateProxyClasses() * * @return string */ - private function addServiceInclude($cId, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition) + private function addServiceInclude($cId, Definition $definition) { $code = ''; if ($this->inlineRequires && !$this->isHotPath($definition)) { $lineage = []; foreach ($this->inlinedDefinitions as $def) { - if (!$def->isDeprecated() && \is_string($class = \is_array($factory = $def->getFactory()) && \is_string($factory[0]) ? $factory[0] : $def->getClass())) { + if (!$def->isDeprecated() && is_string($class = is_array($factory = $def->getFactory()) && is_string($factory[0]) ? $factory[0] : $def->getClass())) { $this->collectLineage($class, $lineage); } } - foreach ($this->serviceCalls as $id => list($callCount, $behavior)) { - if ('service_container' !== $id && $id !== $cId && \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE !== $behavior && $this->container->has($id) && $this->isTrivialInstance($def = $this->container->findDefinition($id)) && \is_string($class = \is_array($factory = $def->getFactory()) && \is_string($factory[0]) ? $factory[0] : $def->getClass())) { + foreach ($this->serviceCalls as $id => [$callCount, $behavior]) { + if ('service_container' !== $id && $id !== $cId && ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE !== $behavior && $this->container->has($id) && $this->isTrivialInstance($def = $this->container->findDefinition($id)) && is_string($class = is_array($factory = $def->getFactory()) && is_string($factory[0]) ? $factory[0] : $def->getClass())) { $this->collectLineage($class, $lineage); } } - foreach (\array_diff_key(\array_flip($lineage), $this->inlinedRequires) as $file => $class) { - $code .= \sprintf(" include_once %s;\n", $file); + foreach (array_diff_key(array_flip($lineage), $this->inlinedRequires) as $file => $class) { + $code .= sprintf(" include_once %s;\n", $file); } } foreach ($this->inlinedDefinitions as $def) { if ($file = $def->getFile()) { - $code .= \sprintf(" include_once %s;\n", $this->dumpValue($file)); + $code .= sprintf(" include_once %s;\n", $this->dumpValue($file)); } } if ('' !== $code) { @@ -402,16 +460,16 @@ private function addServiceInclude($cId, \_PhpScoper5ea00cc67502b\Symfony\Compon * @throws InvalidArgumentException * @throws RuntimeException */ - private function addServiceInstance($id, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition, $isSimpleInstance) + private function addServiceInstance($id, Definition $definition, $isSimpleInstance) { $class = $this->dumpValue($definition->getClass()); - if (0 === \strpos($class, "'") && \false === \strpos($class, '$') && !\preg_match('/^\'(?:\\\\{2})?[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*(?:\\\\{2}[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)*\'$/', $class)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('"%s" is not a valid class name for the "%s" service.', $class, $id)); + if (0 === strpos($class, "'") && false === strpos($class, '$') && !preg_match('/^\'(?:\\\\{2})?[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*(?:\\\\{2}[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)*\'$/', $class)) { + throw new InvalidArgumentException(sprintf('"%s" is not a valid class name for the "%s" service.', $class, $id)); } $isProxyCandidate = $this->getProxyDumper()->isProxyCandidate($definition); $instantiation = ''; if (!$isProxyCandidate && $definition->isShared()) { - $instantiation = \sprintf('$this->services[%s] = %s', $this->doExport($id), $isSimpleInstance ? '' : '$instance'); + $instantiation = sprintf('$this->services[%s] = %s', $this->doExport($id), $isSimpleInstance ? '' : '$instance'); } elseif (!$isSimpleInstance) { $instantiation = '$instance'; } @@ -428,40 +486,40 @@ private function addServiceInstance($id, \_PhpScoper5ea00cc67502b\Symfony\Compon * * @return bool */ - private function isTrivialInstance(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition) + private function isTrivialInstance(Definition $definition) { if ($definition->isSynthetic() || $definition->getFile() || $definition->getMethodCalls() || $definition->getProperties() || $definition->getConfigurator()) { - return \false; + return false; } - if ($definition->isDeprecated() || $definition->isLazy() || $definition->getFactory() || 3 < \count($definition->getArguments())) { - return \false; + if ($definition->isDeprecated() || $definition->isLazy() || $definition->getFactory() || 3 < count($definition->getArguments())) { + return false; } foreach ($definition->getArguments() as $arg) { - if (!$arg || $arg instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Parameter) { + if (!$arg || $arg instanceof Parameter) { continue; } - if (\is_array($arg) && 3 >= \count($arg)) { + if (is_array($arg) && 3 >= count($arg)) { foreach ($arg as $k => $v) { - if ($this->dumpValue($k) !== $this->dumpValue($k, \false)) { - return \false; + if ($this->dumpValue($k) !== $this->dumpValue($k, false)) { + return false; } - if (!$v || $v instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Parameter) { + if (!$v || $v instanceof Parameter) { continue; } - if ($v instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference && $this->container->has($id = (string) $v) && $this->container->findDefinition($id)->isSynthetic()) { + if ($v instanceof Reference && $this->container->has($id = (string) $v) && $this->container->findDefinition($id)->isSynthetic()) { continue; } - if (!\is_scalar($v) || $this->dumpValue($v) !== $this->dumpValue($v, \false)) { - return \false; + if (!is_scalar($v) || $this->dumpValue($v) !== $this->dumpValue($v, false)) { + return false; } } - } elseif ($arg instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference && $this->container->has($id = (string) $arg) && $this->container->findDefinition($id)->isSynthetic()) { + } elseif ($arg instanceof Reference && $this->container->has($id = (string) $arg) && $this->container->findDefinition($id)->isSynthetic()) { continue; - } elseif (!\is_scalar($arg) || $this->dumpValue($arg) !== $this->dumpValue($arg, \false)) { - return \false; + } elseif (!is_scalar($arg) || $this->dumpValue($arg) !== $this->dumpValue($arg, false)) { + return false; } } - return \true; + return true; } /** * Adds method calls to a service definition. @@ -470,7 +528,7 @@ private function isTrivialInstance(\_PhpScoper5ea00cc67502b\Symfony\Component\De * * @return string */ - private function addServiceMethodCalls(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition, $variableName = 'instance') + private function addServiceMethodCalls(Definition $definition, $variableName = 'instance') { $calls = ''; foreach ($definition->getMethodCalls() as $call) { @@ -478,15 +536,15 @@ private function addServiceMethodCalls(\_PhpScoper5ea00cc67502b\Symfony\Componen foreach ($call[1] as $value) { $arguments[] = $this->dumpValue($value); } - $calls .= $this->wrapServiceConditionals($call[1], \sprintf(" \$%s->%s(%s);\n", $variableName, $call[0], \implode(', ', $arguments))); + $calls .= $this->wrapServiceConditionals($call[1], sprintf(" \$%s->%s(%s);\n", $variableName, $call[0], implode(', ', $arguments))); } return $calls; } - private function addServiceProperties(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition, $variableName = 'instance') + private function addServiceProperties(Definition $definition, $variableName = 'instance') { $code = ''; foreach ($definition->getProperties() as $name => $value) { - $code .= \sprintf(" \$%s->%s = %s;\n", $variableName, $name, $this->dumpValue($value)); + $code .= sprintf(" \$%s->%s = %s;\n", $variableName, $name, $this->dumpValue($value)); } return $code; } @@ -497,26 +555,26 @@ private function addServiceProperties(\_PhpScoper5ea00cc67502b\Symfony\Component * * @return string */ - private function addServiceConfigurator(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition, $variableName = 'instance') + private function addServiceConfigurator(Definition $definition, $variableName = 'instance') { if (!($callable = $definition->getConfigurator())) { return ''; } - if (\is_array($callable)) { - if ($callable[0] instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference || $callable[0] instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition && $this->definitionVariables->contains($callable[0])) { - return \sprintf(" %s->%s(\$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); + if (is_array($callable)) { + if ($callable[0] instanceof Reference || $callable[0] instanceof Definition && $this->definitionVariables->contains($callable[0])) { + return sprintf(" %s->%s(\$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); } $class = $this->dumpValue($callable[0]); // If the class is a string we can optimize call_user_func away - if (0 === \strpos($class, "'") && \false === \strpos($class, '$')) { - return \sprintf(" %s::%s(\$%s);\n", $this->dumpLiteralClass($class), $callable[1], $variableName); + if (0 === strpos($class, "'") && false === strpos($class, '$')) { + return sprintf(" %s::%s(\$%s);\n", $this->dumpLiteralClass($class), $callable[1], $variableName); } - if (0 === \strpos($class, 'new ')) { - return \sprintf(" (%s)->%s(\$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); + if (0 === strpos($class, 'new ')) { + return sprintf(" (%s)->%s(\$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); } - return \sprintf(" \\call_user_func([%s, '%s'], \$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); + return sprintf(" \\call_user_func([%s, '%s'], \$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); } - return \sprintf(" %s(\$%s);\n", $callable, $variableName); + return sprintf(" %s(\$%s);\n", $callable, $variableName); } /** * Adds a service. @@ -526,33 +584,33 @@ private function addServiceConfigurator(\_PhpScoper5ea00cc67502b\Symfony\Compone * * @return string */ - private function addService($id, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition, &$file = null) + private function addService($id, Definition $definition, &$file = null) { - $this->definitionVariables = new \SplObjectStorage(); + $this->definitionVariables = new SplObjectStorage(); $this->referenceVariables = []; $this->variableCount = 0; - $this->referenceVariables[$id] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Variable('instance'); + $this->referenceVariables[$id] = new Variable('instance'); $return = []; if ($class = $definition->getClass()) { - $class = $class instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Parameter ? '%' . $class . '%' : $this->container->resolveEnvPlaceholders($class); - $return[] = \sprintf(0 === \strpos($class, '%') ? '@return object A %1$s instance' : '@return \\%s', \ltrim($class, '\\')); + $class = $class instanceof Parameter ? '%' . $class . '%' : $this->container->resolveEnvPlaceholders($class); + $return[] = sprintf(0 === strpos($class, '%') ? '@return object A %1$s instance' : '@return \\%s', ltrim($class, '\\')); } elseif ($definition->getFactory()) { $factory = $definition->getFactory(); - if (\is_string($factory)) { - $return[] = \sprintf('@return object An instance returned by %s()', $factory); - } elseif (\is_array($factory) && (\is_string($factory[0]) || $factory[0] instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition || $factory[0] instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference)) { - $class = $factory[0] instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition ? $factory[0]->getClass() : (string) $factory[0]; - $class = $class instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Parameter ? '%' . $class . '%' : $this->container->resolveEnvPlaceholders($class); - $return[] = \sprintf('@return object An instance returned by %s::%s()', $class, $factory[1]); + if (is_string($factory)) { + $return[] = sprintf('@return object An instance returned by %s()', $factory); + } elseif (is_array($factory) && (is_string($factory[0]) || $factory[0] instanceof Definition || $factory[0] instanceof Reference)) { + $class = $factory[0] instanceof Definition ? $factory[0]->getClass() : (string) $factory[0]; + $class = $class instanceof Parameter ? '%' . $class . '%' : $this->container->resolveEnvPlaceholders($class); + $return[] = sprintf('@return object An instance returned by %s::%s()', $class, $factory[1]); } } if ($definition->isDeprecated()) { - if ($return && 0 === \strpos($return[\count($return) - 1], '@return')) { + if ($return && 0 === strpos($return[count($return) - 1], '@return')) { $return[] = ''; } - $return[] = \sprintf('@deprecated %s', $definition->getDeprecationMessage($id)); + $return[] = sprintf('@deprecated %s', $definition->getDeprecationMessage($id)); } - $return = \str_replace("\n * \n", "\n *\n", \implode("\n * ", $return)); + $return = str_replace("\n * \n", "\n *\n", implode("\n * ", $return)); $return = $this->container->resolveEnvPlaceholders($return); $shared = $definition->isShared() ? ' shared' : ''; $public = $definition->isPublic() ? 'public' : 'private'; @@ -575,7 +633,7 @@ private function addService($id, \_PhpScoper5ea00cc67502b\Symfony\Component\Depe * * {$return} EOF; - $code = \str_replace('*/', ' ', $code) . <<addServiceInclude($id, $definition); if ($this->getProxyDumper()->isProxyCandidate($definition)) { $factoryCode = $asFile ? "\$this->load('%s.php', false)" : '$this->%s(false)'; - $code .= $this->getProxyDumper()->getProxyFactoryCode($definition, $id, \sprintf($factoryCode, $methodName, $this->doExport($id))); + $code .= $this->getProxyDumper()->getProxyFactoryCode($definition, $id, sprintf($factoryCode, $methodName, $this->doExport($id))); } if ($definition->isDeprecated()) { - $code .= \sprintf(" @trigger_error(%s, E_USER_DEPRECATED);\n\n", $this->export($definition->getDeprecationMessage($id))); + $code .= sprintf(" @trigger_error(%s, E_USER_DEPRECATED);\n\n", $this->export($definition->getDeprecationMessage($id))); } $code .= $this->addInlineService($id, $definition); if ($asFile) { - $code = \implode("\n", \array_map(function ($line) { - return $line ? \substr($line, 8) : $line; - }, \explode("\n", $code))); + $code = implode("\n", array_map(function ($line) { + return $line ? substr($line, 8) : $line; + }, explode("\n", $code))); } else { $code .= " }\n"; } @@ -605,26 +663,26 @@ protected function {$methodName}({$lazyInitialization}) $this->referenceVariables = $this->serviceCalls = null; return $code; } - private function addInlineVariables($id, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition, array $arguments, $forConstructor) + private function addInlineVariables($id, Definition $definition, array $arguments, $forConstructor) { $code = ''; foreach ($arguments as $argument) { - if (\is_array($argument)) { + if (is_array($argument)) { $code .= $this->addInlineVariables($id, $definition, $argument, $forConstructor); - } elseif ($argument instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference) { + } elseif ($argument instanceof Reference) { $code .= $this->addInlineReference($id, $definition, $this->container->normalizeId($argument), $forConstructor); - } elseif ($argument instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition) { + } elseif ($argument instanceof Definition) { $code .= $this->addInlineService($id, $definition, $argument, $forConstructor); } } return $code; } - private function addInlineReference($id, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition, $targetId, $forConstructor) + private function addInlineReference($id, Definition $definition, $targetId, $forConstructor) { while ($this->container->hasAlias($targetId)) { $targetId = (string) $this->container->getAlias($targetId); } - list($callCount, $behavior) = $this->serviceCalls[$targetId]; + [$callCount, $behavior] = $this->serviceCalls[$targetId]; if ($id === $targetId) { return $this->addInlineService($id, $definition, $definition); } @@ -641,13 +699,13 @@ private function addInlineReference($id, \_PhpScoper5ea00cc67502b\Symfony\Compon return $code; } $name = $this->getNextVariableName(); - $this->referenceVariables[$targetId] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Variable($name); - $reference = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE >= $behavior ? new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference($targetId, $behavior) : null; - $code .= \sprintf(" \$%s = %s;\n", $name, $this->getServiceCall($targetId, $reference)); + $this->referenceVariables[$targetId] = new Variable($name); + $reference = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE >= $behavior ? new Reference($targetId, $behavior) : null; + $code .= sprintf(" \$%s = %s;\n", $name, $this->getServiceCall($targetId, $reference)); if (!$hasSelfRef || !$forConstructor) { return $code; } - $code .= \sprintf(<<<'EOTXT' + $code .= sprintf(<<<'EOTXT' if (isset($this->%s[%s])) { return $this->%1$s[%2$s]; @@ -657,11 +715,11 @@ private function addInlineReference($id, \_PhpScoper5ea00cc67502b\Symfony\Compon , 'services', $this->doExport($id)); return $code; } - private function addInlineService($id, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $inlineDef = null, $forConstructor = \true) + private function addInlineService($id, Definition $definition, Definition $inlineDef = null, $forConstructor = true) { $code = ''; if ($isSimpleInstance = $isRootInstance = null === $inlineDef) { - foreach ($this->serviceCalls as $targetId => list($callCount, $behavior, $byConstructor)) { + foreach ($this->serviceCalls as $targetId => [$callCount, $behavior, $byConstructor]) { if ($byConstructor && isset($this->circularReferences[$id][$targetId]) && !$this->circularReferences[$id][$targetId]) { $code .= $this->addInlineReference($id, $definition, $targetId, $forConstructor); } @@ -672,23 +730,23 @@ private function addInlineService($id, \_PhpScoper5ea00cc67502b\Symfony\Componen } $arguments = [$inlineDef->getArguments(), $inlineDef->getFactory()]; $code .= $this->addInlineVariables($id, $definition, $arguments, $forConstructor); - if ($arguments = \array_filter([$inlineDef->getProperties(), $inlineDef->getMethodCalls(), $inlineDef->getConfigurator()])) { - $isSimpleInstance = \false; + if ($arguments = array_filter([$inlineDef->getProperties(), $inlineDef->getMethodCalls(), $inlineDef->getConfigurator()])) { + $isSimpleInstance = false; } elseif ($definition !== $inlineDef && 2 > $this->inlinedDefinitions[$inlineDef]) { return $code; } if (isset($this->definitionVariables[$inlineDef])) { - $isSimpleInstance = \false; + $isSimpleInstance = false; } else { $name = $definition === $inlineDef ? 'instance' : $this->getNextVariableName(); - $this->definitionVariables[$inlineDef] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Variable($name); + $this->definitionVariables[$inlineDef] = new Variable($name); $code .= '' !== $code ? "\n" : ''; if ('instance' === $name) { $code .= $this->addServiceInstance($id, $definition, $isSimpleInstance); } else { $code .= $this->addNewInstance($inlineDef, '$' . $name, ' = ', $id); } - if ('' !== ($inline = $this->addInlineVariables($id, $definition, $arguments, \false))) { + if ('' !== ($inline = $this->addInlineVariables($id, $definition, $arguments, false))) { $code .= "\n" . $inline . "\n"; } elseif ($arguments && 'instance' === $name) { $code .= "\n"; @@ -711,7 +769,7 @@ private function addServices() { $publicServices = $privateServices = ''; $definitions = $this->container->getDefinitions(); - \ksort($definitions); + ksort($definitions); foreach ($definitions as $id => $definition) { if ($definition->isSynthetic() || $this->asFiles && $definition->isShared() && !$this->isHotPath($definition)) { continue; @@ -727,7 +785,7 @@ private function addServices() private function generateServiceFiles() { $definitions = $this->container->getDefinitions(); - \ksort($definitions); + ksort($definitions); foreach ($definitions as $id => $definition) { if (!$definition->isSynthetic() && $definition->isShared() && !$this->isHotPath($definition)) { $code = $this->addService($id, $definition, $file); @@ -735,7 +793,7 @@ private function generateServiceFiles() } } } - private function addNewInstance(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition, $return, $instantiation, $id) + private function addNewInstance(Definition $definition, $return, $instantiation, $id) { $class = $this->dumpValue($definition->getClass()); $return = ' ' . $return . $instantiation; @@ -745,32 +803,32 @@ private function addNewInstance(\_PhpScoper5ea00cc67502b\Symfony\Component\Depen } if (null !== $definition->getFactory()) { $callable = $definition->getFactory(); - if (\is_array($callable)) { - if (!\preg_match('/^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*$/', $callable[1])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Cannot dump definition because of invalid factory method (%s).', $callable[1] ?: 'n/a')); + if (is_array($callable)) { + if (!preg_match('/^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*$/', $callable[1])) { + throw new RuntimeException(sprintf('Cannot dump definition because of invalid factory method (%s).', $callable[1] ?: 'n/a')); } - if ($callable[0] instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference || $callable[0] instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition && $this->definitionVariables->contains($callable[0])) { - return $return . \sprintf("%s->%s(%s);\n", $this->dumpValue($callable[0]), $callable[1], $arguments ? \implode(', ', $arguments) : ''); + if ($callable[0] instanceof Reference || $callable[0] instanceof Definition && $this->definitionVariables->contains($callable[0])) { + return $return . sprintf("%s->%s(%s);\n", $this->dumpValue($callable[0]), $callable[1], $arguments ? implode(', ', $arguments) : ''); } $class = $this->dumpValue($callable[0]); // If the class is a string we can optimize call_user_func away - if (0 === \strpos($class, "'") && \false === \strpos($class, '$')) { + if (0 === strpos($class, "'") && false === strpos($class, '$')) { if ("''" === $class) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Cannot dump definition: The "%s" service is defined to be created by a factory but is missing the service reference, did you forget to define the factory service id or class?', $id)); + throw new RuntimeException(sprintf('Cannot dump definition: The "%s" service is defined to be created by a factory but is missing the service reference, did you forget to define the factory service id or class?', $id)); } - return $return . \sprintf("%s::%s(%s);\n", $this->dumpLiteralClass($class), $callable[1], $arguments ? \implode(', ', $arguments) : ''); + return $return . sprintf("%s::%s(%s);\n", $this->dumpLiteralClass($class), $callable[1], $arguments ? implode(', ', $arguments) : ''); } - if (0 === \strpos($class, 'new ')) { - return $return . \sprintf("(%s)->%s(%s);\n", $class, $callable[1], $arguments ? \implode(', ', $arguments) : ''); + if (0 === strpos($class, 'new ')) { + return $return . sprintf("(%s)->%s(%s);\n", $class, $callable[1], $arguments ? implode(', ', $arguments) : ''); } - return $return . \sprintf("\\call_user_func([%s, '%s']%s);\n", $class, $callable[1], $arguments ? ', ' . \implode(', ', $arguments) : ''); + return $return . sprintf("\\call_user_func([%s, '%s']%s);\n", $class, $callable[1], $arguments ? ', ' . implode(', ', $arguments) : ''); } - return $return . \sprintf("%s(%s);\n", $this->dumpLiteralClass($this->dumpValue($callable)), $arguments ? \implode(', ', $arguments) : ''); + return $return . sprintf("%s(%s);\n", $this->dumpLiteralClass($this->dumpValue($callable)), $arguments ? implode(', ', $arguments) : ''); } - if (\false !== \strpos($class, '$')) { - return \sprintf(" \$class = %s;\n\n%snew \$class(%s);\n", $class, $return, \implode(', ', $arguments)); + if (false !== strpos($class, '$')) { + return sprintf(" \$class = %s;\n\n%snew \$class(%s);\n", $class, $return, implode(', ', $arguments)); } - return $return . \sprintf("new %s(%s);\n", $this->dumpLiteralClass($class), \implode(', ', $arguments)); + return $return . sprintf("new %s(%s);\n", $this->dumpLiteralClass($class), implode(', ', $arguments)); } /** * Adds the class headers. @@ -822,15 +880,15 @@ public function __construct() EOF; } if ($this->asFiles) { - $code = \str_replace('$parameters', "\$buildParameters;\n private \$containerDir;\n private \$parameters", $code); - $code = \str_replace('__construct()', '__construct(array $buildParameters = [], $containerDir = __DIR__)', $code); + $code = str_replace('$parameters', "\$buildParameters;\n private \$containerDir;\n private \$parameters", $code); + $code = str_replace('__construct()', '__construct(array $buildParameters = [], $containerDir = __DIR__)', $code); $code .= " \$this->buildParameters = \$buildParameters;\n"; $code .= " \$this->containerDir = \$containerDir;\n"; } if ($this->container->isCompiled()) { - if (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container::class !== $baseClassWithNamespace) { - $r = $this->container->getReflectionClass($baseClassWithNamespace, \false); - if (null !== $r && null !== ($constructor = $r->getConstructor()) && 0 === $constructor->getNumberOfRequiredParameters() && \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container::class !== $constructor->getDeclaringClass()->name) { + if (Container::class !== $baseClassWithNamespace) { + $r = $this->container->getReflectionClass($baseClassWithNamespace, false); + if (null !== $r && null !== ($constructor = $r->getConstructor()) && 0 === $constructor->getNumberOfRequiredParameters() && Container::class !== $constructor->getDeclaringClass()->name) { $code .= " parent::__construct();\n"; $code .= " \$this->parameterBag = null;\n\n"; } @@ -923,7 +981,7 @@ private function addNormalizedIds() { $code = ''; $normalizedIds = $this->container->getNormalizedIds(); - \ksort($normalizedIds); + ksort($normalizedIds); foreach ($normalizedIds as $id => $normalizedId) { if ($this->container->has($normalizedId)) { $code .= ' ' . $this->doExport($id) . ' => ' . $this->doExport($normalizedId) . ",\n"; @@ -940,7 +998,7 @@ private function addSyntheticIds() { $code = ''; $definitions = $this->container->getDefinitions(); - \ksort($definitions); + ksort($definitions); foreach ($definitions as $id => $definition) { if ($definition->isSynthetic() && 'service_container' !== $id) { $code .= ' ' . $this->doExport($id) . " => true,\n"; @@ -962,10 +1020,10 @@ private function addRemovedIds() $code = "require \$this->containerDir.\\DIRECTORY_SEPARATOR.'removed-ids.php'"; } else { $code = ''; - $ids = \array_keys($ids); - \sort($ids); + $ids = array_keys($ids); + sort($ids); foreach ($ids as $id) { - if (\preg_match('/^\\d+_[^~]++~[._a-zA-Z\\d]{7}$/', $id)) { + if (preg_match('/^\\d+_[^~]++~[._a-zA-Z\\d]{7}$/', $id)) { continue; } $code .= ' ' . $this->doExport($id) . " => true,\n"; @@ -990,7 +1048,7 @@ private function addMethodMap() { $code = ''; $definitions = $this->container->getDefinitions(); - \ksort($definitions); + ksort($definitions); foreach ($definitions as $id => $definition) { if (!$definition->isSynthetic() && (!$this->asFiles || !$definition->isShared() || $this->isHotPath($definition))) { $code .= ' ' . $this->doExport($id) . ' => ' . $this->doExport($this->generateMethodName($id)) . ",\n"; @@ -1007,10 +1065,10 @@ private function addFileMap() { $code = ''; $definitions = $this->container->getDefinitions(); - \ksort($definitions); + ksort($definitions); foreach ($definitions as $id => $definition) { if (!$definition->isSynthetic() && $definition->isShared() && !$this->isHotPath($definition)) { - $code .= \sprintf(" %s => '%s.php',\n", $this->doExport($id), $this->generateMethodName($id)); + $code .= sprintf(" %s => '%s.php',\n", $this->doExport($id), $this->generateMethodName($id)); } } return $code ? " \$this->fileMap = [\n{$code} ];\n" : ''; @@ -1024,14 +1082,14 @@ private function addPrivateServices() { $code = ''; $aliases = $this->container->getAliases(); - \ksort($aliases); + ksort($aliases); foreach ($aliases as $id => $alias) { if ($alias->isPrivate()) { $code .= ' ' . $this->doExport($id) . " => true,\n"; } } $definitions = $this->container->getDefinitions(); - \ksort($definitions); + ksort($definitions); foreach ($definitions as $id => $definition) { if (!$definition->isPublic()) { $code .= ' ' . $this->doExport($id) . " => true,\n"; @@ -1056,7 +1114,7 @@ private function addAliases() return $this->container->isCompiled() ? "\n \$this->aliases = [];\n" : ''; } $code = " \$this->aliases = [\n"; - \ksort($aliases); + ksort($aliases); foreach ($aliases as $alias => $id) { $id = $this->container->normalizeId($id); while (isset($aliases[$id])) { @@ -1076,7 +1134,7 @@ private function addInlineRequires() $definition = $this->container->getDefinition($id); $inlinedDefinitions = $this->getDefinitionsFromArguments([$definition]); foreach ($inlinedDefinitions as $def) { - if (\is_string($class = \is_array($factory = $def->getFactory()) && \is_string($factory[0]) ? $factory[0] : $def->getClass())) { + if (is_string($class = is_array($factory = $def->getFactory()) && is_string($factory[0]) ? $factory[0] : $def->getClass())) { $this->collectLineage($class, $lineage); } } @@ -1084,11 +1142,11 @@ private function addInlineRequires() $code = ''; foreach ($lineage as $file) { if (!isset($this->inlinedRequires[$file])) { - $this->inlinedRequires[$file] = \true; - $code .= \sprintf("\n include_once %s;", $file); + $this->inlinedRequires[$file] = true; + $code .= sprintf("\n include_once %s;", $file); } } - return $code ? \sprintf("\n \$this->privates['service_container'] = function () {%s\n };\n", $code) : ''; + return $code ? sprintf("\n \$this->privates['service_container'] = function () {%s\n };\n", $code) : ''; } /** * Adds default parameters method. @@ -1105,20 +1163,20 @@ private function addDefaultParametersMethod() $normalizedParams = []; foreach ($this->container->getParameterBag()->all() as $key => $value) { if ($key !== ($resolvedKey = $this->container->resolveEnvPlaceholders($key))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Parameter name cannot use env parameters: "%s".', $resolvedKey)); + throw new InvalidArgumentException(sprintf('Parameter name cannot use env parameters: "%s".', $resolvedKey)); } - if ($key !== ($lcKey = \strtolower($key))) { - $normalizedParams[] = \sprintf(' %s => %s,', $this->export($lcKey), $this->export($key)); + if ($key !== ($lcKey = strtolower($key))) { + $normalizedParams[] = sprintf(' %s => %s,', $this->export($lcKey), $this->export($key)); } $export = $this->exportParameters([$value]); - $export = \explode('0 => ', \substr(\rtrim($export, " ]\n"), 2, -1), 2); - if (\preg_match("/\\\$this->(?:getEnv\\('(?:\\w++:)*+\\w++'\\)|targetDirs\\[\\d++\\])/", $export[1])) { - $dynamicPhp[$key] = \sprintf('%scase %s: $value = %s; break;', $export[0], $this->export($key), $export[1]); + $export = explode('0 => ', substr(rtrim($export, " ]\n"), 2, -1), 2); + if (preg_match("/\\\$this->(?:getEnv\\('(?:\\w++:)*+\\w++'\\)|targetDirs\\[\\d++\\])/", $export[1])) { + $dynamicPhp[$key] = sprintf('%scase %s: $value = %s; break;', $export[0], $this->export($key), $export[1]); } else { - $php[] = \sprintf('%s%s => %s,', $export[0], $this->export($key), $export[1]); + $php[] = sprintf('%s%s => %s,', $export[0], $this->export($key), $export[1]); } } - $parameters = \sprintf("[\n%s\n%s]", \implode("\n", $php), \str_repeat(' ', 8)); + $parameters = sprintf("[\n%s\n%s]", implode("\n", $php), str_repeat(' ', 8)); $code = ''; if ($this->container->isCompiled()) { $code .= <<<'EOF' @@ -1177,10 +1235,10 @@ public function getParameterBag() EOF; if (!$this->asFiles) { - $code = \preg_replace('/^.*buildParameters.*\\n.*\\n.*\\n/m', '', $code); + $code = preg_replace('/^.*buildParameters.*\\n.*\\n.*\\n/m', '', $code); } if ($dynamicPhp) { - $loadedDynamicParameters = $this->exportParameters(\array_combine(\array_keys($dynamicPhp), \array_fill(0, \count($dynamicPhp), \false)), '', 8); + $loadedDynamicParameters = $this->exportParameters(array_combine(array_keys($dynamicPhp), array_fill(0, count($dynamicPhp), false)), '', 8); $getDynamicParameter = <<<'EOF' switch ($name) { %s @@ -1190,10 +1248,10 @@ public function getParameterBag() return $this->dynamicParameters[$name] = $value; EOF; - $getDynamicParameter = \sprintf($getDynamicParameter, \implode("\n", $dynamicPhp)); + $getDynamicParameter = sprintf($getDynamicParameter, implode("\n", $dynamicPhp)); } else { $loadedDynamicParameters = '[]'; - $getDynamicParameter = \str_repeat(' ', 8) . 'throw new InvalidArgumentException(sprintf(\'The dynamic parameter "%s" must be defined.\', $name));'; + $getDynamicParameter = str_repeat(' ', 8) . 'throw new InvalidArgumentException(sprintf(\'The dynamic parameter "%s" must be defined.\', $name));'; } $code .= << $value) { - if (\is_array($value)) { + if (is_array($value)) { $value = $this->exportParameters($value, $path . '/' . $key, $indent + 4); - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ArgumentInterface) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('You cannot dump a container with parameters that contain special arguments. "%s" found in "%s".', \get_class($value), $path . '/' . $key)); - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Variable) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('You cannot dump a container with parameters that contain variable references. Variable "%s" found in "%s".', $value, $path . '/' . $key)); - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('You cannot dump a container with parameters that contain service definitions. Definition for "%s" found in "%s".', $value->getClass(), $path . '/' . $key)); - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('You cannot dump a container with parameters that contain references to other services (reference to service "%s" found in "%s").', $value, $path . '/' . $key)); - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('You cannot dump a container with parameters that contain expressions. Expression "%s" found in "%s".', $value, $path . '/' . $key)); + } elseif ($value instanceof ArgumentInterface) { + throw new InvalidArgumentException(sprintf('You cannot dump a container with parameters that contain special arguments. "%s" found in "%s".', get_class($value), $path . '/' . $key)); + } elseif ($value instanceof Variable) { + throw new InvalidArgumentException(sprintf('You cannot dump a container with parameters that contain variable references. Variable "%s" found in "%s".', $value, $path . '/' . $key)); + } elseif ($value instanceof Definition) { + throw new InvalidArgumentException(sprintf('You cannot dump a container with parameters that contain service definitions. Definition for "%s" found in "%s".', $value->getClass(), $path . '/' . $key)); + } elseif ($value instanceof Reference) { + throw new InvalidArgumentException(sprintf('You cannot dump a container with parameters that contain references to other services (reference to service "%s" found in "%s").', $value, $path . '/' . $key)); + } elseif ($value instanceof Expression) { + throw new InvalidArgumentException(sprintf('You cannot dump a container with parameters that contain expressions. Expression "%s" found in "%s".', $value, $path . '/' . $key)); } else { $value = $this->export($value); } - $php[] = \sprintf('%s%s => %s,', \str_repeat(' ', $indent), $this->export($key), $value); + $php[] = sprintf('%s%s => %s,', str_repeat(' ', $indent), $this->export($key), $value); } - return \sprintf("[\n%s\n%s]", \implode("\n", $php), \str_repeat(' ', $indent - 4)); + return sprintf("[\n%s\n%s]", implode("\n", $php), str_repeat(' ', $indent - 4)); } /** * Ends the class definition. @@ -1311,10 +1369,10 @@ private function wrapServiceConditionals($value, $code) return $code; } // re-indent the wrapped code - $code = \implode("\n", \array_map(function ($line) { + $code = implode("\n", array_map(function ($line) { return $line ? ' ' . $line : $line; - }, \explode("\n", $code))); - return \sprintf(" if (%s) {\n%s }\n", $condition, $code); + }, explode("\n", $code))); + return sprintf(" if (%s) {\n%s }\n", $condition, $code); } /** * Get the conditions to execute for conditional services. @@ -1326,32 +1384,32 @@ private function wrapServiceConditionals($value, $code) private function getServiceConditionals($value) { $conditions = []; - foreach (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder::getInitializedConditionals($value) as $service) { + foreach (ContainerBuilder::getInitializedConditionals($value) as $service) { if (!$this->container->hasDefinition($service)) { return 'false'; } - $conditions[] = \sprintf('isset($this->services[%s])', $this->doExport($service)); + $conditions[] = sprintf('isset($this->services[%s])', $this->doExport($service)); } - foreach (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder::getServiceConditionals($value) as $service) { + foreach (ContainerBuilder::getServiceConditionals($value) as $service) { if ($this->container->hasDefinition($service) && !$this->container->getDefinition($service)->isPublic()) { continue; } - $conditions[] = \sprintf('$this->has(%s)', $this->doExport($service)); + $conditions[] = sprintf('$this->has(%s)', $this->doExport($service)); } if (!$conditions) { return ''; } - return \implode(' && ', $conditions); + return implode(' && ', $conditions); } - private function getDefinitionsFromArguments(array $arguments, \SplObjectStorage $definitions = null, array &$calls = [], $byConstructor = null) + private function getDefinitionsFromArguments(array $arguments, SplObjectStorage $definitions = null, array &$calls = [], $byConstructor = null) { if (null === $definitions) { - $definitions = new \SplObjectStorage(); + $definitions = new SplObjectStorage(); } foreach ($arguments as $argument) { - if (\is_array($argument)) { + if (is_array($argument)) { $this->getDefinitionsFromArguments($argument, $definitions, $calls, $byConstructor); - } elseif ($argument instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference) { + } elseif ($argument instanceof Reference) { $id = $this->container->normalizeId($argument); while ($this->container->hasAlias($id)) { $id = (string) $this->container->getAlias($id); @@ -1359,10 +1417,10 @@ private function getDefinitionsFromArguments(array $arguments, \SplObjectStorage if (!isset($calls[$id])) { $calls[$id] = [0, $argument->getInvalidBehavior(), $byConstructor]; } else { - $calls[$id][1] = \min($calls[$id][1], $argument->getInvalidBehavior()); + $calls[$id][1] = min($calls[$id][1], $argument->getInvalidBehavior()); } ++$calls[$id][0]; - } elseif (!$argument instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition) { + } elseif (!$argument instanceof Definition) { // no-op } elseif (isset($definitions[$argument])) { $definitions[$argument] = 1 + $definitions[$argument]; @@ -1386,32 +1444,32 @@ private function getDefinitionsFromArguments(array $arguments, \SplObjectStorage * * @throws RuntimeException */ - private function dumpValue($value, $interpolate = \true) + private function dumpValue($value, $interpolate = true) { - if (\is_array($value)) { - if ($value && $interpolate && \false !== ($param = \array_search($value, $this->container->getParameterBag()->all(), \true))) { + if (is_array($value)) { + if ($value && $interpolate && false !== ($param = array_search($value, $this->container->getParameterBag()->all(), true))) { return $this->dumpValue("%{$param}%"); } $code = []; foreach ($value as $k => $v) { - $code[] = \sprintf('%s => %s', $this->dumpValue($k, $interpolate), $this->dumpValue($v, $interpolate)); + $code[] = sprintf('%s => %s', $this->dumpValue($k, $interpolate), $this->dumpValue($v, $interpolate)); } - return \sprintf('[%s]', \implode(', ', $code)); - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ArgumentInterface) { + return sprintf('[%s]', implode(', ', $code)); + } elseif ($value instanceof ArgumentInterface) { $scope = [$this->definitionVariables, $this->referenceVariables]; $this->definitionVariables = $this->referenceVariables = null; try { - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument) { + if ($value instanceof ServiceClosureArgument) { $value = $value->getValues()[0]; $code = $this->dumpValue($value, $interpolate); - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference) { - $code = \sprintf('$f = function (\\%s $v%s) { return $v; }; return $f(%s);', $value->getType(), \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $value->getInvalidBehavior() ? ' = null' : '', $code); + if ($value instanceof TypedReference) { + $code = sprintf('$f = function (\\%s $v%s) { return $v; }; return $f(%s);', $value->getType(), ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $value->getInvalidBehavior() ? ' = null' : '', $code); } else { - $code = \sprintf('return %s;', $code); + $code = sprintf('return %s;', $code); } - return \sprintf("function () {\n %s\n }", $code); + return sprintf("function () {\n %s\n }", $code); } - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument) { + if ($value instanceof IteratorArgument) { $operands = [0]; $code = []; $code[] = 'new RewindableGenerator(function () {'; @@ -1422,34 +1480,34 @@ private function dumpValue($value, $interpolate = \true) $countCode[] = 'function () {'; foreach ($values as $k => $v) { ($c = $this->getServiceConditionals($v)) ? $operands[] = "(int) ({$c})" : ++$operands[0]; - $v = $this->wrapServiceConditionals($v, \sprintf(" yield %s => %s;\n", $this->dumpValue($k, $interpolate), $this->dumpValue($v, $interpolate))); - foreach (\explode("\n", $v) as $v) { + $v = $this->wrapServiceConditionals($v, sprintf(" yield %s => %s;\n", $this->dumpValue($k, $interpolate), $this->dumpValue($v, $interpolate))); + foreach (explode("\n", $v) as $v) { if ($v) { $code[] = ' ' . $v; } } } - $countCode[] = \sprintf(' return %s;', \implode(' + ', $operands)); + $countCode[] = sprintf(' return %s;', implode(' + ', $operands)); $countCode[] = ' }'; } - $code[] = \sprintf(' }, %s)', \count($operands) > 1 ? \implode("\n", $countCode) : $operands[0]); - return \implode("\n", $code); + $code[] = sprintf(' }, %s)', count($operands) > 1 ? implode("\n", $countCode) : $operands[0]); + return implode("\n", $code); } } finally { - list($this->definitionVariables, $this->referenceVariables) = $scope; + [$this->definitionVariables, $this->referenceVariables] = $scope; } - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition) { + } elseif ($value instanceof Definition) { if (null !== $this->definitionVariables && $this->definitionVariables->contains($value)) { return $this->dumpValue($this->definitionVariables[$value], $interpolate); } if ($value->getMethodCalls()) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException('Cannot dump definitions which have method calls.'); + throw new RuntimeException('Cannot dump definitions which have method calls.'); } if ($value->getProperties()) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException('Cannot dump definitions which have properties.'); + throw new RuntimeException('Cannot dump definitions which have properties.'); } if (null !== $value->getConfigurator()) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException('Cannot dump definitions which have a configurator.'); + throw new RuntimeException('Cannot dump definitions which have a configurator.'); } $arguments = []; foreach ($value->getArguments() as $argument) { @@ -1457,37 +1515,37 @@ private function dumpValue($value, $interpolate = \true) } if (null !== $value->getFactory()) { $factory = $value->getFactory(); - if (\is_string($factory)) { - return \sprintf('%s(%s)', $this->dumpLiteralClass($this->dumpValue($factory)), \implode(', ', $arguments)); + if (is_string($factory)) { + return sprintf('%s(%s)', $this->dumpLiteralClass($this->dumpValue($factory)), implode(', ', $arguments)); } - if (\is_array($factory)) { - if (!\preg_match('/^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*$/', $factory[1])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Cannot dump definition because of invalid factory method (%s).', $factory[1] ?: 'n/a')); + if (is_array($factory)) { + if (!preg_match('/^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*$/', $factory[1])) { + throw new RuntimeException(sprintf('Cannot dump definition because of invalid factory method (%s).', $factory[1] ?: 'n/a')); } $class = $this->dumpValue($factory[0]); - if (\is_string($factory[0])) { - return \sprintf('%s::%s(%s)', $this->dumpLiteralClass($class), $factory[1], \implode(', ', $arguments)); + if (is_string($factory[0])) { + return sprintf('%s::%s(%s)', $this->dumpLiteralClass($class), $factory[1], implode(', ', $arguments)); } - if ($factory[0] instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition) { - if (0 === \strpos($class, 'new ')) { - return \sprintf('(%s)->%s(%s)', $class, $factory[1], \implode(', ', $arguments)); + if ($factory[0] instanceof Definition) { + if (0 === strpos($class, 'new ')) { + return sprintf('(%s)->%s(%s)', $class, $factory[1], implode(', ', $arguments)); } - return \sprintf("\\call_user_func([%s, '%s']%s)", $class, $factory[1], \count($arguments) > 0 ? ', ' . \implode(', ', $arguments) : ''); + return sprintf("\\call_user_func([%s, '%s']%s)", $class, $factory[1], count($arguments) > 0 ? ', ' . implode(', ', $arguments) : ''); } - if ($factory[0] instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference) { - return \sprintf('%s->%s(%s)', $class, $factory[1], \implode(', ', $arguments)); + if ($factory[0] instanceof Reference) { + return sprintf('%s->%s(%s)', $class, $factory[1], implode(', ', $arguments)); } } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException('Cannot dump definition because of invalid factory.'); + throw new RuntimeException('Cannot dump definition because of invalid factory.'); } $class = $value->getClass(); if (null === $class) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException('Cannot dump definitions which have no class nor factory.'); + throw new RuntimeException('Cannot dump definitions which have no class nor factory.'); } - return \sprintf('new %s(%s)', $this->dumpLiteralClass($this->dumpValue($class)), \implode(', ', $arguments)); - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Variable) { + return sprintf('new %s(%s)', $this->dumpLiteralClass($this->dumpValue($class)), implode(', ', $arguments)); + } elseif ($value instanceof Variable) { return '$' . $value; - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference) { + } elseif ($value instanceof Reference) { $id = $this->container->normalizeId($value); while ($this->container->hasAlias($id)) { $id = (string) $this->container->getAlias($id); @@ -1496,12 +1554,12 @@ private function dumpValue($value, $interpolate = \true) return $this->dumpValue($this->referenceVariables[$id], $interpolate); } return $this->getServiceCall($id, $value); - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression) { + } elseif ($value instanceof Expression) { return $this->getExpressionLanguage()->compile((string) $value, ['this' => 'container']); - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Parameter) { + } elseif ($value instanceof Parameter) { return $this->dumpParameter($value); - } elseif (\true === $interpolate && \is_string($value)) { - if (\preg_match('/^%([^%]+)%$/', $value, $match)) { + } elseif (true === $interpolate && is_string($value)) { + if (preg_match('/^%([^%]+)%$/', $value, $match)) { // we do this to deal with non string values (Boolean, integer, ...) // the preg_replace_callback converts them to strings return $this->dumpParameter($match[1]); @@ -1509,11 +1567,11 @@ private function dumpValue($value, $interpolate = \true) $replaceParameters = function ($match) { return "'." . $this->dumpParameter($match[2]) . ".'"; }; - $code = \str_replace('%%', '%', \preg_replace_callback('/(?export($value))); + $code = str_replace('%%', '%', preg_replace_callback('/(?export($value))); return $code; } - } elseif (\is_object($value) || \is_resource($value)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException('Unable to dump a service container if a parameter is an object or a resource.'); + } elseif (is_object($value) || is_resource($value)) { + throw new RuntimeException('Unable to dump a service container if a parameter is an object or a resource.'); } return $this->export($value); } @@ -1528,14 +1586,14 @@ private function dumpValue($value, $interpolate = \true) */ private function dumpLiteralClass($class) { - if (\false !== \strpos($class, '$')) { - return \sprintf('${($_ = %s) && false ?: "_"}', $class); + if (false !== strpos($class, '$')) { + return sprintf('${($_ = %s) && false ?: "_"}', $class); } - if (0 !== \strpos($class, "'") || !\preg_match('/^\'(?:\\\\{2})?[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*(?:\\\\{2}[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)*\'$/', $class)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Cannot dump definition because of invalid class name (%s).', $class ?: 'n/a')); + if (0 !== strpos($class, "'") || !preg_match('/^\'(?:\\\\{2})?[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*(?:\\\\{2}[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)*\'$/', $class)) { + throw new RuntimeException(sprintf('Cannot dump definition because of invalid class name (%s).', $class ?: 'n/a')); } - $class = \substr(\str_replace('\\\\', '\\', $class), 1, -1); - return 0 === \strpos($class, '\\') ? $class : '\\' . $class; + $class = substr(str_replace('\\\\', '\\', $class), 1, -1); + return 0 === strpos($class, '\\') ? $class : '\\' . $class; } /** * Dumps a parameter. @@ -1549,15 +1607,15 @@ private function dumpParameter($name) $name = (string) $name; if ($this->container->isCompiled() && $this->container->hasParameter($name)) { $value = $this->container->getParameter($name); - $dumpedValue = $this->dumpValue($value, \false); - if (!$value || !\is_array($value)) { + $dumpedValue = $this->dumpValue($value, false); + if (!$value || !is_array($value)) { return $dumpedValue; } - if (!\preg_match("/\\\$this->(?:getEnv\\('(?:\\w++:)*+\\w++'\\)|targetDirs\\[\\d++\\])/", $dumpedValue)) { - return \sprintf('$this->parameters[%s]', $this->doExport($name)); + if (!preg_match("/\\\$this->(?:getEnv\\('(?:\\w++:)*+\\w++'\\)|targetDirs\\[\\d++\\])/", $dumpedValue)) { + return sprintf('$this->parameters[%s]', $this->doExport($name)); } } - return \sprintf('$this->getParameter(%s)', $this->doExport($name)); + return sprintf('$this->getParameter(%s)', $this->doExport($name)); } /** * Gets a service call. @@ -1567,7 +1625,7 @@ private function dumpParameter($name) * * @return string */ - private function getServiceCall($id, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference $reference = null) + private function getServiceCall($id, Reference $reference = null) { while ($this->container->hasAlias($id)) { $id = (string) $this->container->getAlias($id); @@ -1578,32 +1636,32 @@ private function getServiceCall($id, \_PhpScoper5ea00cc67502b\Symfony\Component\ } if ($this->container->hasDefinition($id) && ($definition = $this->container->getDefinition($id))) { if ($definition->isSynthetic()) { - $code = \sprintf('$this->get(%s%s)', $this->doExport($id), null !== $reference ? ', ' . $reference->getInvalidBehavior() : ''); - } elseif (null !== $reference && \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $reference->getInvalidBehavior()) { + $code = sprintf('$this->get(%s%s)', $this->doExport($id), null !== $reference ? ', ' . $reference->getInvalidBehavior() : ''); + } elseif (null !== $reference && ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $reference->getInvalidBehavior()) { $code = 'null'; if (!$definition->isShared()) { return $code; } } elseif ($this->isTrivialInstance($definition)) { - $code = \substr($this->addNewInstance($definition, '', '', $id), 8, -2); + $code = substr($this->addNewInstance($definition, '', '', $id), 8, -2); if ($definition->isShared()) { - $code = \sprintf('$this->services[%s] = %s', $this->doExport($id), $code); + $code = sprintf('$this->services[%s] = %s', $this->doExport($id), $code); } $code = "({$code})"; } elseif ($this->asFiles && $definition->isShared() && !$this->isHotPath($definition)) { - $code = \sprintf("\$this->load('%s.php')", $this->generateMethodName($id)); + $code = sprintf("\$this->load('%s.php')", $this->generateMethodName($id)); } else { - $code = \sprintf('$this->%s()', $this->generateMethodName($id)); + $code = sprintf('$this->%s()', $this->generateMethodName($id)); } - } elseif (null !== $reference && \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $reference->getInvalidBehavior()) { + } elseif (null !== $reference && ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $reference->getInvalidBehavior()) { return 'null'; - } elseif (null !== $reference && \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $reference->getInvalidBehavior()) { - $code = \sprintf('$this->get(%s, /* ContainerInterface::NULL_ON_INVALID_REFERENCE */ %d)', $this->doExport($id), \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::NULL_ON_INVALID_REFERENCE); + } elseif (null !== $reference && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $reference->getInvalidBehavior()) { + $code = sprintf('$this->get(%s, /* ContainerInterface::NULL_ON_INVALID_REFERENCE */ %d)', $this->doExport($id), ContainerInterface::NULL_ON_INVALID_REFERENCE); } else { - $code = \sprintf('$this->get(%s)', $this->doExport($id)); + $code = sprintf('$this->get(%s)', $this->doExport($id)); } // The following is PHP 5.5 syntax for what could be written as "(\$this->services['$id'] ?? $code)" on PHP>=7.0 - return \sprintf("\${(\$_ = isset(\$this->services[%s]) ? \$this->services[%1\$s] : %s) && false ?: '_'}", $this->doExport($id), $code); + return sprintf("\${(\$_ = isset(\$this->services[%s]) ? \$this->services[%1\$s] : %s) && false ?: '_'}", $this->doExport($id), $code); } /** * Initializes the method names map to avoid conflicts with the Container methods. @@ -1616,7 +1674,7 @@ private function initializeMethodNamesMap($class) $this->usedMethodNames = []; if ($reflectionClass = $this->container->getReflectionClass($class)) { foreach ($reflectionClass->getMethods() as $method) { - $this->usedMethodNames[\strtolower($method->getName())] = \true; + $this->usedMethodNames[strtolower($method->getName())] = true; } } } @@ -1634,17 +1692,17 @@ private function generateMethodName($id) if (isset($this->serviceIdToMethodNameMap[$id])) { return $this->serviceIdToMethodNameMap[$id]; } - $i = \strrpos($id, '\\'); - $name = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container::camelize(\false !== $i && isset($id[1 + $i]) ? \substr($id, 1 + $i) : $id); - $name = \preg_replace('/[^a-zA-Z0-9_\\x7f-\\xff]/', '', $name); + $i = strrpos($id, '\\'); + $name = Container::camelize(false !== $i && isset($id[1 + $i]) ? substr($id, 1 + $i) : $id); + $name = preg_replace('/[^a-zA-Z0-9_\\x7f-\\xff]/', '', $name); $methodName = 'get' . $name . 'Service'; $suffix = 1; - while (isset($this->usedMethodNames[\strtolower($methodName)])) { + while (isset($this->usedMethodNames[strtolower($methodName)])) { ++$suffix; $methodName = 'get' . $name . $suffix . 'Service'; } $this->serviceIdToMethodNameMap[$id] = $methodName; - $this->usedMethodNames[\strtolower($methodName)] = \true; + $this->usedMethodNames[strtolower($methodName)] = true; return $methodName; } /** @@ -1655,10 +1713,10 @@ private function generateMethodName($id) private function getNextVariableName() { $firstChars = self::FIRST_CHARS; - $firstCharsLength = \strlen($firstChars); + $firstCharsLength = strlen($firstChars); $nonFirstChars = self::NON_FIRST_CHARS; - $nonFirstCharsLength = \strlen($nonFirstChars); - while (\true) { + $nonFirstCharsLength = strlen($nonFirstChars); + while (true) { $name = ''; $i = $this->variableCount; if ('' === $name) { @@ -1672,7 +1730,7 @@ private function getNextVariableName() } ++$this->variableCount; // check that the name is not reserved - if (\in_array($name, $this->reservedVariables, \true)) { + if (in_array($name, $this->reservedVariables, true)) { continue; } return $name; @@ -1681,16 +1739,16 @@ private function getNextVariableName() private function getExpressionLanguage() { if (null === $this->expressionLanguage) { - if (!\class_exists('_PhpScoper5ea00cc67502b\\Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage')) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.'); + if (!class_exists('_PhpScoper5ea00cc67502b\\Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage')) { + throw new RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.'); } $providers = $this->container->getExpressionLanguageProviders(); - $this->expressionLanguage = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ExpressionLanguage(null, $providers, function ($arg) { - $id = '""' === \substr_replace($arg, '', 1, -1) ? \stripcslashes(\substr($arg, 1, -1)) : null; + $this->expressionLanguage = new ExpressionLanguage(null, $providers, function ($arg) { + $id = '""' === substr_replace($arg, '', 1, -1) ? stripcslashes(substr($arg, 1, -1)) : null; if (null !== $id && ($this->container->hasAlias($id) || $this->container->hasDefinition($id))) { return $this->getServiceCall($id); } - return \sprintf('$this->get(%s)', $arg); + return sprintf('$this->get(%s)', $arg); }); if ($this->container->isTrackingResources()) { foreach ($providers as $provider) { @@ -1700,49 +1758,49 @@ private function getExpressionLanguage() } return $this->expressionLanguage; } - private function isHotPath(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition) + private function isHotPath(Definition $definition) { return $this->hotPathTag && $definition->hasTag($this->hotPathTag) && !$definition->isDeprecated(); } private function export($value) { - if (null !== $this->targetDirRegex && \is_string($value) && \preg_match($this->targetDirRegex, $value, $matches, \PREG_OFFSET_CAPTURE)) { - $prefix = $matches[0][1] ? $this->doExport(\substr($value, 0, $matches[0][1]), \true) . '.' : ''; - $suffix = $matches[0][1] + \strlen($matches[0][0]); - $suffix = isset($value[$suffix]) ? '.' . $this->doExport(\substr($value, $suffix), \true) : ''; + if (null !== $this->targetDirRegex && is_string($value) && preg_match($this->targetDirRegex, $value, $matches, PREG_OFFSET_CAPTURE)) { + $prefix = $matches[0][1] ? $this->doExport(substr($value, 0, $matches[0][1]), true) . '.' : ''; + $suffix = $matches[0][1] + strlen($matches[0][0]); + $suffix = isset($value[$suffix]) ? '.' . $this->doExport(substr($value, $suffix), true) : ''; $dirname = $this->asFiles ? '$this->containerDir' : '__DIR__'; - $offset = 1 + $this->targetDirMaxMatches - \count($matches); + $offset = 1 + $this->targetDirMaxMatches - count($matches); if ($this->asFiles || 0 < $offset) { - $dirname = \sprintf('$this->targetDirs[%d]', $offset); + $dirname = sprintf('$this->targetDirs[%d]', $offset); } if ($prefix || $suffix) { - return \sprintf('(%s%s%s)', $prefix, $dirname, $suffix); + return sprintf('(%s%s%s)', $prefix, $dirname, $suffix); } return $dirname; } - return $this->doExport($value, \true); + return $this->doExport($value, true); } - private function doExport($value, $resolveEnv = \false) + private function doExport($value, $resolveEnv = false) { - if (\is_string($value) && \false !== \strpos($value, "\n")) { - $cleanParts = \explode("\n", $value); - $cleanParts = \array_map(function ($part) { - return \var_export($part, \true); + if (is_string($value) && false !== strpos($value, "\n")) { + $cleanParts = explode("\n", $value); + $cleanParts = array_map(function ($part) { + return var_export($part, true); }, $cleanParts); - $export = \implode('."\\n".', $cleanParts); + $export = implode('."\\n".', $cleanParts); } else { - $export = \var_export($value, \true); + $export = var_export($value, true); } if ($resolveEnv && "'" === $export[0] && $export !== ($resolvedExport = $this->container->resolveEnvPlaceholders($export, "'.\$this->getEnv('string:%s').'"))) { $export = $resolvedExport; - if (".''" === \substr($export, -3)) { - $export = \substr($export, 0, -3); + if (".''" === substr($export, -3)) { + $export = substr($export, 0, -3); if ("'" === $export[1]) { - $export = \substr_replace($export, '', 18, 7); + $export = substr_replace($export, '', 18, 7); } } if ("'" === $export[1]) { - $export = \substr($export, 3); + $export = substr($export, 3); } } return $export; diff --git a/vendor/symfony/dependency-injection/Dumper/XmlDumper.php b/vendor/symfony/dependency-injection/Dumper/XmlDumper.php index f378d978e..35939679c 100644 --- a/vendor/symfony/dependency-injection/Dumper/XmlDumper.php +++ b/vendor/symfony/dependency-injection/Dumper/XmlDumper.php @@ -20,16 +20,31 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Parameter; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression; +use DOMDocument; +use DOMElement; +use function array_keys; +use function count; +use function in_array; +use function is_array; +use function is_numeric; +use function is_object; +use function is_resource; +use function is_string; +use function preg_match; +use function range; +use function str_replace; +use function substr; + /** * XmlDumper dumps a service container as an XML string. * * @author Fabien Potencier * @author Martin Hasoň */ -class XmlDumper extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\Dumper +class XmlDumper extends Dumper { /** - * @var \DOMDocument + * @var DOMDocument */ private $document; /** @@ -39,8 +54,8 @@ class XmlDumper extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInj */ public function dump(array $options = []) { - $this->document = new \DOMDocument('1.0', 'utf-8'); - $this->document->formatOutput = \true; + $this->document = new DOMDocument('1.0', 'utf-8'); + $this->document->formatOutput = true; $container = $this->document->createElementNS('http://symfony.com/schema/dic/services', 'container'); $container->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); $container->setAttribute('xsi:schemaLocation', 'http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd'); @@ -51,7 +66,7 @@ public function dump(array $options = []) $this->document = null; return $this->container->resolveEnvPlaceholders($xml); } - private function addParameters(\DOMElement $parent) + private function addParameters(DOMElement $parent) { $data = $this->container->getParameterBag()->all(); if (!$data) { @@ -64,12 +79,12 @@ private function addParameters(\DOMElement $parent) $parent->appendChild($parameters); $this->convertParameters($data, 'parameter', $parameters); } - private function addMethodCalls(array $methodcalls, \DOMElement $parent) + private function addMethodCalls(array $methodcalls, DOMElement $parent) { foreach ($methodcalls as $methodcall) { $call = $this->document->createElement('call'); $call->setAttribute('method', $methodcall[0]); - if (\count($methodcall[1])) { + if (count($methodcall[1])) { $this->convertParameters($methodcall[1], 'argument', $call); } $parent->appendChild($call); @@ -81,15 +96,15 @@ private function addMethodCalls(array $methodcalls, \DOMElement $parent) * @param Definition $definition * @param string $id */ - private function addService($definition, $id, \DOMElement $parent) + private function addService($definition, $id, DOMElement $parent) { $service = $this->document->createElement('service'); if (null !== $id) { $service->setAttribute('id', $id); } if ($class = $definition->getClass()) { - if ('\\' === \substr($class, 0, 1)) { - $class = \substr($class, 1); + if ('\\' === substr($class, 0, 1)) { + $class = substr($class, 1); } $service->setAttribute('class', $class); } @@ -106,7 +121,7 @@ private function addService($definition, $id, \DOMElement $parent) $service->setAttribute('lazy', 'true'); } if (null !== ($decorated = $definition->getDecoratedService())) { - list($decorated, $renamedId, $priority) = $decorated; + [$decorated, $renamedId, $priority] = $decorated; $service->setAttribute('decorates', $decorated); if (null !== $renamedId) { $service->setAttribute('decoration-inner-name', $renamedId); @@ -139,12 +154,12 @@ private function addService($definition, $id, \DOMElement $parent) $this->addMethodCalls($definition->getMethodCalls(), $service); if ($callable = $definition->getFactory()) { $factory = $this->document->createElement('factory'); - if (\is_array($callable) && $callable[0] instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition) { + if (is_array($callable) && $callable[0] instanceof Definition) { $this->addService($callable[0], null, $factory); $factory->setAttribute('method', $callable[1]); - } elseif (\is_array($callable)) { + } elseif (is_array($callable)) { if (null !== $callable[0]) { - $factory->setAttribute($callable[0] instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference ? 'service' : 'class', $callable[0]); + $factory->setAttribute($callable[0] instanceof Reference ? 'service' : 'class', $callable[0]); } $factory->setAttribute('method', $callable[1]); } else { @@ -160,7 +175,7 @@ private function addService($definition, $id, \DOMElement $parent) if ($definition->isAutowired()) { $service->setAttribute('autowire', 'true'); } - foreach ($definition->getAutowiringTypes(\false) as $autowiringTypeValue) { + foreach ($definition->getAutowiringTypes(false) as $autowiringTypeValue) { $autowiringType = $this->document->createElement('autowiring-type'); $autowiringType->appendChild($this->document->createTextNode($autowiringTypeValue)); $service->appendChild($autowiringType); @@ -173,11 +188,11 @@ private function addService($definition, $id, \DOMElement $parent) } if ($callable = $definition->getConfigurator()) { $configurator = $this->document->createElement('configurator'); - if (\is_array($callable) && $callable[0] instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition) { + if (is_array($callable) && $callable[0] instanceof Definition) { $this->addService($callable[0], null, $configurator); $configurator->setAttribute('method', $callable[1]); - } elseif (\is_array($callable)) { - $configurator->setAttribute($callable[0] instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference ? 'service' : 'class', $callable[0]); + } elseif (is_array($callable)) { + $configurator->setAttribute($callable[0] instanceof Reference ? 'service' : 'class', $callable[0]); $configurator->setAttribute('method', $callable[1]); } else { $configurator->setAttribute('function', $callable); @@ -191,7 +206,7 @@ private function addService($definition, $id, \DOMElement $parent) * * @param string $alias */ - private function addServiceAlias($alias, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Alias $id, \DOMElement $parent) + private function addServiceAlias($alias, Alias $id, DOMElement $parent) { $service = $this->document->createElement('service'); $service->setAttribute('id', $alias); @@ -201,7 +216,7 @@ private function addServiceAlias($alias, \_PhpScoper5ea00cc67502b\Symfony\Compon } $parent->appendChild($service); } - private function addServices(\DOMElement $parent) + private function addServices(DOMElement $parent) { $definitions = $this->container->getDefinitions(); if (!$definitions) { @@ -226,49 +241,49 @@ private function addServices(\DOMElement $parent) * @param string $type * @param string $keyAttribute */ - private function convertParameters(array $parameters, $type, \DOMElement $parent, $keyAttribute = 'key') + private function convertParameters(array $parameters, $type, DOMElement $parent, $keyAttribute = 'key') { - $withKeys = \array_keys($parameters) !== \range(0, \count($parameters) - 1); + $withKeys = array_keys($parameters) !== range(0, count($parameters) - 1); foreach ($parameters as $key => $value) { $element = $this->document->createElement($type); if ($withKeys) { $element->setAttribute($keyAttribute, $key); } - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument) { + if ($value instanceof ServiceClosureArgument) { $value = $value->getValues()[0]; } - if (\is_array($value)) { + if (is_array($value)) { $element->setAttribute('type', 'collection'); $this->convertParameters($value, $type, $element, 'key'); - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument) { + } elseif ($value instanceof TaggedIteratorArgument) { $element->setAttribute('type', 'tagged'); $element->setAttribute('tag', $value->getTag()); - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument) { + } elseif ($value instanceof IteratorArgument) { $element->setAttribute('type', 'iterator'); $this->convertParameters($value->getValues(), $type, $element, 'key'); - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference) { + } elseif ($value instanceof Reference) { $element->setAttribute('type', 'service'); $element->setAttribute('id', (string) $value); $behavior = $value->getInvalidBehavior(); - if (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::NULL_ON_INVALID_REFERENCE == $behavior) { + if (ContainerInterface::NULL_ON_INVALID_REFERENCE == $behavior) { $element->setAttribute('on-invalid', 'null'); - } elseif (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE == $behavior) { + } elseif (ContainerInterface::IGNORE_ON_INVALID_REFERENCE == $behavior) { $element->setAttribute('on-invalid', 'ignore'); - } elseif (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE == $behavior) { + } elseif (ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE == $behavior) { $element->setAttribute('on-invalid', 'ignore_uninitialized'); } - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition) { + } elseif ($value instanceof Definition) { $element->setAttribute('type', 'service'); $this->addService($value, null, $element); - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression) { + } elseif ($value instanceof Expression) { $element->setAttribute('type', 'expression'); $text = $this->document->createTextNode(self::phpToXml((string) $value)); $element->appendChild($text); } else { - if (\in_array($value, ['null', 'true', 'false'], \true)) { + if (in_array($value, ['null', 'true', 'false'], true)) { $element->setAttribute('type', 'string'); } - if (\is_string($value) && (\is_numeric($value) || \preg_match('/^0b[01]*$/', $value) || \preg_match('/^0x[0-9a-f]++$/i', $value))) { + if (is_string($value) && (is_numeric($value) || preg_match('/^0b[01]*$/', $value) || preg_match('/^0x[0-9a-f]++$/i', $value))) { $element->setAttribute('type', 'string'); } $text = $this->document->createTextNode(self::phpToXml($value)); @@ -286,10 +301,10 @@ private function escape(array $arguments) { $args = []; foreach ($arguments as $k => $v) { - if (\is_array($v)) { + if (is_array($v)) { $args[$k] = $this->escape($v); - } elseif (\is_string($v)) { - $args[$k] = \str_replace('%', '%%', $v); + } elseif (is_string($v)) { + $args[$k] = str_replace('%', '%%', $v); } else { $args[$k] = $v; } @@ -307,17 +322,17 @@ private function escape(array $arguments) */ public static function phpToXml($value) { - switch (\true) { + switch (true) { case null === $value: return 'null'; - case \true === $value: + case true === $value: return 'true'; - case \false === $value: + case false === $value: return 'false'; - case $value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Parameter: + case $value instanceof Parameter: return '%' . $value . '%'; - case \is_object($value) || \is_resource($value): - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException('Unable to dump a service container if a parameter is an object or a resource.'); + case is_object($value) || is_resource($value): + throw new RuntimeException('Unable to dump a service container if a parameter is an object or a resource.'); default: return (string) $value; } diff --git a/vendor/symfony/dependency-injection/Dumper/YamlDumper.php b/vendor/symfony/dependency-injection/Dumper/YamlDumper.php index c3e5f9393..6540a7a08 100644 --- a/vendor/symfony/dependency-injection/Dumper/YamlDumper.php +++ b/vendor/symfony/dependency-injection/Dumper/YamlDumper.php @@ -25,12 +25,24 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser; use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue; use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml; +use function class_exists; +use function get_class; +use function implode; +use function is_array; +use function is_object; +use function is_resource; +use function is_string; +use function sprintf; +use function str_replace; +use function strpos; +use function substr; + /** * YamlDumper dumps a service container as a YAML string. * * @author Fabien Potencier */ -class YamlDumper extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\Dumper +class YamlDumper extends Dumper { private $dumper; /** @@ -40,11 +52,11 @@ class YamlDumper extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyIn */ public function dump(array $options = []) { - if (!\class_exists('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Dumper')) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException('Unable to dump the container as the Symfony Yaml Component is not installed.'); + if (!class_exists('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Dumper')) { + throw new RuntimeException('Unable to dump the container as the Symfony Yaml Component is not installed.'); } if (null === $this->dumper) { - $this->dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Dumper(); + $this->dumper = new YmlDumper(); } return $this->container->resolveEnvPlaceholders($this->addParameters() . "\n" . $this->addServices()); } @@ -55,50 +67,50 @@ public function dump(array $options = []) * * @return string */ - private function addService($id, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition) + private function addService($id, Definition $definition) { $code = " {$id}:\n"; if ($class = $definition->getClass()) { - if ('\\' === \substr($class, 0, 1)) { - $class = \substr($class, 1); + if ('\\' === substr($class, 0, 1)) { + $class = substr($class, 1); } - $code .= \sprintf(" class: %s\n", $this->dumper->dump($class)); + $code .= sprintf(" class: %s\n", $this->dumper->dump($class)); } if (!$definition->isPrivate()) { - $code .= \sprintf(" public: %s\n", $definition->isPublic() ? 'true' : 'false'); + $code .= sprintf(" public: %s\n", $definition->isPublic() ? 'true' : 'false'); } $tagsCode = ''; foreach ($definition->getTags() as $name => $tags) { foreach ($tags as $attributes) { $att = []; foreach ($attributes as $key => $value) { - $att[] = \sprintf('%s: %s', $this->dumper->dump($key), $this->dumper->dump($value)); + $att[] = sprintf('%s: %s', $this->dumper->dump($key), $this->dumper->dump($value)); } - $att = $att ? ', ' . \implode(', ', $att) : ''; - $tagsCode .= \sprintf(" - { name: %s%s }\n", $this->dumper->dump($name), $att); + $att = $att ? ', ' . implode(', ', $att) : ''; + $tagsCode .= sprintf(" - { name: %s%s }\n", $this->dumper->dump($name), $att); } } if ($tagsCode) { $code .= " tags:\n" . $tagsCode; } if ($definition->getFile()) { - $code .= \sprintf(" file: %s\n", $this->dumper->dump($definition->getFile())); + $code .= sprintf(" file: %s\n", $this->dumper->dump($definition->getFile())); } if ($definition->isSynthetic()) { $code .= " synthetic: true\n"; } if ($definition->isDeprecated()) { - $code .= \sprintf(" deprecated: %s\n", $this->dumper->dump($definition->getDeprecationMessage('%service_id%'))); + $code .= sprintf(" deprecated: %s\n", $this->dumper->dump($definition->getDeprecationMessage('%service_id%'))); } if ($definition->isAutowired()) { $code .= " autowire: true\n"; } $autowiringTypesCode = ''; - foreach ($definition->getAutowiringTypes(\false) as $autowiringType) { - $autowiringTypesCode .= \sprintf(" - %s\n", $this->dumper->dump($autowiringType)); + foreach ($definition->getAutowiringTypes(false) as $autowiringType) { + $autowiringTypesCode .= sprintf(" - %s\n", $this->dumper->dump($autowiringType)); } if ($autowiringTypesCode) { - $code .= \sprintf(" autowiring_types:\n%s", $autowiringTypesCode); + $code .= sprintf(" autowiring_types:\n%s", $autowiringTypesCode); } if ($definition->isAutoconfigured()) { $code .= " autoconfigure: true\n"; @@ -110,32 +122,32 @@ private function addService($id, \_PhpScoper5ea00cc67502b\Symfony\Component\Depe $code .= " lazy: true\n"; } if ($definition->getArguments()) { - $code .= \sprintf(" arguments: %s\n", $this->dumper->dump($this->dumpValue($definition->getArguments()), 0)); + $code .= sprintf(" arguments: %s\n", $this->dumper->dump($this->dumpValue($definition->getArguments()), 0)); } if ($definition->getProperties()) { - $code .= \sprintf(" properties: %s\n", $this->dumper->dump($this->dumpValue($definition->getProperties()), 0)); + $code .= sprintf(" properties: %s\n", $this->dumper->dump($this->dumpValue($definition->getProperties()), 0)); } if ($definition->getMethodCalls()) { - $code .= \sprintf(" calls:\n%s\n", $this->dumper->dump($this->dumpValue($definition->getMethodCalls()), 1, 12)); + $code .= sprintf(" calls:\n%s\n", $this->dumper->dump($this->dumpValue($definition->getMethodCalls()), 1, 12)); } if (!$definition->isShared()) { $code .= " shared: false\n"; } if (null !== ($decorated = $definition->getDecoratedService())) { - list($decorated, $renamedId, $priority) = $decorated; - $code .= \sprintf(" decorates: %s\n", $decorated); + [$decorated, $renamedId, $priority] = $decorated; + $code .= sprintf(" decorates: %s\n", $decorated); if (null !== $renamedId) { - $code .= \sprintf(" decoration_inner_name: %s\n", $renamedId); + $code .= sprintf(" decoration_inner_name: %s\n", $renamedId); } if (0 !== $priority) { - $code .= \sprintf(" decoration_priority: %s\n", $priority); + $code .= sprintf(" decoration_priority: %s\n", $priority); } } if ($callable = $definition->getFactory()) { - $code .= \sprintf(" factory: %s\n", $this->dumper->dump($this->dumpCallable($callable), 0)); + $code .= sprintf(" factory: %s\n", $this->dumper->dump($this->dumpCallable($callable), 0)); } if ($callable = $definition->getConfigurator()) { - $code .= \sprintf(" configurator: %s\n", $this->dumper->dump($this->dumpCallable($callable), 0)); + $code .= sprintf(" configurator: %s\n", $this->dumper->dump($this->dumpCallable($callable), 0)); } return $code; } @@ -146,12 +158,12 @@ private function addService($id, \_PhpScoper5ea00cc67502b\Symfony\Component\Depe * * @return string */ - private function addServiceAlias($alias, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Alias $id) + private function addServiceAlias($alias, Alias $id) { if ($id->isPrivate()) { - return \sprintf(" %s: '@%s'\n", $alias, $id); + return sprintf(" %s: '@%s'\n", $alias, $id); } - return \sprintf(" %s:\n alias: %s\n public: %s\n", $alias, $id, $id->isPublic() ? 'true' : 'false'); + return sprintf(" %s:\n alias: %s\n public: %s\n", $alias, $id, $id->isPublic() ? 'true' : 'false'); } /** * Adds services. @@ -196,8 +208,8 @@ private function addParameters() */ private function dumpCallable($callable) { - if (\is_array($callable)) { - if ($callable[0] instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference) { + if (is_array($callable)) { + if ($callable[0] instanceof Reference) { $callable = [$this->getServiceCall((string) $callable[0], $callable[0]), $callable[1]]; } else { $callable = [$callable[0], $callable[1]]; @@ -216,36 +228,36 @@ private function dumpCallable($callable) */ private function dumpValue($value) { - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument) { + if ($value instanceof ServiceClosureArgument) { $value = $value->getValues()[0]; } - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ArgumentInterface) { - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue('tagged', $value->getTag()); + if ($value instanceof ArgumentInterface) { + if ($value instanceof TaggedIteratorArgument) { + return new TaggedValue('tagged', $value->getTag()); } - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument) { + if ($value instanceof IteratorArgument) { $tag = 'iterator'; } else { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Unspecified Yaml tag for type "%s".', \get_class($value))); + throw new RuntimeException(sprintf('Unspecified Yaml tag for type "%s".', get_class($value))); } - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue($tag, $this->dumpValue($value->getValues())); + return new TaggedValue($tag, $this->dumpValue($value->getValues())); } - if (\is_array($value)) { + if (is_array($value)) { $code = []; foreach ($value as $k => $v) { $code[$k] = $this->dumpValue($v); } return $code; - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference) { + } elseif ($value instanceof Reference) { return $this->getServiceCall((string) $value, $value); - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Parameter) { + } elseif ($value instanceof Parameter) { return $this->getParameterCall((string) $value); - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression) { + } elseif ($value instanceof Expression) { return $this->getExpressionCall((string) $value); - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue('service', (new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser())->parse("_:\n" . $this->addService('_', $value), \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_CUSTOM_TAGS)['_']['_']); - } elseif (\is_object($value) || \is_resource($value)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException('Unable to dump a service container if a parameter is an object or a resource.'); + } elseif ($value instanceof Definition) { + return new TaggedValue('service', (new Parser())->parse("_:\n" . $this->addService('_', $value), Yaml::PARSE_CUSTOM_TAGS)['_']['_']); + } elseif (is_object($value) || is_resource($value)) { + throw new RuntimeException('Unable to dump a service container if a parameter is an object or a resource.'); } return $value; } @@ -257,19 +269,19 @@ private function dumpValue($value) * * @return string */ - private function getServiceCall($id, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference $reference = null) + private function getServiceCall($id, Reference $reference = null) { if (null !== $reference) { switch ($reference->getInvalidBehavior()) { - case \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE: + case ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE: break; - case \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE: - return \sprintf('@!%s', $id); + case ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE: + return sprintf('@!%s', $id); default: - return \sprintf('@?%s', $id); + return sprintf('@?%s', $id); } } - return \sprintf('@%s', $id); + return sprintf('@%s', $id); } /** * Gets parameter call. @@ -280,11 +292,11 @@ private function getServiceCall($id, \_PhpScoper5ea00cc67502b\Symfony\Component\ */ private function getParameterCall($id) { - return \sprintf('%%%s%%', $id); + return sprintf('%%%s%%', $id); } private function getExpressionCall($expression) { - return \sprintf('@=%s', $expression); + return sprintf('@=%s', $expression); } /** * Prepares parameters. @@ -293,13 +305,13 @@ private function getExpressionCall($expression) * * @return array */ - private function prepareParameters(array $parameters, $escape = \true) + private function prepareParameters(array $parameters, $escape = true) { $filtered = []; foreach ($parameters as $key => $value) { - if (\is_array($value)) { + if (is_array($value)) { $value = $this->prepareParameters($value, $escape); - } elseif ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference || \is_string($value) && 0 === \strpos($value, '@')) { + } elseif ($value instanceof Reference || is_string($value) && 0 === strpos($value, '@')) { $value = '@' . $value; } $filtered[$key] = $value; @@ -315,10 +327,10 @@ private function escape(array $arguments) { $args = []; foreach ($arguments as $k => $v) { - if (\is_array($v)) { + if (is_array($v)) { $args[$k] = $this->escape($v); - } elseif (\is_string($v)) { - $args[$k] = \str_replace('%', '%%', $v); + } elseif (is_string($v)) { + $args[$k] = str_replace('%', '%%', $v); } else { $args[$k] = $v; } diff --git a/vendor/symfony/dependency-injection/Dumper/index.php b/vendor/symfony/dependency-injection/Dumper/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Dumper/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/EnvVarProcessor.php b/vendor/symfony/dependency-injection/EnvVarProcessor.php index d6ea2e186..79d27fbb2 100644 --- a/vendor/symfony/dependency-injection/EnvVarProcessor.php +++ b/vendor/symfony/dependency-injection/EnvVarProcessor.php @@ -13,13 +13,33 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\EnvNotFoundException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Closure; +use function base64_decode; +use function class_exists; +use function constant; +use function defined; +use function file_exists; +use function file_get_contents; +use function getenv; +use function gettype; +use function is_array; +use function is_numeric; +use function is_scalar; +use function json_decode; +use function json_last_error; +use function json_last_error_msg; +use function preg_replace_callback; +use function sprintf; +use function strpos; +use const JSON_ERROR_NONE; + /** * @author Nicolas Grekas */ -class EnvVarProcessor implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\EnvVarProcessorInterface +class EnvVarProcessor implements EnvVarProcessorInterface { private $container; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface $container) + public function __construct(ContainerInterface $container) { $this->container = $container; } @@ -33,37 +53,37 @@ public static function getProvidedTypes() /** * {@inheritdoc} */ - public function getEnv($prefix, $name, \Closure $getEnv) + public function getEnv($prefix, $name, Closure $getEnv) { - $i = \strpos($name, ':'); + $i = strpos($name, ':'); if ('file' === $prefix) { - if (!\is_scalar($file = $getEnv($name))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Invalid file name: env var "%s" is non-scalar.', $name)); + if (!is_scalar($file = $getEnv($name))) { + throw new RuntimeException(sprintf('Invalid file name: env var "%s" is non-scalar.', $name)); } - if (!\file_exists($file)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Env "file:%s" not found: "%s" does not exist.', $name, $file)); + if (!file_exists($file)) { + throw new RuntimeException(sprintf('Env "file:%s" not found: "%s" does not exist.', $name, $file)); } - return \file_get_contents($file); + return file_get_contents($file); } - if (\false !== $i || 'string' !== $prefix) { + if (false !== $i || 'string' !== $prefix) { if (null === ($env = $getEnv($name))) { return null; } } elseif (isset($_ENV[$name])) { $env = $_ENV[$name]; - } elseif (isset($_SERVER[$name]) && 0 !== \strpos($name, 'HTTP_')) { + } elseif (isset($_SERVER[$name]) && 0 !== strpos($name, 'HTTP_')) { $env = $_SERVER[$name]; - } elseif (\false === ($env = \getenv($name)) || null === $env) { + } elseif (false === ($env = getenv($name)) || null === $env) { // null is a possible value because of thread safety issues if (!$this->container->hasParameter("env({$name})")) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\EnvNotFoundException($name); + throw new EnvNotFoundException($name); } if (null === ($env = $this->container->getParameter("env({$name})"))) { return null; } } - if (!\is_scalar($env)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Non-scalar env var "%s" cannot be cast to "%s".', $name, $prefix)); + if (!is_scalar($env)) { + throw new RuntimeException(sprintf('Non-scalar env var "%s" cannot be cast to "%s".', $name, $prefix)); } if ('string' === $prefix) { return (string) $env; @@ -72,55 +92,55 @@ public function getEnv($prefix, $name, \Closure $getEnv) return (bool) self::phpize($env); } if ('int' === $prefix) { - if (!\is_numeric($env = self::phpize($env))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Non-numeric env var "%s" cannot be cast to int.', $name)); + if (!is_numeric($env = self::phpize($env))) { + throw new RuntimeException(sprintf('Non-numeric env var "%s" cannot be cast to int.', $name)); } return (int) $env; } if ('float' === $prefix) { - if (!\is_numeric($env = self::phpize($env))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Non-numeric env var "%s" cannot be cast to float.', $name)); + if (!is_numeric($env = self::phpize($env))) { + throw new RuntimeException(sprintf('Non-numeric env var "%s" cannot be cast to float.', $name)); } return (float) $env; } if ('const' === $prefix) { - if (!\defined($env)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Env var "%s" maps to undefined constant "%s".', $name, $env)); + if (!defined($env)) { + throw new RuntimeException(sprintf('Env var "%s" maps to undefined constant "%s".', $name, $env)); } - return \constant($env); + return constant($env); } if ('base64' === $prefix) { - return \base64_decode($env); + return base64_decode($env); } if ('json' === $prefix) { - $env = \json_decode($env, \true); - if (\JSON_ERROR_NONE !== \json_last_error()) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Invalid JSON in env var "%s": ' . \json_last_error_msg(), $name)); + $env = json_decode($env, true); + if (JSON_ERROR_NONE !== json_last_error()) { + throw new RuntimeException(sprintf('Invalid JSON in env var "%s": ' . json_last_error_msg(), $name)); } - if (!\is_array($env)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Invalid JSON env var "%s": array expected, "%s" given.', $name, \gettype($env))); + if (!is_array($env)) { + throw new RuntimeException(sprintf('Invalid JSON env var "%s": array expected, "%s" given.', $name, gettype($env))); } return $env; } if ('resolve' === $prefix) { - return \preg_replace_callback('/%%|%([^%\\s]+)%/', function ($match) use($name) { + return preg_replace_callback('/%%|%([^%\\s]+)%/', function ($match) use($name) { if (!isset($match[1])) { return '%'; } $value = $this->container->getParameter($match[1]); - if (!\is_scalar($value)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Parameter "%s" found when resolving env var "%s" must be scalar, "%s" given.', $match[1], $name, \gettype($value))); + if (!is_scalar($value)) { + throw new RuntimeException(sprintf('Parameter "%s" found when resolving env var "%s" must be scalar, "%s" given.', $match[1], $name, gettype($value))); } return $value; }, $env); } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Unsupported env var prefix "%s".', $prefix)); + throw new RuntimeException(sprintf('Unsupported env var prefix "%s".', $prefix)); } private static function phpize($value) { - if (!\class_exists(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::class)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException('The Symfony Config component is required to cast env vars to "bool", "int" or "float".'); + if (!class_exists(XmlUtils::class)) { + throw new RuntimeException('The Symfony Config component is required to cast env vars to "bool", "int" or "float".'); } - return \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::phpize($value); + return XmlUtils::phpize($value); } } diff --git a/vendor/symfony/dependency-injection/EnvVarProcessorInterface.php b/vendor/symfony/dependency-injection/EnvVarProcessorInterface.php index 4504638af..0dec8d7b5 100644 --- a/vendor/symfony/dependency-injection/EnvVarProcessorInterface.php +++ b/vendor/symfony/dependency-injection/EnvVarProcessorInterface.php @@ -11,6 +11,8 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Closure; + /** * The EnvVarProcessorInterface is implemented by objects that manage environment-like variables. * @@ -23,13 +25,13 @@ interface EnvVarProcessorInterface * * @param string $prefix The namespace of the variable * @param string $name The name of the variable within the namespace - * @param \Closure $getEnv A closure that allows fetching more env vars + * @param Closure $getEnv A closure that allows fetching more env vars * * @return mixed * * @throws RuntimeException on error */ - public function getEnv($prefix, $name, \Closure $getEnv); + public function getEnv($prefix, $name, Closure $getEnv); /** * @return string[] The PHP-types managed by getEnv(), keyed by prefixes */ diff --git a/vendor/symfony/dependency-injection/Exception/AutowiringFailedException.php b/vendor/symfony/dependency-injection/Exception/AutowiringFailedException.php index c8004102a..e7cb47df2 100644 --- a/vendor/symfony/dependency-injection/Exception/AutowiringFailedException.php +++ b/vendor/symfony/dependency-injection/Exception/AutowiringFailedException.php @@ -10,13 +10,15 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception; +use Exception; + /** * Thrown when a definition cannot be autowired. */ -class AutowiringFailedException extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException +class AutowiringFailedException extends RuntimeException { private $serviceId; - public function __construct($serviceId, $message = '', $code = 0, \Exception $previous = null) + public function __construct($serviceId, $message = '', $code = 0, Exception $previous = null) { $this->serviceId = $serviceId; parent::__construct($message, $code, $previous); diff --git a/vendor/symfony/dependency-injection/Exception/BadMethodCallException.php b/vendor/symfony/dependency-injection/Exception/BadMethodCallException.php index eac16e3b5..6e1762685 100644 --- a/vendor/symfony/dependency-injection/Exception/BadMethodCallException.php +++ b/vendor/symfony/dependency-injection/Exception/BadMethodCallException.php @@ -13,6 +13,6 @@ /** * Base BadMethodCallException for Dependency Injection component. */ -class BadMethodCallException extends \BadMethodCallException implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ExceptionInterface +class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface { } diff --git a/vendor/symfony/dependency-injection/Exception/EnvNotFoundException.php b/vendor/symfony/dependency-injection/Exception/EnvNotFoundException.php index f71795ee6..20e6c8843 100644 --- a/vendor/symfony/dependency-injection/Exception/EnvNotFoundException.php +++ b/vendor/symfony/dependency-injection/Exception/EnvNotFoundException.php @@ -10,15 +10,17 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception; +use function sprintf; + /** * This exception is thrown when an environment variable is not found. * * @author Nicolas Grekas */ -class EnvNotFoundException extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException +class EnvNotFoundException extends InvalidArgumentException { public function __construct($name) { - parent::__construct(\sprintf('Environment variable not found: "%s".', $name)); + parent::__construct(sprintf('Environment variable not found: "%s".', $name)); } } diff --git a/vendor/symfony/dependency-injection/Exception/EnvParameterException.php b/vendor/symfony/dependency-injection/Exception/EnvParameterException.php index 66630c304..2c71cf7cb 100644 --- a/vendor/symfony/dependency-injection/Exception/EnvParameterException.php +++ b/vendor/symfony/dependency-injection/Exception/EnvParameterException.php @@ -10,15 +10,19 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception; +use Exception; +use function implode; +use function sprintf; + /** * This exception wraps exceptions whose messages contain a reference to an env parameter. * * @author Nicolas Grekas */ -class EnvParameterException extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException +class EnvParameterException extends InvalidArgumentException { - public function __construct(array $envs, \Exception $previous = null, $message = 'Incompatible use of dynamic environment variables "%s" found in parameters.') + public function __construct(array $envs, Exception $previous = null, $message = 'Incompatible use of dynamic environment variables "%s" found in parameters.') { - parent::__construct(\sprintf($message, \implode('", "', $envs)), 0, $previous); + parent::__construct(sprintf($message, implode('", "', $envs)), 0, $previous); } } diff --git a/vendor/symfony/dependency-injection/Exception/ExceptionInterface.php b/vendor/symfony/dependency-injection/Exception/ExceptionInterface.php index f6c31e185..b8c8bc93c 100644 --- a/vendor/symfony/dependency-injection/Exception/ExceptionInterface.php +++ b/vendor/symfony/dependency-injection/Exception/ExceptionInterface.php @@ -17,6 +17,6 @@ * @author Fabien Potencier * @author Bulat Shakirzyanov */ -interface ExceptionInterface extends \_PhpScoper5ea00cc67502b\Psr\Container\ContainerExceptionInterface +interface ExceptionInterface extends ContainerExceptionInterface { } diff --git a/vendor/symfony/dependency-injection/Exception/InvalidArgumentException.php b/vendor/symfony/dependency-injection/Exception/InvalidArgumentException.php index 52cc05305..fe8877f34 100644 --- a/vendor/symfony/dependency-injection/Exception/InvalidArgumentException.php +++ b/vendor/symfony/dependency-injection/Exception/InvalidArgumentException.php @@ -15,6 +15,6 @@ * * @author Bulat Shakirzyanov */ -class InvalidArgumentException extends \InvalidArgumentException implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ExceptionInterface +class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface { } diff --git a/vendor/symfony/dependency-injection/Exception/LogicException.php b/vendor/symfony/dependency-injection/Exception/LogicException.php index 7ab622485..42b209992 100644 --- a/vendor/symfony/dependency-injection/Exception/LogicException.php +++ b/vendor/symfony/dependency-injection/Exception/LogicException.php @@ -13,6 +13,6 @@ /** * Base LogicException for Dependency Injection component. */ -class LogicException extends \LogicException implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ExceptionInterface +class LogicException extends \LogicException implements ExceptionInterface { } diff --git a/vendor/symfony/dependency-injection/Exception/OutOfBoundsException.php b/vendor/symfony/dependency-injection/Exception/OutOfBoundsException.php index 77aa6199b..4bf39c052 100644 --- a/vendor/symfony/dependency-injection/Exception/OutOfBoundsException.php +++ b/vendor/symfony/dependency-injection/Exception/OutOfBoundsException.php @@ -13,6 +13,6 @@ /** * Base OutOfBoundsException for Dependency Injection component. */ -class OutOfBoundsException extends \OutOfBoundsException implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ExceptionInterface +class OutOfBoundsException extends \OutOfBoundsException implements ExceptionInterface { } diff --git a/vendor/symfony/dependency-injection/Exception/ParameterCircularReferenceException.php b/vendor/symfony/dependency-injection/Exception/ParameterCircularReferenceException.php index dfd3eca9f..94ba9a25f 100644 --- a/vendor/symfony/dependency-injection/Exception/ParameterCircularReferenceException.php +++ b/vendor/symfony/dependency-injection/Exception/ParameterCircularReferenceException.php @@ -10,17 +10,21 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception; +use Exception; +use function implode; +use function sprintf; + /** * This exception is thrown when a circular reference in a parameter is detected. * * @author Fabien Potencier */ -class ParameterCircularReferenceException extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException +class ParameterCircularReferenceException extends RuntimeException { private $parameters; - public function __construct($parameters, \Exception $previous = null) + public function __construct($parameters, Exception $previous = null) { - parent::__construct(\sprintf('Circular reference detected for parameter "%s" ("%s" > "%s").', $parameters[0], \implode('" > "', $parameters), $parameters[0]), 0, $previous); + parent::__construct(sprintf('Circular reference detected for parameter "%s" ("%s" > "%s").', $parameters[0], implode('" > "', $parameters), $parameters[0]), 0, $previous); $this->parameters = $parameters; } public function getParameters() diff --git a/vendor/symfony/dependency-injection/Exception/ParameterNotFoundException.php b/vendor/symfony/dependency-injection/Exception/ParameterNotFoundException.php index 7c209df11..eab858443 100644 --- a/vendor/symfony/dependency-injection/Exception/ParameterNotFoundException.php +++ b/vendor/symfony/dependency-injection/Exception/ParameterNotFoundException.php @@ -10,12 +10,17 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception; +use Exception; +use function count; +use function implode; +use function sprintf; + /** * This exception is thrown when a non-existent parameter is used. * * @author Fabien Potencier */ -class ParameterNotFoundException extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException +class ParameterNotFoundException extends InvalidArgumentException { private $key; private $sourceId; @@ -26,11 +31,11 @@ class ParameterNotFoundException extends \_PhpScoper5ea00cc67502b\Symfony\Compon * @param string $key The requested parameter key * @param string $sourceId The service id that references the non-existent parameter * @param string $sourceKey The parameter key that references the non-existent parameter - * @param \Exception $previous The previous exception + * @param Exception $previous The previous exception * @param string[] $alternatives Some parameter name alternatives * @param string|null $nonNestedAlternative The alternative parameter name when the user expected dot notation for nested parameters */ - public function __construct($key, $sourceId = null, $sourceKey = null, \Exception $previous = null, array $alternatives = [], $nonNestedAlternative = null) + public function __construct($key, $sourceId = null, $sourceKey = null, Exception $previous = null, array $alternatives = [], $nonNestedAlternative = null) { $this->key = $key; $this->sourceId = $sourceId; @@ -43,19 +48,19 @@ public function __construct($key, $sourceId = null, $sourceKey = null, \Exceptio public function updateRepr() { if (null !== $this->sourceId) { - $this->message = \sprintf('The service "%s" has a dependency on a non-existent parameter "%s".', $this->sourceId, $this->key); + $this->message = sprintf('The service "%s" has a dependency on a non-existent parameter "%s".', $this->sourceId, $this->key); } elseif (null !== $this->sourceKey) { - $this->message = \sprintf('The parameter "%s" has a dependency on a non-existent parameter "%s".', $this->sourceKey, $this->key); + $this->message = sprintf('The parameter "%s" has a dependency on a non-existent parameter "%s".', $this->sourceKey, $this->key); } else { - $this->message = \sprintf('You have requested a non-existent parameter "%s".', $this->key); + $this->message = sprintf('You have requested a non-existent parameter "%s".', $this->key); } if ($this->alternatives) { - if (1 == \count($this->alternatives)) { + if (1 == count($this->alternatives)) { $this->message .= ' Did you mean this: "'; } else { $this->message .= ' Did you mean one of these: "'; } - $this->message .= \implode('", "', $this->alternatives) . '"?'; + $this->message .= implode('", "', $this->alternatives) . '"?'; } elseif (null !== $this->nonNestedAlternative) { $this->message .= ' You cannot access nested array items, do you want to inject "' . $this->nonNestedAlternative . '" instead?'; } diff --git a/vendor/symfony/dependency-injection/Exception/RuntimeException.php b/vendor/symfony/dependency-injection/Exception/RuntimeException.php index d50d51485..24ff45155 100644 --- a/vendor/symfony/dependency-injection/Exception/RuntimeException.php +++ b/vendor/symfony/dependency-injection/Exception/RuntimeException.php @@ -15,6 +15,6 @@ * * @author Johannes M. Schmitt */ -class RuntimeException extends \RuntimeException implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ExceptionInterface +class RuntimeException extends \RuntimeException implements ExceptionInterface { } diff --git a/vendor/symfony/dependency-injection/Exception/ServiceCircularReferenceException.php b/vendor/symfony/dependency-injection/Exception/ServiceCircularReferenceException.php index a9043bd01..efb3dbb15 100644 --- a/vendor/symfony/dependency-injection/Exception/ServiceCircularReferenceException.php +++ b/vendor/symfony/dependency-injection/Exception/ServiceCircularReferenceException.php @@ -10,18 +10,22 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception; +use Exception; +use function implode; +use function sprintf; + /** * This exception is thrown when a circular reference is detected. * * @author Johannes M. Schmitt */ -class ServiceCircularReferenceException extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException +class ServiceCircularReferenceException extends RuntimeException { private $serviceId; private $path; - public function __construct($serviceId, array $path, \Exception $previous = null) + public function __construct($serviceId, array $path, Exception $previous = null) { - parent::__construct(\sprintf('Circular reference detected for service "%s", path: "%s".', $serviceId, \implode(' -> ', $path)), 0, $previous); + parent::__construct(sprintf('Circular reference detected for service "%s", path: "%s".', $serviceId, implode(' -> ', $path)), 0, $previous); $this->serviceId = $serviceId; $this->path = $path; } diff --git a/vendor/symfony/dependency-injection/Exception/ServiceNotFoundException.php b/vendor/symfony/dependency-injection/Exception/ServiceNotFoundException.php index 166c4921b..254e12322 100644 --- a/vendor/symfony/dependency-injection/Exception/ServiceNotFoundException.php +++ b/vendor/symfony/dependency-injection/Exception/ServiceNotFoundException.php @@ -11,32 +11,37 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception; use _PhpScoper5ea00cc67502b\Psr\Container\NotFoundExceptionInterface; +use Exception; +use function count; +use function implode; +use function sprintf; + /** * This exception is thrown when a non-existent service is requested. * * @author Johannes M. Schmitt */ -class ServiceNotFoundException extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException implements \_PhpScoper5ea00cc67502b\Psr\Container\NotFoundExceptionInterface +class ServiceNotFoundException extends InvalidArgumentException implements NotFoundExceptionInterface { private $id; private $sourceId; private $alternatives; - public function __construct($id, $sourceId = null, \Exception $previous = null, array $alternatives = [], $msg = null) + public function __construct($id, $sourceId = null, Exception $previous = null, array $alternatives = [], $msg = null) { if (null !== $msg) { // no-op } elseif (null === $sourceId) { - $msg = \sprintf('You have requested a non-existent service "%s".', $id); + $msg = sprintf('You have requested a non-existent service "%s".', $id); } else { - $msg = \sprintf('The service "%s" has a dependency on a non-existent service "%s".', $sourceId, $id); + $msg = sprintf('The service "%s" has a dependency on a non-existent service "%s".', $sourceId, $id); } if ($alternatives) { - if (1 == \count($alternatives)) { + if (1 == count($alternatives)) { $msg .= ' Did you mean this: "'; } else { $msg .= ' Did you mean one of these: "'; } - $msg .= \implode('", "', $alternatives) . '"?'; + $msg .= implode('", "', $alternatives) . '"?'; } parent::__construct($msg, 0, $previous); $this->id = $id; diff --git a/vendor/symfony/dependency-injection/Exception/index.php b/vendor/symfony/dependency-injection/Exception/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Exception/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/ExpressionLanguage.php b/vendor/symfony/dependency-injection/ExpressionLanguage.php index fe9239ca6..fd97f773e 100644 --- a/vendor/symfony/dependency-injection/ExpressionLanguage.php +++ b/vendor/symfony/dependency-injection/ExpressionLanguage.php @@ -11,6 +11,8 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionLanguage as BaseExpressionLanguage; +use function array_unshift; + /** * Adds some function to the default ExpressionLanguage. * @@ -18,7 +20,7 @@ * * @see ExpressionLanguageProvider */ -class ExpressionLanguage extends \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionLanguage +class ExpressionLanguage extends BaseExpressionLanguage { /** * {@inheritdoc} @@ -26,7 +28,7 @@ class ExpressionLanguage extends \_PhpScoper5ea00cc67502b\Symfony\Component\Expr public function __construct($cache = null, array $providers = [], callable $serviceCompiler = null) { // prepend the default provider to let users override it easily - \array_unshift($providers, new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ExpressionLanguageProvider($serviceCompiler)); + array_unshift($providers, new ExpressionLanguageProvider($serviceCompiler)); parent::__construct($cache, $providers); } } diff --git a/vendor/symfony/dependency-injection/ExpressionLanguageProvider.php b/vendor/symfony/dependency-injection/ExpressionLanguageProvider.php index 2b486c92d..1df141638 100644 --- a/vendor/symfony/dependency-injection/ExpressionLanguageProvider.php +++ b/vendor/symfony/dependency-injection/ExpressionLanguageProvider.php @@ -12,6 +12,8 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionFunction; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; +use function sprintf; + /** * Define some ExpressionLanguage functions. * @@ -20,7 +22,7 @@ * * @author Fabien Potencier */ -class ExpressionLanguageProvider implements \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface +class ExpressionLanguageProvider implements ExpressionFunctionProviderInterface { private $serviceCompiler; public function __construct(callable $serviceCompiler = null) @@ -29,12 +31,12 @@ public function __construct(callable $serviceCompiler = null) } public function getFunctions() { - return [new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionFunction('service', $this->serviceCompiler ?: function ($arg) { - return \sprintf('$this->get(%s)', $arg); + return [new ExpressionFunction('service', $this->serviceCompiler ?: function ($arg) { + return sprintf('$this->get(%s)', $arg); }, function (array $variables, $value) { return $variables['container']->get($value); - }), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionFunction('parameter', function ($arg) { - return \sprintf('$this->getParameter(%s)', $arg); + }), new ExpressionFunction('parameter', function ($arg) { + return sprintf('$this->getParameter(%s)', $arg); }, function (array $variables, $value) { return $variables['container']->getParameter($value); })]; diff --git a/vendor/symfony/dependency-injection/Extension/ConfigurationExtensionInterface.php b/vendor/symfony/dependency-injection/Extension/ConfigurationExtensionInterface.php index d2b7b45ad..c4b0e6f20 100644 --- a/vendor/symfony/dependency-injection/Extension/ConfigurationExtensionInterface.php +++ b/vendor/symfony/dependency-injection/Extension/ConfigurationExtensionInterface.php @@ -24,5 +24,5 @@ interface ConfigurationExtensionInterface * * @return ConfigurationInterface|null The configuration or null */ - public function getConfiguration(array $config, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container); + public function getConfiguration(array $config, ContainerBuilder $container); } diff --git a/vendor/symfony/dependency-injection/Extension/Extension.php b/vendor/symfony/dependency-injection/Extension/Extension.php index 5d5a92496..e90d47ed3 100644 --- a/vendor/symfony/dependency-injection/Extension/Extension.php +++ b/vendor/symfony/dependency-injection/Extension/Extension.php @@ -16,12 +16,19 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\BadMethodCallException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use function array_key_exists; +use function strpos; +use function strrchr; +use function strrpos; +use function substr; +use function substr_replace; + /** * Provides useful features shared by many extensions. * * @author Fabien Potencier */ -abstract class Extension implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Extension\ExtensionInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Extension\ConfigurationExtensionInterface +abstract class Extension implements ExtensionInterface, ConfigurationExtensionInterface { private $processedConfigs = []; /** @@ -29,7 +36,7 @@ abstract class Extension implements \_PhpScoper5ea00cc67502b\Symfony\Component\D */ public function getXsdValidationBasePath() { - return \false; + return false; } /** * {@inheritdoc} @@ -61,23 +68,23 @@ public function getNamespace() public function getAlias() { $className = static::class; - if ('Extension' != \substr($className, -9)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\BadMethodCallException('This extension does not follow the naming convention; you must overwrite the getAlias() method.'); + if ('Extension' != substr($className, -9)) { + throw new BadMethodCallException('This extension does not follow the naming convention; you must overwrite the getAlias() method.'); } - $classBaseName = \substr(\strrchr($className, '\\'), 1, -9); - return \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container::underscore($classBaseName); + $classBaseName = substr(strrchr($className, '\\'), 1, -9); + return Container::underscore($classBaseName); } /** * {@inheritdoc} */ - public function getConfiguration(array $config, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function getConfiguration(array $config, ContainerBuilder $container) { $class = static::class; - if (\false !== \strpos($class, "\0")) { + if (false !== strpos($class, "\0")) { return null; // ignore anonymous classes } - $class = \substr_replace($class, '\\Configuration', \strrpos($class, '\\')); + $class = substr_replace($class, '\\Configuration', strrpos($class, '\\')); $class = $container->getReflectionClass($class); $constructor = $class ? $class->getConstructor() : null; return $class && (!$constructor || !$constructor->getNumberOfRequiredParameters()) ? $class->newInstance() : null; @@ -85,9 +92,9 @@ public function getConfiguration(array $config, \_PhpScoper5ea00cc67502b\Symfony /** * @return array */ - protected final function processConfiguration(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ConfigurationInterface $configuration, array $configs) + protected final function processConfiguration(ConfigurationInterface $configuration, array $configs) { - $processor = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Processor(); + $processor = new Processor(); return $this->processedConfigs[] = $processor->processConfiguration($configuration, $configs); } /** @@ -106,10 +113,10 @@ public final function getProcessedConfigs() * * @throws InvalidArgumentException When the config is not enableable */ - protected function isConfigEnabled(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container, array $config) + protected function isConfigEnabled(ContainerBuilder $container, array $config) { - if (!\array_key_exists('enabled', $config)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException("The config array has no 'enabled' key."); + if (!array_key_exists('enabled', $config)) { + throw new InvalidArgumentException("The config array has no 'enabled' key."); } return (bool) $container->getParameterBag()->resolveValue($config['enabled']); } diff --git a/vendor/symfony/dependency-injection/Extension/ExtensionInterface.php b/vendor/symfony/dependency-injection/Extension/ExtensionInterface.php index a4131ab05..2e2717812 100644 --- a/vendor/symfony/dependency-injection/Extension/ExtensionInterface.php +++ b/vendor/symfony/dependency-injection/Extension/ExtensionInterface.php @@ -11,6 +11,8 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Extension; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; +use InvalidArgumentException; + /** * ExtensionInterface is the interface implemented by container extension classes. * @@ -21,9 +23,9 @@ interface ExtensionInterface /** * Loads a specific configuration. * - * @throws \InvalidArgumentException When provided tag is not defined in this extension + * @throws InvalidArgumentException When provided tag is not defined in this extension */ - public function load(array $configs, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container); + public function load(array $configs, ContainerBuilder $container); /** * Returns the namespace to be used for this extension (XML namespace). * diff --git a/vendor/symfony/dependency-injection/Extension/PrependExtensionInterface.php b/vendor/symfony/dependency-injection/Extension/PrependExtensionInterface.php index bbc231d10..aa2d3049a 100644 --- a/vendor/symfony/dependency-injection/Extension/PrependExtensionInterface.php +++ b/vendor/symfony/dependency-injection/Extension/PrependExtensionInterface.php @@ -16,5 +16,5 @@ interface PrependExtensionInterface /** * Allow an extension to prepend the extension configurations. */ - public function prepend(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container); + public function prepend(ContainerBuilder $container); } diff --git a/vendor/symfony/dependency-injection/Extension/index.php b/vendor/symfony/dependency-injection/Extension/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Extension/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/LazyProxy/Instantiator/InstantiatorInterface.php b/vendor/symfony/dependency-injection/LazyProxy/Instantiator/InstantiatorInterface.php index 2633b6f5e..d38e36af6 100644 --- a/vendor/symfony/dependency-injection/LazyProxy/Instantiator/InstantiatorInterface.php +++ b/vendor/symfony/dependency-injection/LazyProxy/Instantiator/InstantiatorInterface.php @@ -30,5 +30,5 @@ interface InstantiatorInterface * * @return object */ - public function instantiateProxy(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface $container, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition, $id, $realInstantiator); + public function instantiateProxy(ContainerInterface $container, Definition $definition, $id, $realInstantiator); } diff --git a/vendor/symfony/dependency-injection/LazyProxy/Instantiator/RealServiceInstantiator.php b/vendor/symfony/dependency-injection/LazyProxy/Instantiator/RealServiceInstantiator.php index 5a138a55e..0cfdc510d 100644 --- a/vendor/symfony/dependency-injection/LazyProxy/Instantiator/RealServiceInstantiator.php +++ b/vendor/symfony/dependency-injection/LazyProxy/Instantiator/RealServiceInstantiator.php @@ -12,6 +12,8 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; +use function call_user_func; + /** * {@inheritdoc} * @@ -19,13 +21,13 @@ * * @author Marco Pivetta */ -class RealServiceInstantiator implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\LazyProxy\Instantiator\InstantiatorInterface +class RealServiceInstantiator implements InstantiatorInterface { /** * {@inheritdoc} */ - public function instantiateProxy(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface $container, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition, $id, $realInstantiator) + public function instantiateProxy(ContainerInterface $container, Definition $definition, $id, $realInstantiator) { - return \call_user_func($realInstantiator); + return call_user_func($realInstantiator); } } diff --git a/vendor/symfony/dependency-injection/LazyProxy/Instantiator/index.php b/vendor/symfony/dependency-injection/LazyProxy/Instantiator/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/LazyProxy/Instantiator/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/LazyProxy/PhpDumper/DumperInterface.php b/vendor/symfony/dependency-injection/LazyProxy/PhpDumper/DumperInterface.php index ec06a642b..012920d11 100644 --- a/vendor/symfony/dependency-injection/LazyProxy/PhpDumper/DumperInterface.php +++ b/vendor/symfony/dependency-injection/LazyProxy/PhpDumper/DumperInterface.php @@ -23,7 +23,7 @@ interface DumperInterface * * @return bool */ - public function isProxyCandidate(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition); + public function isProxyCandidate(Definition $definition); /** * Generates the code to be used to instantiate a proxy in the dumped factory code. * @@ -31,11 +31,11 @@ public function isProxyCandidate(\_PhpScoper5ea00cc67502b\Symfony\Component\Depe * * @return string */ - public function getProxyFactoryCode(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition, $id); + public function getProxyFactoryCode(Definition $definition, $id); /** * Generates the code for the lazy proxy. * * @return string */ - public function getProxyCode(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition); + public function getProxyCode(Definition $definition); } diff --git a/vendor/symfony/dependency-injection/LazyProxy/PhpDumper/NullDumper.php b/vendor/symfony/dependency-injection/LazyProxy/PhpDumper/NullDumper.php index f7db10973..521d9c63e 100644 --- a/vendor/symfony/dependency-injection/LazyProxy/PhpDumper/NullDumper.php +++ b/vendor/symfony/dependency-injection/LazyProxy/PhpDumper/NullDumper.php @@ -18,26 +18,26 @@ * * @final since version 3.3 */ -class NullDumper implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface +class NullDumper implements DumperInterface { /** * {@inheritdoc} */ - public function isProxyCandidate(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition) + public function isProxyCandidate(Definition $definition) { - return \false; + return false; } /** * {@inheritdoc} */ - public function getProxyFactoryCode(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition, $id, $factoryCode = null) + public function getProxyFactoryCode(Definition $definition, $id, $factoryCode = null) { return ''; } /** * {@inheritdoc} */ - public function getProxyCode(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition) + public function getProxyCode(Definition $definition) { return ''; } diff --git a/vendor/symfony/dependency-injection/LazyProxy/PhpDumper/index.php b/vendor/symfony/dependency-injection/LazyProxy/PhpDumper/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/LazyProxy/PhpDumper/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/LazyProxy/ProxyHelper.php b/vendor/symfony/dependency-injection/LazyProxy/ProxyHelper.php index c789c53cf..cae74ca1c 100644 --- a/vendor/symfony/dependency-injection/LazyProxy/ProxyHelper.php +++ b/vendor/symfony/dependency-injection/LazyProxy/ProxyHelper.php @@ -10,6 +10,15 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\LazyProxy; +use ReflectionFunctionAbstract; +use ReflectionMethod; +use ReflectionNamedType; +use ReflectionParameter; +use function is_string; +use function method_exists; +use function preg_match; +use function strtolower; + /** * @author Nicolas Grekas * @@ -20,35 +29,35 @@ class ProxyHelper /** * @return string|null The FQCN or builtin name of the type hint, or null when the type hint references an invalid self|parent context */ - public static function getTypeHint(\ReflectionFunctionAbstract $r, \ReflectionParameter $p = null, $noBuiltin = \false) + public static function getTypeHint(ReflectionFunctionAbstract $r, ReflectionParameter $p = null, $noBuiltin = false) { - if ($p instanceof \ReflectionParameter) { - if (\method_exists($p, 'getType')) { + if ($p instanceof ReflectionParameter) { + if (method_exists($p, 'getType')) { $type = $p->getType(); - } elseif (\preg_match('/^(?:[^ ]++ ){4}([a-zA-Z_\\x7F-\\xFF][^ ]++)/', $p, $type)) { + } elseif (preg_match('/^(?:[^ ]++ ){4}([a-zA-Z_\\x7F-\\xFF][^ ]++)/', $p, $type)) { $name = $type = $type[1]; if ('callable' === $name || 'array' === $name) { return $noBuiltin ? null : $name; } } } else { - $type = \method_exists($r, 'getReturnType') ? $r->getReturnType() : null; + $type = method_exists($r, 'getReturnType') ? $r->getReturnType() : null; } if (!$type) { return null; } - if (!\is_string($type)) { - $name = $type instanceof \ReflectionNamedType ? $type->getName() : $type->__toString(); + if (!is_string($type)) { + $name = $type instanceof ReflectionNamedType ? $type->getName() : $type->__toString(); if ($type->isBuiltin()) { return $noBuiltin ? null : $name; } } - $lcName = \strtolower($name); + $lcName = strtolower($name); $prefix = $noBuiltin ? '' : '\\'; if ('self' !== $lcName && 'parent' !== $lcName) { return $prefix . $name; } - if (!$r instanceof \ReflectionMethod) { + if (!$r instanceof ReflectionMethod) { return null; } if ('self' === $lcName) { diff --git a/vendor/symfony/dependency-injection/LazyProxy/index.php b/vendor/symfony/dependency-injection/LazyProxy/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/LazyProxy/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Loader/ClosureLoader.php b/vendor/symfony/dependency-injection/Loader/ClosureLoader.php index 58ce783f6..b169c38ff 100644 --- a/vendor/symfony/dependency-injection/Loader/ClosureLoader.php +++ b/vendor/symfony/dependency-injection/Loader/ClosureLoader.php @@ -12,6 +12,9 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\Loader; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; +use Closure; +use function call_user_func; + /** * ClosureLoader loads service definitions from a PHP closure. * @@ -19,10 +22,10 @@ * * @author Fabien Potencier */ -class ClosureLoader extends \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\Loader +class ClosureLoader extends Loader { private $container; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function __construct(ContainerBuilder $container) { $this->container = $container; } @@ -31,13 +34,13 @@ public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\Dependenc */ public function load($resource, $type = null) { - \call_user_func($resource, $this->container); + call_user_func($resource, $this->container); } /** * {@inheritdoc} */ public function supports($resource, $type = null) { - return $resource instanceof \Closure; + return $resource instanceof Closure; } } diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/AbstractConfigurator.php b/vendor/symfony/dependency-injection/Loader/Configurator/AbstractConfigurator.php index 26a2395b5..7373d9406 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/AbstractConfigurator.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/AbstractConfigurator.php @@ -16,6 +16,16 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Parameter; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression; +use BadMethodCallException; +use function call_user_func_array; +use function get_class; +use function gettype; +use function is_array; +use function is_object; +use function is_scalar; +use function method_exists; +use function sprintf; + abstract class AbstractConfigurator { const FACTORY = 'unknown'; @@ -23,10 +33,10 @@ abstract class AbstractConfigurator protected $definition; public function __call($method, $args) { - if (\method_exists($this, 'set' . $method)) { - return \call_user_func_array([$this, 'set' . $method], $args); + if (method_exists($this, 'set' . $method)) { + return call_user_func_array([$this, 'set' . $method], $args); } - throw new \BadMethodCallException(\sprintf('Call to undefined method "%s::%s()".', static::class, $method)); + throw new BadMethodCallException(sprintf('Call to undefined method "%s::%s()".', static::class, $method)); } /** * Checks that a value is valid, optionally replacing Definition and Reference configurators by their configure value. @@ -36,38 +46,38 @@ public function __call($method, $args) * * @return mixed the value, optionally cast to a Definition/Reference */ - public static function processValue($value, $allowServices = \false) + public static function processValue($value, $allowServices = false) { - if (\is_array($value)) { + if (is_array($value)) { foreach ($value as $k => $v) { $value[$k] = static::processValue($v, $allowServices); } return $value; } - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\ReferenceConfigurator) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference($value->id, $value->invalidBehavior); + if ($value instanceof ReferenceConfigurator) { + return new Reference($value->id, $value->invalidBehavior); } - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\InlineServiceConfigurator) { + if ($value instanceof InlineServiceConfigurator) { $def = $value->definition; $value->definition = null; return $def; } if ($value instanceof self) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('"%s()" can be used only at the root of service configuration files.', $value::FACTORY)); + throw new InvalidArgumentException(sprintf('"%s()" can be used only at the root of service configuration files.', $value::FACTORY)); } - switch (\true) { + switch (true) { case null === $value: - case \is_scalar($value): + case is_scalar($value): return $value; - case $value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ArgumentInterface: - case $value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition: - case $value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression: - case $value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Parameter: - case $value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference: + case $value instanceof ArgumentInterface: + case $value instanceof Definition: + case $value instanceof Expression: + case $value instanceof Parameter: + case $value instanceof Reference: if ($allowServices) { return $value; } } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Cannot use values of type "%s" in service configuration files.', \is_object($value) ? \get_class($value) : \gettype($value))); + throw new InvalidArgumentException(sprintf('Cannot use values of type "%s" in service configuration files.', is_object($value) ? get_class($value) : gettype($value))); } } diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/AbstractServiceConfigurator.php b/vendor/symfony/dependency-injection/Loader/Configurator/AbstractServiceConfigurator.php index 1c06edcc8..b50df2b1e 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/AbstractServiceConfigurator.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/AbstractServiceConfigurator.php @@ -12,12 +12,12 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; -abstract class AbstractServiceConfigurator extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\AbstractConfigurator +abstract class AbstractServiceConfigurator extends AbstractConfigurator { protected $parent; protected $id; private $defaultTags = []; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\ServicesConfigurator $parent, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition, $id = null, array $defaultTags = []) + public function __construct(ServicesConfigurator $parent, Definition $definition, $id = null, array $defaultTags = []) { $this->parent = $parent; $this->definition = $definition; diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/AliasConfigurator.php b/vendor/symfony/dependency-injection/Loader/Configurator/AliasConfigurator.php index 3e902f1e9..595c5d668 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/AliasConfigurator.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/AliasConfigurator.php @@ -14,11 +14,11 @@ /** * @author Nicolas Grekas */ -class AliasConfigurator extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\AbstractServiceConfigurator +class AliasConfigurator extends AbstractServiceConfigurator { const FACTORY = 'alias'; use Traits\PublicTrait; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\ServicesConfigurator $parent, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Alias $alias) + public function __construct(ServicesConfigurator $parent, Alias $alias) { $this->parent = $parent; $this->definition = $alias; diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php b/vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php index cdf7797f6..3ba2ec134 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php @@ -17,10 +17,16 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\PhpFileLoader; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression; +use function array_filter; +use function array_map; +use function dirname; +use function implode; +use function sprintf; + /** * @author Nicolas Grekas */ -class ContainerConfigurator extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\AbstractConfigurator +class ContainerConfigurator extends AbstractConfigurator { const FACTORY = 'container'; private $container; @@ -28,7 +34,7 @@ class ContainerConfigurator extends \_PhpScoper5ea00cc67502b\Symfony\Component\D private $instanceof; private $path; private $file; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\PhpFileLoader $loader, array &$instanceof, $path, $file) + public function __construct(ContainerBuilder $container, PhpFileLoader $loader, array &$instanceof, $path, $file) { $this->container = $container; $this->loader = $loader; @@ -39,16 +45,16 @@ public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\Dependenc public final function extension($namespace, array $config) { if (!$this->container->hasExtension($namespace)) { - $extensions = \array_filter(\array_map(function ($ext) { + $extensions = array_filter(array_map(function ($ext) { return $ext->getAlias(); }, $this->container->getExtensions())); - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('There is no extension able to load the configuration for "%s" (in "%s"). Looked for namespace "%s", found "%s".', $namespace, $this->file, $namespace, $extensions ? \implode('", "', $extensions) : 'none')); + throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in "%s"). Looked for namespace "%s", found "%s".', $namespace, $this->file, $namespace, $extensions ? implode('", "', $extensions) : 'none')); } $this->container->loadFromExtension($namespace, static::processValue($config)); } - public final function import($resource, $type = null, $ignoreErrors = \false) + public final function import($resource, $type = null, $ignoreErrors = false) { - $this->loader->setCurrentDir(\dirname($this->path)); + $this->loader->setCurrentDir(dirname($this->path)); $this->loader->import($resource, $type, $ignoreErrors, $this->file); } /** @@ -56,14 +62,14 @@ public final function import($resource, $type = null, $ignoreErrors = \false) */ public final function parameters() { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\ParametersConfigurator($this->container); + return new ParametersConfigurator($this->container); } /** * @return ServicesConfigurator */ public final function services() { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\ServicesConfigurator($this->container, $this->loader, $this->instanceof); + return new ServicesConfigurator($this->container, $this->loader, $this->instanceof); } } /** @@ -75,7 +81,7 @@ public final function services() */ function ref($id) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\ReferenceConfigurator($id); + return new ReferenceConfigurator($id); } /** * Creates an inline service. @@ -86,7 +92,7 @@ function ref($id) */ function inline($class = null) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\InlineServiceConfigurator(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition($class)); + return new InlineServiceConfigurator(new Definition($class)); } /** * Creates a lazy iterator. @@ -97,7 +103,7 @@ function inline($class = null) */ function iterator(array $values) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\AbstractConfigurator::processValue($values, \true)); + return new IteratorArgument(AbstractConfigurator::processValue($values, true)); } /** * Creates a lazy iterator by tag name. @@ -108,7 +114,7 @@ function iterator(array $values) */ function tagged($tag) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument($tag); + return new TaggedIteratorArgument($tag); } /** * Creates an expression. @@ -119,5 +125,5 @@ function tagged($tag) */ function expr($expression) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression($expression); + return new Expression($expression); } diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/DefaultsConfigurator.php b/vendor/symfony/dependency-injection/Loader/Configurator/DefaultsConfigurator.php index 0d3a25768..fedcaba66 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/DefaultsConfigurator.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/DefaultsConfigurator.php @@ -11,12 +11,16 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use function is_scalar; +use function is_string; +use function sprintf; + /** * @author Nicolas Grekas * * @method InstanceofConfigurator instanceof(string $fqcn) */ -class DefaultsConfigurator extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\AbstractServiceConfigurator +class DefaultsConfigurator extends AbstractServiceConfigurator { const FACTORY = 'defaults'; use Traits\AutoconfigureTrait; @@ -35,12 +39,12 @@ class DefaultsConfigurator extends \_PhpScoper5ea00cc67502b\Symfony\Component\De */ public final function tag($name, array $attributes = []) { - if (!\is_string($name) || '' === $name) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException('The tag name in "_defaults" must be a non-empty string.'); + if (!is_string($name) || '' === $name) { + throw new InvalidArgumentException('The tag name in "_defaults" must be a non-empty string.'); } foreach ($attributes as $attribute => $value) { - if (!\is_scalar($value) && null !== $value) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Tag "%s", attribute "%s" in "_defaults" must be of a scalar-type.', $name, $attribute)); + if (!is_scalar($value) && null !== $value) { + throw new InvalidArgumentException(sprintf('Tag "%s", attribute "%s" in "_defaults" must be of a scalar-type.', $name, $attribute)); } } $this->definition->addTag($name, $attributes); diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/InlineServiceConfigurator.php b/vendor/symfony/dependency-injection/Loader/Configurator/InlineServiceConfigurator.php index d3a99ab6c..d396a9734 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/InlineServiceConfigurator.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/InlineServiceConfigurator.php @@ -14,7 +14,7 @@ /** * @author Nicolas Grekas */ -class InlineServiceConfigurator extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\AbstractConfigurator +class InlineServiceConfigurator extends AbstractConfigurator { const FACTORY = 'inline'; use Traits\ArgumentTrait; @@ -25,7 +25,7 @@ class InlineServiceConfigurator extends \_PhpScoper5ea00cc67502b\Symfony\Compone use Traits\LazyTrait; use Traits\ParentTrait; use Traits\TagTrait; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition) + public function __construct(Definition $definition) { $this->definition = $definition; } diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/InstanceofConfigurator.php b/vendor/symfony/dependency-injection/Loader/Configurator/InstanceofConfigurator.php index 487d8e904..1fe03036e 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/InstanceofConfigurator.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/InstanceofConfigurator.php @@ -15,7 +15,7 @@ * * @method InstanceofConfigurator instanceof(string $fqcn) */ -class InstanceofConfigurator extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\AbstractServiceConfigurator +class InstanceofConfigurator extends AbstractServiceConfigurator { const FACTORY = 'instanceof'; use Traits\AutowireTrait; diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/ParametersConfigurator.php b/vendor/symfony/dependency-injection/Loader/Configurator/ParametersConfigurator.php index 039f568bf..5b346ff09 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/ParametersConfigurator.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/ParametersConfigurator.php @@ -14,11 +14,11 @@ /** * @author Nicolas Grekas */ -class ParametersConfigurator extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\AbstractConfigurator +class ParametersConfigurator extends AbstractConfigurator { const FACTORY = 'parameters'; private $container; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function __construct(ContainerBuilder $container) { $this->container = $container; } @@ -32,7 +32,7 @@ public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\Dependenc */ public final function set($name, $value) { - $this->container->setParameter($name, static::processValue($value, \true)); + $this->container->setParameter($name, static::processValue($value, true)); return $this; } /** diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/PrototypeConfigurator.php b/vendor/symfony/dependency-injection/Loader/Configurator/PrototypeConfigurator.php index 915b20564..46da9b1f9 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/PrototypeConfigurator.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/PrototypeConfigurator.php @@ -15,7 +15,7 @@ /** * @author Nicolas Grekas */ -class PrototypeConfigurator extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\AbstractServiceConfigurator +class PrototypeConfigurator extends AbstractServiceConfigurator { const FACTORY = 'load'; use Traits\AbstractTrait; @@ -37,9 +37,9 @@ class PrototypeConfigurator extends \_PhpScoper5ea00cc67502b\Symfony\Component\D private $resource; private $exclude; private $allowParent; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\ServicesConfigurator $parent, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\PhpFileLoader $loader, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $defaults, $namespace, $resource, $allowParent) + public function __construct(ServicesConfigurator $parent, PhpFileLoader $loader, Definition $defaults, $namespace, $resource, $allowParent) { - $definition = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(); + $definition = new Definition(); $definition->setPublic($defaults->isPublic()); $definition->setAutowired($defaults->isAutowired()); $definition->setAutoconfigured($defaults->isAutoconfigured()); diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/ReferenceConfigurator.php b/vendor/symfony/dependency-injection/Loader/Configurator/ReferenceConfigurator.php index 8e87f08dc..16288b19d 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/ReferenceConfigurator.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/ReferenceConfigurator.php @@ -14,12 +14,12 @@ /** * @author Nicolas Grekas */ -class ReferenceConfigurator extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\AbstractConfigurator +class ReferenceConfigurator extends AbstractConfigurator { /** @internal */ protected $id; /** @internal */ - protected $invalidBehavior = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE; + protected $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE; public function __construct($id) { $this->id = $id; @@ -29,7 +29,7 @@ public function __construct($id) */ public final function ignoreOnInvalid() { - $this->invalidBehavior = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE; + $this->invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE; return $this; } /** @@ -37,7 +37,7 @@ public final function ignoreOnInvalid() */ public final function nullOnInvalid() { - $this->invalidBehavior = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::NULL_ON_INVALID_REFERENCE; + $this->invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE; return $this; } /** @@ -45,7 +45,7 @@ public final function nullOnInvalid() */ public final function ignoreOnUninitialized() { - $this->invalidBehavior = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE; + $this->invalidBehavior = ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE; return $this; } public function __toString() diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/ServiceConfigurator.php b/vendor/symfony/dependency-injection/Loader/Configurator/ServiceConfigurator.php index ca85c4dfa..d39613da6 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/ServiceConfigurator.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/ServiceConfigurator.php @@ -16,7 +16,7 @@ /** * @author Nicolas Grekas */ -class ServiceConfigurator extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\AbstractServiceConfigurator +class ServiceConfigurator extends AbstractServiceConfigurator { const FACTORY = 'services'; use Traits\AbstractTrait; @@ -41,7 +41,7 @@ class ServiceConfigurator extends \_PhpScoper5ea00cc67502b\Symfony\Component\Dep private $container; private $instanceof; private $allowParent; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container, array $instanceof, $allowParent, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\ServicesConfigurator $parent, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition, $id, array $defaultTags) + public function __construct(ContainerBuilder $container, array $instanceof, $allowParent, ServicesConfigurator $parent, Definition $definition, $id, array $defaultTags) { $this->container = $container; $this->instanceof = $instanceof; @@ -52,7 +52,7 @@ public function __destruct() { parent::__destruct(); $this->container->removeBindings($this->id); - if (!$this->definition instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition) { + if (!$this->definition instanceof ChildDefinition) { $this->container->setDefinition($this->id, $this->definition->setInstanceofConditionals($this->instanceof)); } else { $this->container->setDefinition($this->id, $this->definition); diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/ServicesConfigurator.php b/vendor/symfony/dependency-injection/Loader/Configurator/ServicesConfigurator.php index 493c98ca7..1cd1cd7f2 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/ServicesConfigurator.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/ServicesConfigurator.php @@ -21,16 +21,16 @@ * * @method InstanceofConfigurator instanceof($fqcn) */ -class ServicesConfigurator extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\AbstractConfigurator +class ServicesConfigurator extends AbstractConfigurator { const FACTORY = 'services'; private $defaults; private $container; private $loader; private $instanceof; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\PhpFileLoader $loader, array &$instanceof) + public function __construct(ContainerBuilder $container, PhpFileLoader $loader, array &$instanceof) { - $this->defaults = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(); + $this->defaults = new Definition(); $this->container = $container; $this->loader = $loader; $this->instanceof =& $instanceof; @@ -43,7 +43,7 @@ public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\Dependenc */ public final function defaults() { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\DefaultsConfigurator($this, $this->defaults = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition()); + return new DefaultsConfigurator($this, $this->defaults = new Definition()); } /** * Defines an instanceof-conditional to be applied to following service definitions. @@ -54,8 +54,8 @@ public final function defaults() */ protected final function setInstanceof($fqcn) { - $this->instanceof[$fqcn] = $definition = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition(''); - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\InstanceofConfigurator($this, $definition, $fqcn); + $this->instanceof[$fqcn] = $definition = new ChildDefinition(''); + return new InstanceofConfigurator($this, $definition, $fqcn); } /** * Registers a service. @@ -69,13 +69,13 @@ public final function set($id, $class = null) { $defaults = $this->defaults; $allowParent = !$defaults->getChanges() && empty($this->instanceof); - $definition = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(); + $definition = new Definition(); $definition->setPublic($defaults->isPublic()); $definition->setAutowired($defaults->isAutowired()); $definition->setAutoconfigured($defaults->isAutoconfigured()); $definition->setBindings($defaults->getBindings()); $definition->setChanges([]); - $configurator = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\ServiceConfigurator($this->container, $this->instanceof, $allowParent, $this, $definition, $id, $defaults->getTags()); + $configurator = new ServiceConfigurator($this->container, $this->instanceof, $allowParent, $this, $definition, $id, $defaults->getTags()); return null !== $class ? $configurator->class($class) : $configurator; } /** @@ -88,10 +88,10 @@ public final function set($id, $class = null) */ public final function alias($id, $referencedId) { - $ref = static::processValue($referencedId, \true); - $alias = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Alias((string) $ref, $this->defaults->isPublic()); + $ref = static::processValue($referencedId, true); + $alias = new Alias((string) $ref, $this->defaults->isPublic()); $this->container->setAlias($id, $alias); - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\AliasConfigurator($this, $alias); + return new AliasConfigurator($this, $alias); } /** * Registers a PSR-4 namespace using a glob pattern. @@ -104,7 +104,7 @@ public final function alias($id, $referencedId) public final function load($namespace, $resource) { $allowParent = !$this->defaults->getChanges() && empty($this->instanceof); - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\PrototypeConfigurator($this, $this->loader, $this->defaults, $namespace, $resource, $allowParent); + return new PrototypeConfigurator($this, $this->loader, $this->defaults, $namespace, $resource, $allowParent); } /** * Gets an already defined service definition. @@ -119,7 +119,7 @@ public final function get($id) { $allowParent = !$this->defaults->getChanges() && empty($this->instanceof); $definition = $this->container->getDefinition($id); - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\ServiceConfigurator($this->container, $definition->getInstanceofConditionals(), $allowParent, $this, $definition, $id, []); + return new ServiceConfigurator($this->container, $definition->getInstanceofConditionals(), $allowParent, $this, $definition, $id, []); } /** * Registers a service. diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/AbstractTrait.php b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/AbstractTrait.php index ae9a7f1b1..2d653cc2f 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/AbstractTrait.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/AbstractTrait.php @@ -23,7 +23,7 @@ trait AbstractTrait * * @return $this */ - protected final function setAbstract($abstract = \true) + protected final function setAbstract($abstract = true) { $this->definition->setAbstract($abstract); return $this; diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/ArgumentTrait.php b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/ArgumentTrait.php index 9a9a2e31e..62b250a2f 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/ArgumentTrait.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/ArgumentTrait.php @@ -21,7 +21,7 @@ trait ArgumentTrait */ public final function args(array $arguments) { - $this->definition->setArguments(static::processValue($arguments, \true)); + $this->definition->setArguments(static::processValue($arguments, true)); return $this; } /** @@ -34,7 +34,7 @@ public final function args(array $arguments) */ public final function arg($key, $value) { - $this->definition->setArgument($key, static::processValue($value, \true)); + $this->definition->setArgument($key, static::processValue($value, true)); return $this; } } diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/AutoconfigureTrait.php b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/AutoconfigureTrait.php index 0053667f0..0cb255ceb 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/AutoconfigureTrait.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/AutoconfigureTrait.php @@ -12,6 +12,8 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use function sprintf; + trait AutoconfigureTrait { /** @@ -23,10 +25,10 @@ trait AutoconfigureTrait * * @throws InvalidArgumentException when a parent is already set */ - public final function autoconfigure($autoconfigured = \true) + public final function autoconfigure($autoconfigured = true) { - if ($autoconfigured && $this->definition instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The service "%s" cannot have a "parent" and also have "autoconfigure". Try disabling autoconfiguration for the service.', $this->id)); + if ($autoconfigured && $this->definition instanceof ChildDefinition) { + throw new InvalidArgumentException(sprintf('The service "%s" cannot have a "parent" and also have "autoconfigure". Try disabling autoconfiguration for the service.', $this->id)); } $this->definition->setAutoconfigured($autoconfigured); return $this; diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/AutowireTrait.php b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/AutowireTrait.php index 63ba3b656..d26898b53 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/AutowireTrait.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/AutowireTrait.php @@ -19,7 +19,7 @@ trait AutowireTrait * * @return $this */ - public final function autowire($autowired = \true) + public final function autowire($autowired = true) { $this->definition->setAutowired($autowired); return $this; diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/BindTrait.php b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/BindTrait.php index 2c70984f6..4465644be 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/BindTrait.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/BindTrait.php @@ -12,6 +12,8 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; +use function sprintf; + trait BindTrait { /** @@ -28,9 +30,9 @@ trait BindTrait */ public final function bind($nameOrFqcn, $valueOrRef) { - $valueOrRef = static::processValue($valueOrRef, \true); - if (isset($nameOrFqcn[0]) && '$' !== $nameOrFqcn[0] && !$valueOrRef instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Invalid binding for service "%s": named arguments must start with a "$", and FQCN must map to references. Neither applies to binding "%s".', $this->id, $nameOrFqcn)); + $valueOrRef = static::processValue($valueOrRef, true); + if (isset($nameOrFqcn[0]) && '$' !== $nameOrFqcn[0] && !$valueOrRef instanceof Reference) { + throw new InvalidArgumentException(sprintf('Invalid binding for service "%s": named arguments must start with a "$", and FQCN must map to references. Neither applies to binding "%s".', $this->id, $nameOrFqcn)); } $bindings = $this->definition->getBindings(); $bindings[$nameOrFqcn] = $valueOrRef; diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/CallTrait.php b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/CallTrait.php index 4c1a28883..1acbf1bfc 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/CallTrait.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/CallTrait.php @@ -25,7 +25,7 @@ trait CallTrait */ public final function call($method, array $arguments = []) { - $this->definition->addMethodCall($method, static::processValue($arguments, \true)); + $this->definition->addMethodCall($method, static::processValue($arguments, true)); return $this; } } diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/ConfiguratorTrait.php b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/ConfiguratorTrait.php index 94b394d65..e69f3342f 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/ConfiguratorTrait.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/ConfiguratorTrait.php @@ -21,7 +21,7 @@ trait ConfiguratorTrait */ public final function configurator($configurator) { - $this->definition->setConfigurator(static::processValue($configurator, \true)); + $this->definition->setConfigurator(static::processValue($configurator, true)); return $this; } } diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/DeprecateTrait.php b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/DeprecateTrait.php index 68edff99b..d5b682071 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/DeprecateTrait.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/DeprecateTrait.php @@ -24,7 +24,7 @@ trait DeprecateTrait */ public final function deprecate($template = null) { - $this->definition->setDeprecated(\true, $template); + $this->definition->setDeprecated(true, $template); return $this; } } diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/FactoryTrait.php b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/FactoryTrait.php index 96849577b..05570c430 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/FactoryTrait.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/FactoryTrait.php @@ -11,6 +11,11 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\Traits; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use function explode; +use function is_string; +use function sprintf; +use function substr_count; + trait FactoryTrait { /** @@ -22,11 +27,11 @@ trait FactoryTrait */ public final function factory($factory) { - if (\is_string($factory) && 1 === \substr_count($factory, ':')) { - $factoryParts = \explode(':', $factory); - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Invalid factory "%s": the `service:method` notation is not available when using PHP-based DI configuration. Use "[ref(\'%s\'), \'%s\']" instead.', $factory, $factoryParts[0], $factoryParts[1])); + if (is_string($factory) && 1 === substr_count($factory, ':')) { + $factoryParts = explode(':', $factory); + throw new InvalidArgumentException(sprintf('Invalid factory "%s": the `service:method` notation is not available when using PHP-based DI configuration. Use "[ref(\'%s\'), \'%s\']" instead.', $factory, $factoryParts[0], $factoryParts[1])); } - $this->definition->setFactory(static::processValue($factory, \true)); + $this->definition->setFactory(static::processValue($factory, true)); return $this; } } diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/LazyTrait.php b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/LazyTrait.php index 8d6313df5..4b451a39a 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/LazyTrait.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/LazyTrait.php @@ -19,7 +19,7 @@ trait LazyTrait * * @return $this */ - public final function lazy($lazy = \true) + public final function lazy($lazy = true) { $this->definition->setLazy($lazy); return $this; diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/ParentTrait.php b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/ParentTrait.php index c40fbe173..8f6574192 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/ParentTrait.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/ParentTrait.php @@ -12,6 +12,11 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use function serialize; +use function sprintf; +use function substr_replace; +use function unserialize; + /** * @method $this parent(string $parent) */ @@ -29,20 +34,20 @@ trait ParentTrait protected final function setParent($parent) { if (!$this->allowParent) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('A parent cannot be defined when either "_instanceof" or "_defaults" are also defined for service prototype "%s".', $this->id)); + throw new InvalidArgumentException(sprintf('A parent cannot be defined when either "_instanceof" or "_defaults" are also defined for service prototype "%s".', $this->id)); } - if ($this->definition instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition) { + if ($this->definition instanceof ChildDefinition) { $this->definition->setParent($parent); } elseif ($this->definition->isAutoconfigured()) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The service "%s" cannot have a "parent" and also have "autoconfigure". Try disabling autoconfiguration for the service.', $this->id)); + throw new InvalidArgumentException(sprintf('The service "%s" cannot have a "parent" and also have "autoconfigure". Try disabling autoconfiguration for the service.', $this->id)); } elseif ($this->definition->getBindings()) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The service "%s" cannot have a "parent" and also "bind" arguments.', $this->id)); + throw new InvalidArgumentException(sprintf('The service "%s" cannot have a "parent" and also "bind" arguments.', $this->id)); } else { // cast Definition to ChildDefinition - $definition = \serialize($this->definition); - $definition = \substr_replace($definition, '53', 2, 2); - $definition = \substr_replace($definition, 'Child', 44, 0); - $definition = \unserialize($definition); + $definition = serialize($this->definition); + $definition = substr_replace($definition, '53', 2, 2); + $definition = substr_replace($definition, 'Child', 44, 0); + $definition = unserialize($definition); $this->definition = $definition->setParent($parent); } return $this; diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/PropertyTrait.php b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/PropertyTrait.php index 819ee0efa..888079138 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/PropertyTrait.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/PropertyTrait.php @@ -22,7 +22,7 @@ trait PropertyTrait */ public final function property($name, $value) { - $this->definition->setProperty($name, static::processValue($value, \true)); + $this->definition->setProperty($name, static::processValue($value, true)); return $this; } } diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/PublicTrait.php b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/PublicTrait.php index ed312d40a..c17fac96b 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/PublicTrait.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/PublicTrait.php @@ -21,7 +21,7 @@ trait PublicTrait */ protected final function setPublic() { - $this->definition->setPublic(\true); + $this->definition->setPublic(true); return $this; } /** @@ -29,7 +29,7 @@ protected final function setPublic() */ protected final function setPrivate() { - $this->definition->setPublic(\false); + $this->definition->setPublic(false); return $this; } } diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/ShareTrait.php b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/ShareTrait.php index 8228ed4ac..abb7cdef7 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/ShareTrait.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/ShareTrait.php @@ -19,7 +19,7 @@ trait ShareTrait * * @return $this */ - public final function share($shared = \true) + public final function share($shared = true) { $this->definition->setShared($shared); return $this; diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/SyntheticTrait.php b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/SyntheticTrait.php index 64bb4bbc3..7448f3731 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/SyntheticTrait.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/SyntheticTrait.php @@ -20,7 +20,7 @@ trait SyntheticTrait * * @return $this */ - public final function synthetic($synthetic = \true) + public final function synthetic($synthetic = true) { $this->definition->setSynthetic($synthetic); return $this; diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/TagTrait.php b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/TagTrait.php index de6d2f961..9d577007b 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/TagTrait.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/TagTrait.php @@ -11,6 +11,10 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\Traits; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use function is_scalar; +use function is_string; +use function sprintf; + trait TagTrait { /** @@ -23,12 +27,12 @@ trait TagTrait */ public final function tag($name, array $attributes = []) { - if (!\is_string($name) || '' === $name) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The tag name for service "%s" must be a non-empty string.', $this->id)); + if (!is_string($name) || '' === $name) { + throw new InvalidArgumentException(sprintf('The tag name for service "%s" must be a non-empty string.', $this->id)); } foreach ($attributes as $attribute => $value) { - if (!\is_scalar($value) && null !== $value) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('A tag attribute must be of a scalar-type for service "%s", tag "%s", attribute "%s".', $this->id, $name, $attribute)); + if (!is_scalar($value) && null !== $value) { + throw new InvalidArgumentException(sprintf('A tag attribute must be of a scalar-type for service "%s", tag "%s", attribute "%s".', $this->id, $name, $attribute)); } } $this->definition->addTag($name, $attributes); diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/index.php b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/index.php b/vendor/symfony/dependency-injection/Loader/Configurator/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Loader/Configurator/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Loader/DirectoryLoader.php b/vendor/symfony/dependency-injection/Loader/DirectoryLoader.php index 987e594cd..b2ac3aa99 100644 --- a/vendor/symfony/dependency-injection/Loader/DirectoryLoader.php +++ b/vendor/symfony/dependency-injection/Loader/DirectoryLoader.php @@ -10,29 +10,35 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader; +use function is_dir; +use function is_string; +use function rtrim; +use function scandir; +use function substr; + /** * DirectoryLoader is a recursive loader to go through directories. * * @author Sebastien Lavoie */ -class DirectoryLoader extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\FileLoader +class DirectoryLoader extends FileLoader { /** * {@inheritdoc} */ public function load($file, $type = null) { - $file = \rtrim($file, '/'); + $file = rtrim($file, '/'); $path = $this->locator->locate($file); - $this->container->fileExists($path, \false); - foreach (\scandir($path) as $dir) { + $this->container->fileExists($path, false); + foreach (scandir($path) as $dir) { if ('.' !== $dir[0]) { - if (\is_dir($path . '/' . $dir)) { + if (is_dir($path . '/' . $dir)) { $dir .= '/'; // append / to allow recursion } $this->setCurrentDir($path); - $this->import($dir, null, \false, $path); + $this->import($dir, null, false, $path); } } } @@ -42,8 +48,8 @@ public function load($file, $type = null) public function supports($resource, $type = null) { if ('directory' === $type) { - return \true; + return true; } - return null === $type && \is_string($resource) && '/' === \substr($resource, -1); + return null === $type && is_string($resource) && '/' === substr($resource, -1); } } diff --git a/vendor/symfony/dependency-injection/Loader/FileLoader.php b/vendor/symfony/dependency-injection/Loader/FileLoader.php index 99d3080ce..1922a86c4 100644 --- a/vendor/symfony/dependency-injection/Loader/FileLoader.php +++ b/vendor/symfony/dependency-injection/Loader/FileLoader.php @@ -17,17 +17,32 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use ReflectionException; +use function class_implements; +use function defined; +use function get_class; +use function interface_exists; +use function ltrim; +use function preg_match; +use function serialize; +use function sprintf; +use function str_replace; +use function strlen; +use function strpos; +use function substr; +use function unserialize; + /** * FileLoader is the abstract class used by all built-in loaders that are file based. * * @author Fabien Potencier */ -abstract class FileLoader extends \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\FileLoader +abstract class FileLoader extends BaseFileLoader { protected $container; - protected $isLoadingInstanceof = \false; + protected $isLoadingInstanceof = false; protected $instanceof = []; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container, \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocatorInterface $locator) + public function __construct(ContainerBuilder $container, FileLocatorInterface $locator) { $this->container = $container; parent::__construct($locator); @@ -40,36 +55,36 @@ public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\Dependenc * @param string $resource The directory to look for classes, glob-patterns allowed * @param string $exclude A globed path of files to exclude */ - public function registerClasses(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $prototype, $namespace, $resource, $exclude = null) + public function registerClasses(Definition $prototype, $namespace, $resource, $exclude = null) { - if ('\\' !== \substr($namespace, -1)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Namespace prefix must end with a "\\": "%s".', $namespace)); + if ('\\' !== substr($namespace, -1)) { + throw new InvalidArgumentException(sprintf('Namespace prefix must end with a "\\": "%s".', $namespace)); } - if (!\preg_match('/^(?:[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+\\\\)++$/', $namespace)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Namespace is not a valid PSR-4 prefix: "%s".', $namespace)); + if (!preg_match('/^(?:[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+\\\\)++$/', $namespace)) { + throw new InvalidArgumentException(sprintf('Namespace is not a valid PSR-4 prefix: "%s".', $namespace)); } $classes = $this->findClasses($namespace, $resource, $exclude); // prepare for deep cloning - $serializedPrototype = \serialize($prototype); + $serializedPrototype = serialize($prototype); $interfaces = []; $singlyImplemented = []; foreach ($classes as $class => $errorMessage) { - if (\interface_exists($class, \false)) { + if (interface_exists($class, false)) { $interfaces[] = $class; } else { - $this->setDefinition($class, $definition = \unserialize($serializedPrototype)); + $this->setDefinition($class, $definition = unserialize($serializedPrototype)); if (null !== $errorMessage) { $definition->addError($errorMessage); continue; } - foreach (\class_implements($class, \false) as $interface) { - $singlyImplemented[$interface] = isset($singlyImplemented[$interface]) ? \false : $class; + foreach (class_implements($class, false) as $interface) { + $singlyImplemented[$interface] = isset($singlyImplemented[$interface]) ? false : $class; } } } foreach ($interfaces as $interface) { if (!empty($singlyImplemented[$interface])) { - $this->container->setAlias($interface, $singlyImplemented[$interface])->setPublic(\false); + $this->container->setAlias($interface, $singlyImplemented[$interface])->setPublic(false); } } } @@ -78,16 +93,16 @@ public function registerClasses(\_PhpScoper5ea00cc67502b\Symfony\Component\Depen * * @param string $id */ - protected function setDefinition($id, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition) + protected function setDefinition($id, Definition $definition) { $this->container->removeBindings($id); if ($this->isLoadingInstanceof) { - if (!$definition instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Invalid type definition "%s": ChildDefinition expected, "%s" given.', $id, \get_class($definition))); + if (!$definition instanceof ChildDefinition) { + throw new InvalidArgumentException(sprintf('Invalid type definition "%s": ChildDefinition expected, "%s" given.', $id, get_class($definition))); } $this->instanceof[$id] = $definition; } else { - $this->container->setDefinition($id, $definition instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition ? $definition : $definition->setInstanceofConditionals($this->instanceof)); + $this->container->setDefinition($id, $definition instanceof ChildDefinition ? $definition : $definition->setInstanceofConditionals($this->instanceof)); } } private function findClasses($namespace, $pattern, $excludePattern) @@ -97,55 +112,55 @@ private function findClasses($namespace, $pattern, $excludePattern) $excludePrefix = null; if ($excludePattern) { $excludePattern = $parameterBag->unescapeValue($parameterBag->resolveValue($excludePattern)); - foreach ($this->glob($excludePattern, \true, $resource, \true) as $path => $info) { + foreach ($this->glob($excludePattern, true, $resource, true) as $path => $info) { if (null === $excludePrefix) { $excludePrefix = $resource->getPrefix(); } // normalize Windows slashes - $excludePaths[\str_replace('\\', '/', $path)] = \true; + $excludePaths[str_replace('\\', '/', $path)] = true; } } $pattern = $parameterBag->unescapeValue($parameterBag->resolveValue($pattern)); $classes = []; - $extRegexp = \defined('HHVM_VERSION') ? '/\\.(?:php|hh)$/' : '/\\.php$/'; + $extRegexp = defined('HHVM_VERSION') ? '/\\.(?:php|hh)$/' : '/\\.php$/'; $prefixLen = null; - foreach ($this->glob($pattern, \true, $resource) as $path => $info) { + foreach ($this->glob($pattern, true, $resource) as $path => $info) { if (null === $prefixLen) { - $prefixLen = \strlen($resource->getPrefix()); - if ($excludePrefix && 0 !== \strpos($excludePrefix, $resource->getPrefix())) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Invalid "exclude" pattern when importing classes for "%s": make sure your "exclude" pattern (%s) is a subset of the "resource" pattern (%s).', $namespace, $excludePattern, $pattern)); + $prefixLen = strlen($resource->getPrefix()); + if ($excludePrefix && 0 !== strpos($excludePrefix, $resource->getPrefix())) { + throw new InvalidArgumentException(sprintf('Invalid "exclude" pattern when importing classes for "%s": make sure your "exclude" pattern (%s) is a subset of the "resource" pattern (%s).', $namespace, $excludePattern, $pattern)); } } - if (isset($excludePaths[\str_replace('\\', '/', $path)])) { + if (isset($excludePaths[str_replace('\\', '/', $path)])) { continue; } - if (!\preg_match($extRegexp, $path, $m) || !$info->isReadable()) { + if (!preg_match($extRegexp, $path, $m) || !$info->isReadable()) { continue; } - $class = $namespace . \ltrim(\str_replace('/', '\\', \substr($path, $prefixLen, -\strlen($m[0]))), '\\'); - if (!\preg_match('/^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+(?:\\\\[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+)*+$/', $class)) { + $class = $namespace . ltrim(str_replace('/', '\\', substr($path, $prefixLen, -strlen($m[0]))), '\\'); + if (!preg_match('/^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+(?:\\\\[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+)*+$/', $class)) { continue; } try { $r = $this->container->getReflectionClass($class); - } catch (\ReflectionException $e) { + } catch (ReflectionException $e) { $classes[$class] = $e->getMessage(); continue; } // check to make sure the expected class exists if (!$r) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Expected to find class "%s" in file "%s" while importing services from resource "%s", but it was not found! Check the namespace prefix used with the resource.', $class, $path, $pattern)); + throw new InvalidArgumentException(sprintf('Expected to find class "%s" in file "%s" while importing services from resource "%s", but it was not found! Check the namespace prefix used with the resource.', $class, $path, $pattern)); } if ($r->isInstantiable() || $r->isInterface()) { $classes[$class] = null; } } // track only for new & removed files - if ($resource instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\GlobResource) { + if ($resource instanceof GlobResource) { $this->container->addResource($resource); } else { foreach ($resource as $path) { - $this->container->fileExists($path, \false); + $this->container->fileExists($path, false); } } return $classes; diff --git a/vendor/symfony/dependency-injection/Loader/GlobFileLoader.php b/vendor/symfony/dependency-injection/Loader/GlobFileLoader.php index 519f519fb..bf643f551 100644 --- a/vendor/symfony/dependency-injection/Loader/GlobFileLoader.php +++ b/vendor/symfony/dependency-injection/Loader/GlobFileLoader.php @@ -15,14 +15,14 @@ * * @author Nicolas Grekas */ -class GlobFileLoader extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\FileLoader +class GlobFileLoader extends FileLoader { /** * {@inheritdoc} */ public function load($resource, $type = null) { - foreach ($this->glob($resource, \false, $globResource) as $path => $info) { + foreach ($this->glob($resource, false, $globResource) as $path => $info) { $this->import($path); } $this->container->addResource($globResource); diff --git a/vendor/symfony/dependency-injection/Loader/IniFileLoader.php b/vendor/symfony/dependency-injection/Loader/IniFileLoader.php index 9f9b4d7ed..e2f1a1a09 100644 --- a/vendor/symfony/dependency-injection/Loader/IniFileLoader.php +++ b/vendor/symfony/dependency-injection/Loader/IniFileLoader.php @@ -12,12 +12,27 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use function constant; +use function defined; +use function is_array; +use function is_string; +use function parse_ini_file; +use function pathinfo; +use function rtrim; +use function sprintf; +use function strlen; +use function strtolower; +use function substr; +use function substr_replace; +use const INI_SCANNER_RAW; +use const PATHINFO_EXTENSION; + /** * IniFileLoader loads parameters from INI files. * * @author Fabien Potencier */ -class IniFileLoader extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\FileLoader +class IniFileLoader extends FileLoader { /** * {@inheritdoc} @@ -27,13 +42,13 @@ public function load($resource, $type = null) $path = $this->locator->locate($resource); $this->container->fileExists($path); // first pass to catch parsing errors - $result = \parse_ini_file($path, \true); - if (\false === $result || [] === $result) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The "%s" file is not valid.', $resource)); + $result = parse_ini_file($path, true); + if (false === $result || [] === $result) { + throw new InvalidArgumentException(sprintf('The "%s" file is not valid.', $resource)); } // real raw parsing - $result = \parse_ini_file($path, \true, \INI_SCANNER_RAW); - if (isset($result['parameters']) && \is_array($result['parameters'])) { + $result = parse_ini_file($path, true, INI_SCANNER_RAW); + if (isset($result['parameters']) && is_array($result['parameters'])) { foreach ($result['parameters'] as $key => $value) { $this->container->setParameter($key, $this->phpize($value)); } @@ -44,11 +59,11 @@ public function load($resource, $type = null) */ public function supports($resource, $type = null) { - if (!\is_string($resource)) { - return \false; + if (!is_string($resource)) { + return false; } - if (null === $type && 'ini' === \pathinfo($resource, \PATHINFO_EXTENSION)) { - return \true; + if (null === $type && 'ini' === pathinfo($resource, PATHINFO_EXTENSION)) { + return true; } return 'ini' === $type; } @@ -60,22 +75,22 @@ public function supports($resource, $type = null) private function phpize($value) { // trim on the right as comments removal keep whitespaces - if ($value !== ($v = \rtrim($value))) { - $value = '""' === \substr_replace($v, '', 1, -1) ? \substr($v, 1, -1) : $v; + if ($value !== ($v = rtrim($value))) { + $value = '""' === substr_replace($v, '', 1, -1) ? substr($v, 1, -1) : $v; } - $lowercaseValue = \strtolower($value); - switch (\true) { - case \defined($value): - return \constant($value); + $lowercaseValue = strtolower($value); + switch (true) { + case defined($value): + return constant($value); case 'yes' === $lowercaseValue || 'on' === $lowercaseValue: - return \true; + return true; case 'no' === $lowercaseValue || 'off' === $lowercaseValue || 'none' === $lowercaseValue: - return \false; - case isset($value[1]) && ("'" === $value[0] && "'" === $value[\strlen($value) - 1] || '"' === $value[0] && '"' === $value[\strlen($value) - 1]): + return false; + case isset($value[1]) && ("'" === $value[0] && "'" === $value[strlen($value) - 1] || '"' === $value[0] && '"' === $value[strlen($value) - 1]): // quoted string - return \substr($value, 1, -1); + return substr($value, 1, -1); default: - return \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::phpize($value); + return XmlUtils::phpize($value); } } } diff --git a/vendor/symfony/dependency-injection/Loader/PhpFileLoader.php b/vendor/symfony/dependency-injection/Loader/PhpFileLoader.php index d5ae7fb3a..078975621 100644 --- a/vendor/symfony/dependency-injection/Loader/PhpFileLoader.php +++ b/vendor/symfony/dependency-injection/Loader/PhpFileLoader.php @@ -11,6 +11,12 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; +use Closure; +use function dirname; +use function is_string; +use function pathinfo; +use const PATHINFO_EXTENSION; + /** * PhpFileLoader loads service definitions from a PHP file. * @@ -19,7 +25,7 @@ * * @author Fabien Potencier */ -class PhpFileLoader extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\FileLoader +class PhpFileLoader extends FileLoader { /** * {@inheritdoc} @@ -30,15 +36,15 @@ public function load($resource, $type = null) $container = $this->container; $loader = $this; $path = $this->locator->locate($resource); - $this->setCurrentDir(\dirname($path)); + $this->setCurrentDir(dirname($path)); $this->container->fileExists($path); // the closure forbids access to the private scope in the included file - $load = \Closure::bind(function ($path) use($container, $loader, $resource, $type) { + $load = Closure::bind(function ($path) use($container, $loader, $resource, $type) { return include $path; - }, $this, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\ProtectedPhpFileLoader::class); + }, $this, ProtectedPhpFileLoader::class); $callback = $load($path); - if ($callback instanceof \Closure) { - $callback(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator($this->container, $this, $this->instanceof, $path, $resource), $this->container, $this); + if ($callback instanceof Closure) { + $callback(new ContainerConfigurator($this->container, $this, $this->instanceof, $path, $resource), $this->container, $this); } } /** @@ -46,11 +52,11 @@ public function load($resource, $type = null) */ public function supports($resource, $type = null) { - if (!\is_string($resource)) { - return \false; + if (!is_string($resource)) { + return false; } - if (null === $type && 'php' === \pathinfo($resource, \PATHINFO_EXTENSION)) { - return \true; + if (null === $type && 'php' === pathinfo($resource, PATHINFO_EXTENSION)) { + return true; } return 'php' === $type; } @@ -58,6 +64,6 @@ public function supports($resource, $type = null) /** * @internal */ -final class ProtectedPhpFileLoader extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\PhpFileLoader +final class ProtectedPhpFileLoader extends PhpFileLoader { } diff --git a/vendor/symfony/dependency-injection/Loader/XmlFileLoader.php b/vendor/symfony/dependency-injection/Loader/XmlFileLoader.php index c0d4b2cec..6400a925a 100644 --- a/vendor/symfony/dependency-injection/Loader/XmlFileLoader.php +++ b/vendor/symfony/dependency-injection/Loader/XmlFileLoader.php @@ -23,12 +23,57 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression; +use DOMDocument; +use DOMElement; +use DOMNode; +use DOMXPath; +use LogicException; +use function array_filter; +use function array_key_exists; +use function array_keys; +use function array_map; +use function array_merge; +use function array_pop; +use function array_reverse; +use function array_shift; +use function class_exists; +use function constant; +use function copy; +use function count; +use function dirname; +use function explode; +use function get_class; +use function implode; +use function in_array; +use function is_array; +use function is_file; +use function is_string; +use function libxml_disable_entity_loader; +use function pathinfo; +use function preg_replace; +use function preg_split; +use function serialize; +use function sprintf; +use function str_replace; +use function stripos; +use function strpos; +use function sys_get_temp_dir; +use function tempnam; +use function trigger_error; +use function trim; +use function uksort; +use function unlink; +use function unserialize; +use const DIRECTORY_SEPARATOR; +use const E_USER_DEPRECATED; +use const PATHINFO_EXTENSION; + /** * XmlFileLoader loads XML files service definitions. * * @author Fabien Potencier */ -class XmlFileLoader extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\FileLoader +class XmlFileLoader extends FileLoader { const NS = 'http://symfony.com/schema/dic/services'; /** @@ -60,11 +105,11 @@ public function load($resource, $type = null) */ public function supports($resource, $type = null) { - if (!\is_string($resource)) { - return \false; + if (!is_string($resource)) { + return false; } - if (null === $type && 'xml' === \pathinfo($resource, \PATHINFO_EXTENSION)) { - return \true; + if (null === $type && 'xml' === pathinfo($resource, PATHINFO_EXTENSION)) { + return true; } return 'xml' === $type; } @@ -73,7 +118,7 @@ public function supports($resource, $type = null) * * @param string $file */ - private function parseParameters(\DOMDocument $xml, $file) + private function parseParameters(DOMDocument $xml, $file) { if ($parameters = $this->getChildren($xml->documentElement, 'parameters')) { $this->container->getParameterBag()->add($this->getArgumentsAsPhp($parameters[0], 'parameter', $file)); @@ -84,17 +129,17 @@ private function parseParameters(\DOMDocument $xml, $file) * * @param string $file */ - private function parseImports(\DOMDocument $xml, $file) + private function parseImports(DOMDocument $xml, $file) { - $xpath = new \DOMXPath($xml); + $xpath = new DOMXPath($xml); $xpath->registerNamespace('container', self::NS); - if (\false === ($imports = $xpath->query('//container:imports/container:import'))) { + if (false === ($imports = $xpath->query('//container:imports/container:import'))) { return; } - $defaultDirectory = \dirname($file); + $defaultDirectory = dirname($file); foreach ($imports as $import) { $this->setCurrentDir($defaultDirectory); - $this->import($import->getAttribute('resource'), \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::phpize($import->getAttribute('type')) ?: null, (bool) \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::phpize($import->getAttribute('ignore-errors')), $file); + $this->import($import->getAttribute('resource'), XmlUtils::phpize($import->getAttribute('type')) ?: null, (bool) XmlUtils::phpize($import->getAttribute('ignore-errors')), $file); } } /** @@ -102,21 +147,21 @@ private function parseImports(\DOMDocument $xml, $file) * * @param string $file */ - private function parseDefinitions(\DOMDocument $xml, $file, $defaults) + private function parseDefinitions(DOMDocument $xml, $file, $defaults) { - $xpath = new \DOMXPath($xml); + $xpath = new DOMXPath($xml); $xpath->registerNamespace('container', self::NS); - if (\false === ($services = $xpath->query('//container:services/container:service|//container:services/container:prototype'))) { + if (false === ($services = $xpath->query('//container:services/container:service|//container:services/container:prototype'))) { return; } - $this->setCurrentDir(\dirname($file)); + $this->setCurrentDir(dirname($file)); $this->instanceof = []; - $this->isLoadingInstanceof = \true; + $this->isLoadingInstanceof = true; $instanceof = $xpath->query('//container:services/container:instanceof'); foreach ($instanceof as $service) { $this->setDefinition((string) $service->getAttribute('id'), $this->parseDefinition($service, $file, [])); } - $this->isLoadingInstanceof = \false; + $this->isLoadingInstanceof = false; foreach ($services as $service) { if (null !== ($definition = $this->parseDefinition($service, $file, $defaults))) { if ('prototype' === $service->tagName) { @@ -132,29 +177,29 @@ private function parseDefinitions(\DOMDocument $xml, $file, $defaults) * * @return array */ - private function getServiceDefaults(\DOMDocument $xml, $file) + private function getServiceDefaults(DOMDocument $xml, $file) { - $xpath = new \DOMXPath($xml); + $xpath = new DOMXPath($xml); $xpath->registerNamespace('container', self::NS); if (null === ($defaultsNode = $xpath->query('//container:services/container:defaults')->item(0))) { return []; } - $defaults = ['tags' => $this->getChildren($defaultsNode, 'tag'), 'bind' => \array_map(function ($v) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\BoundArgument($v); + $defaults = ['tags' => $this->getChildren($defaultsNode, 'tag'), 'bind' => array_map(function ($v) { + return new BoundArgument($v); }, $this->getArgumentsAsPhp($defaultsNode, 'bind', $file))]; foreach ($defaults['tags'] as $tag) { if ('' === $tag->getAttribute('name')) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The tag name for tag "" in "%s" must be a non-empty string.', $file)); + throw new InvalidArgumentException(sprintf('The tag name for tag "" in "%s" must be a non-empty string.', $file)); } } if ($defaultsNode->hasAttribute('autowire')) { - $defaults['autowire'] = \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::phpize($defaultsNode->getAttribute('autowire')); + $defaults['autowire'] = XmlUtils::phpize($defaultsNode->getAttribute('autowire')); } if ($defaultsNode->hasAttribute('public')) { - $defaults['public'] = \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::phpize($defaultsNode->getAttribute('public')); + $defaults['public'] = XmlUtils::phpize($defaultsNode->getAttribute('public')); } if ($defaultsNode->hasAttribute('autoconfigure')) { - $defaults['autoconfigure'] = \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::phpize($defaultsNode->getAttribute('autoconfigure')); + $defaults['autoconfigure'] = XmlUtils::phpize($defaultsNode->getAttribute('autoconfigure')); } return $defaults; } @@ -165,23 +210,23 @@ private function getServiceDefaults(\DOMDocument $xml, $file) * * @return Definition|null */ - private function parseDefinition(\DOMElement $service, $file, array $defaults) + private function parseDefinition(DOMElement $service, $file, array $defaults) { if ($alias = $service->getAttribute('alias')) { $this->validateAlias($service, $file); - $this->container->setAlias((string) $service->getAttribute('id'), $alias = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Alias($alias)); + $this->container->setAlias((string) $service->getAttribute('id'), $alias = new Alias($alias)); if ($publicAttr = $service->getAttribute('public')) { - $alias->setPublic(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::phpize($publicAttr)); + $alias->setPublic(XmlUtils::phpize($publicAttr)); } elseif (isset($defaults['public'])) { $alias->setPublic($defaults['public']); } return null; } if ($this->isLoadingInstanceof) { - $definition = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition(''); + $definition = new ChildDefinition(''); } elseif ($parent = $service->getAttribute('parent')) { if (!empty($this->instanceof)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The service "%s" cannot use the "parent" option in the same file where "instanceof" configuration is defined as using both is not supported. Move your child definitions to a separate file.', $service->getAttribute('id'))); + throw new InvalidArgumentException(sprintf('The service "%s" cannot use the "parent" option in the same file where "instanceof" configuration is defined as using both is not supported. Move your child definitions to a separate file.', $service->getAttribute('id'))); } foreach ($defaults as $k => $v) { if ('tags' === $k) { @@ -191,17 +236,17 @@ private function parseDefinition(\DOMElement $service, $file, array $defaults) } if ('bind' === $k) { if ($defaults['bind']) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Bound values on service "%s" cannot be inherited from "defaults" when a "parent" is set. Move your child definitions to a separate file.', $service->getAttribute('id'))); + throw new InvalidArgumentException(sprintf('Bound values on service "%s" cannot be inherited from "defaults" when a "parent" is set. Move your child definitions to a separate file.', $service->getAttribute('id'))); } continue; } if (!$service->hasAttribute($k)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Attribute "%s" on service "%s" cannot be inherited from "defaults" when a "parent" is set. Move your child definitions to a separate file or define this attribute explicitly.', $k, $service->getAttribute('id'))); + throw new InvalidArgumentException(sprintf('Attribute "%s" on service "%s" cannot be inherited from "defaults" when a "parent" is set. Move your child definitions to a separate file or define this attribute explicitly.', $k, $service->getAttribute('id'))); } } - $definition = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition($parent); + $definition = new ChildDefinition($parent); } else { - $definition = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(); + $definition = new Definition(); if (isset($defaults['public'])) { $definition->setPublic($defaults['public']); } @@ -216,26 +261,26 @@ private function parseDefinition(\DOMElement $service, $file, array $defaults) foreach (['class', 'public', 'shared', 'synthetic', 'lazy', 'abstract'] as $key) { if ($value = $service->getAttribute($key)) { $method = 'set' . $key; - $definition->{$method}(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::phpize($value)); + $definition->{$method}(XmlUtils::phpize($value)); } } if ($value = $service->getAttribute('autowire')) { - $definition->setAutowired(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::phpize($value)); + $definition->setAutowired(XmlUtils::phpize($value)); } if ($value = $service->getAttribute('autoconfigure')) { - if (!$definition instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition) { - $definition->setAutoconfigured(\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::phpize($value)); - } elseif ($value = \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::phpize($value)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The service "%s" cannot have a "parent" and also have "autoconfigure". Try setting autoconfigure="false" for the service.', $service->getAttribute('id'))); + if (!$definition instanceof ChildDefinition) { + $definition->setAutoconfigured(XmlUtils::phpize($value)); + } elseif ($value = XmlUtils::phpize($value)) { + throw new InvalidArgumentException(sprintf('The service "%s" cannot have a "parent" and also have "autoconfigure". Try setting autoconfigure="false" for the service.', $service->getAttribute('id'))); } } if ($files = $this->getChildren($service, 'file')) { $definition->setFile($files[0]->nodeValue); } if ($deprecated = $this->getChildren($service, 'deprecated')) { - $definition->setDeprecated(\true, $deprecated[0]->nodeValue ?: null); + $definition->setDeprecated(true, $deprecated[0]->nodeValue ?: null); } - $definition->setArguments($this->getArgumentsAsPhp($service, 'argument', $file, $definition instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition)); + $definition->setArguments($this->getArgumentsAsPhp($service, 'argument', $file, $definition instanceof ChildDefinition)); $definition->setProperties($this->getArgumentsAsPhp($service, 'property', $file)); if ($factories = $this->getChildren($service, 'factory')) { $factory = $factories[0]; @@ -243,7 +288,7 @@ private function parseDefinition(\DOMElement $service, $file, array $defaults) $definition->setFactory($function); } else { if ($childService = $factory->getAttribute('service')) { - $class = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference($childService, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE); + $class = new Reference($childService, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE); } else { $class = $factory->hasAttribute('class') ? $factory->getAttribute('class') : null; } @@ -256,7 +301,7 @@ private function parseDefinition(\DOMElement $service, $file, array $defaults) $definition->setConfigurator($function); } else { if ($childService = $configurator->getAttribute('service')) { - $class = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference($childService, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE); + $class = new Reference($childService, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE); } else { $class = $configurator->getAttribute('class'); } @@ -268,7 +313,7 @@ private function parseDefinition(\DOMElement $service, $file, array $defaults) } $tags = $this->getChildren($service, 'tag'); if (!empty($defaults['tags'])) { - $tags = \array_merge($tags, $defaults['tags']); + $tags = array_merge($tags, $defaults['tags']); } foreach ($tags as $tag) { $parameters = []; @@ -276,14 +321,14 @@ private function parseDefinition(\DOMElement $service, $file, array $defaults) if ('name' === $name) { continue; } - if (\false !== \strpos($name, '-') && \false === \strpos($name, '_') && !\array_key_exists($normalizedName = \str_replace('-', '_', $name), $parameters)) { - $parameters[$normalizedName] = \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::phpize($node->nodeValue); + if (false !== strpos($name, '-') && false === strpos($name, '_') && !array_key_exists($normalizedName = str_replace('-', '_', $name), $parameters)) { + $parameters[$normalizedName] = XmlUtils::phpize($node->nodeValue); } // keep not normalized key - $parameters[$name] = \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::phpize($node->nodeValue); + $parameters[$name] = XmlUtils::phpize($node->nodeValue); } if ('' === $tag->getAttribute('name')) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The tag name for service "%s" in "%s" must be a non-empty string.', (string) $service->getAttribute('id'), $file)); + throw new InvalidArgumentException(sprintf('The tag name for service "%s" in "%s" must be a non-empty string.', (string) $service->getAttribute('id'), $file)); } $definition->addTag($tag->getAttribute('name'), $parameters); } @@ -293,7 +338,7 @@ private function parseDefinition(\DOMElement $service, $file, array $defaults) $bindings = $this->getArgumentsAsPhp($service, 'bind', $file); if (isset($defaults['bind'])) { // deep clone, to avoid multiple process of the same instance in the passes - $bindings = \array_merge(\unserialize(\serialize($defaults['bind'])), $bindings); + $bindings = array_merge(unserialize(serialize($defaults['bind'])), $bindings); } if ($bindings) { $definition->setBindings($bindings); @@ -310,16 +355,16 @@ private function parseDefinition(\DOMElement $service, $file, array $defaults) * * @param string $file Path to a file * - * @return \DOMDocument + * @return DOMDocument * * @throws InvalidArgumentException When loading of XML file returns error */ private function parseFileToDOM($file) { try { - $dom = \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::loadFile($file, [$this, 'validateSchema']); + $dom = XmlUtils::loadFile($file, [$this, 'validateSchema']); } catch (\InvalidArgumentException $e) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Unable to parse file "%s": "%s".', $file, $e->getMessage()), $e->getCode(), $e); + throw new InvalidArgumentException(sprintf('Unable to parse file "%s": "%s".', $file, $e->getMessage()), $e->getCode(), $e); } $this->validateExtensions($dom, $file); return $dom; @@ -330,22 +375,22 @@ private function parseFileToDOM($file) * @param string $file * @param array $defaults */ - private function processAnonymousServices(\DOMDocument $xml, $file, $defaults) + private function processAnonymousServices(DOMDocument $xml, $file, $defaults) { $definitions = []; $count = 0; - $suffix = '~' . \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder::hash($file); - $xpath = new \DOMXPath($xml); + $suffix = '~' . ContainerBuilder::hash($file); + $xpath = new DOMXPath($xml); $xpath->registerNamespace('container', self::NS); // anonymous services as arguments/properties - if (\false !== ($nodes = $xpath->query('//container:argument[@type="service"][not(@id)]|//container:property[@type="service"][not(@id)]|//container:bind[not(@id)]|//container:factory[not(@service)]|//container:configurator[not(@service)]'))) { + if (false !== ($nodes = $xpath->query('//container:argument[@type="service"][not(@id)]|//container:property[@type="service"][not(@id)]|//container:bind[not(@id)]|//container:factory[not(@service)]|//container:configurator[not(@service)]'))) { foreach ($nodes as $node) { if ($services = $this->getChildren($node, 'service')) { // give it a unique name - $id = \sprintf('%d_%s', ++$count, \preg_replace('/^.*\\\\/', '', $services[0]->getAttribute('class')) . $suffix); + $id = sprintf('%d_%s', ++$count, preg_replace('/^.*\\\\/', '', $services[0]->getAttribute('class')) . $suffix); $node->setAttribute('id', $id); $node->setAttribute('service', $id); - $definitions[$id] = [$services[0], $file, \false]; + $definitions[$id] = [$services[0], $file, false]; $services[0]->setAttribute('id', $id); // anonymous services are always private // we could not use the constant false here, because of XML parsing @@ -354,23 +399,23 @@ private function processAnonymousServices(\DOMDocument $xml, $file, $defaults) } } // anonymous services "in the wild" - if (\false !== ($nodes = $xpath->query('//container:services/container:service[not(@id)]'))) { + if (false !== ($nodes = $xpath->query('//container:services/container:service[not(@id)]'))) { foreach ($nodes as $node) { - @\trigger_error(\sprintf('Top-level anonymous services are deprecated since Symfony 3.4, the "id" attribute will be required in version 4.0 in %s at line %d.', $file, $node->getLineNo()), \E_USER_DEPRECATED); + @trigger_error(sprintf('Top-level anonymous services are deprecated since Symfony 3.4, the "id" attribute will be required in version 4.0 in %s at line %d.', $file, $node->getLineNo()), E_USER_DEPRECATED); // give it a unique name - $id = \sprintf('%d_%s', ++$count, \preg_replace('/^.*\\\\/', '', $node->getAttribute('class')) . $suffix); + $id = sprintf('%d_%s', ++$count, preg_replace('/^.*\\\\/', '', $node->getAttribute('class')) . $suffix); $node->setAttribute('id', $id); - $definitions[$id] = [$node, $file, \true]; + $definitions[$id] = [$node, $file, true]; } } // resolve definitions - \uksort($definitions, 'strnatcmp'); - foreach (\array_reverse($definitions) as $id => list($domElement, $file, $wild)) { + uksort($definitions, 'strnatcmp'); + foreach (array_reverse($definitions) as $id => [$domElement, $file, $wild]) { if (null !== ($definition = $this->parseDefinition($domElement, $file, $wild ? $defaults : []))) { $this->setDefinition($id, $definition); } - if (\true === $wild) { - $tmpDomElement = new \DOMElement('_services', null, self::NS); + if (true === $wild) { + $tmpDomElement = new DOMElement('_services', null, self::NS); $domElement->parentNode->replaceChild($tmpDomElement, $domElement); $tmpDomElement->setAttribute('id', $id); } @@ -384,7 +429,7 @@ private function processAnonymousServices(\DOMDocument $xml, $file, $defaults) * * @return mixed */ - private function getArgumentsAsPhp(\DOMElement $node, $name, $file, $isChildDefinition = \false) + private function getArgumentsAsPhp(DOMElement $node, $name, $file, $isChildDefinition = false) { $arguments = []; foreach ($this->getChildren($node, $name) as $arg) { @@ -398,35 +443,35 @@ private function getArgumentsAsPhp(\DOMElement $node, $name, $file, $isChildDefi } elseif (!$arg->hasAttribute('key')) { // Append an empty argument, then fetch its key to overwrite it later $arguments[] = null; - $keys = \array_keys($arguments); - $key = \array_pop($keys); + $keys = array_keys($arguments); + $key = array_pop($keys); } else { $key = $arg->getAttribute('key'); } $onInvalid = $arg->getAttribute('on-invalid'); - $invalidBehavior = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE; + $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE; if ('ignore' == $onInvalid) { - $invalidBehavior = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE; + $invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE; } elseif ('ignore_uninitialized' == $onInvalid) { - $invalidBehavior = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE; + $invalidBehavior = ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE; } elseif ('null' == $onInvalid) { - $invalidBehavior = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::NULL_ON_INVALID_REFERENCE; + $invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE; } switch ($arg->getAttribute('type')) { case 'service': if ('' === $arg->getAttribute('id')) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Tag "<%s>" with type="service" has no or empty "id" attribute in "%s".', $name, $file)); + throw new InvalidArgumentException(sprintf('Tag "<%s>" with type="service" has no or empty "id" attribute in "%s".', $name, $file)); } if ($arg->hasAttribute('strict')) { - @\trigger_error(\sprintf('The "strict" attribute used when referencing the "%s" service is deprecated since Symfony 3.3 and will be removed in 4.0.', $arg->getAttribute('id')), \E_USER_DEPRECATED); + @trigger_error(sprintf('The "strict" attribute used when referencing the "%s" service is deprecated since Symfony 3.3 and will be removed in 4.0.', $arg->getAttribute('id')), E_USER_DEPRECATED); } - $arguments[$key] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference($arg->getAttribute('id'), $invalidBehavior); + $arguments[$key] = new Reference($arg->getAttribute('id'), $invalidBehavior); break; case 'expression': - if (!\class_exists(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression::class)) { - throw new \LogicException(\sprintf('The type="expression" attribute cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".')); + if (!class_exists(Expression::class)) { + throw new LogicException(sprintf('The type="expression" attribute cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".')); } - $arguments[$key] = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression($arg->nodeValue); + $arguments[$key] = new Expression($arg->nodeValue); break; case 'collection': $arguments[$key] = $this->getArgumentsAsPhp($arg, $name, $file); @@ -434,25 +479,25 @@ private function getArgumentsAsPhp(\DOMElement $node, $name, $file, $isChildDefi case 'iterator': $arg = $this->getArgumentsAsPhp($arg, $name, $file); try { - $arguments[$key] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument($arg); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException $e) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Tag "<%s>" with type="iterator" only accepts collections of type="service" references in "%s".', $name, $file)); + $arguments[$key] = new IteratorArgument($arg); + } catch (InvalidArgumentException $e) { + throw new InvalidArgumentException(sprintf('Tag "<%s>" with type="iterator" only accepts collections of type="service" references in "%s".', $name, $file)); } break; case 'tagged': if (!$arg->getAttribute('tag')) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Tag "<%s>" with type="tagged" has no or empty "tag" attribute in "%s".', $name, $file)); + throw new InvalidArgumentException(sprintf('Tag "<%s>" with type="tagged" has no or empty "tag" attribute in "%s".', $name, $file)); } - $arguments[$key] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument($arg->getAttribute('tag')); + $arguments[$key] = new TaggedIteratorArgument($arg->getAttribute('tag')); break; case 'string': $arguments[$key] = $arg->nodeValue; break; case 'constant': - $arguments[$key] = \constant(\trim($arg->nodeValue)); + $arguments[$key] = constant(trim($arg->nodeValue)); break; default: - $arguments[$key] = \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::phpize($arg->nodeValue); + $arguments[$key] = XmlUtils::phpize($arg->nodeValue); } } return $arguments; @@ -462,13 +507,13 @@ private function getArgumentsAsPhp(\DOMElement $node, $name, $file, $isChildDefi * * @param mixed $name * - * @return \DOMElement[] + * @return DOMElement[] */ - private function getChildren(\DOMNode $node, $name) + private function getChildren(DOMNode $node, $name) { $children = []; foreach ($node->childNodes as $child) { - if ($child instanceof \DOMElement && $child->localName === $name && self::NS === $child->namespaceURI) { + if ($child instanceof DOMElement && $child->localName === $name && self::NS === $child->namespaceURI) { $children[] = $child; } } @@ -481,20 +526,20 @@ private function getChildren(\DOMNode $node, $name) * * @throws RuntimeException When extension references a non-existent XSD file */ - public function validateSchema(\DOMDocument $dom) + public function validateSchema(DOMDocument $dom) { - $schemaLocations = ['http://symfony.com/schema/dic/services' => \str_replace('\\', '/', __DIR__ . '/schema/dic/services/services-1.0.xsd')]; + $schemaLocations = ['http://symfony.com/schema/dic/services' => str_replace('\\', '/', __DIR__ . '/schema/dic/services/services-1.0.xsd')]; if ($element = $dom->documentElement->getAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'schemaLocation')) { - $items = \preg_split('/\\s+/', $element); - for ($i = 0, $nb = \count($items); $i < $nb; $i += 2) { + $items = preg_split('/\\s+/', $element); + for ($i = 0, $nb = count($items); $i < $nb; $i += 2) { if (!$this->container->hasExtension($items[$i])) { continue; } - if (($extension = $this->container->getExtension($items[$i])) && \false !== $extension->getXsdValidationBasePath()) { + if (($extension = $this->container->getExtension($items[$i])) && false !== $extension->getXsdValidationBasePath()) { $ns = $extension->getNamespace(); - $path = \str_replace([$ns, \str_replace('http://', 'https://', $ns)], \str_replace('\\', '/', $extension->getXsdValidationBasePath()) . '/', $items[$i + 1]); - if (!\is_file($path)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Extension "%s" references a non-existent XSD file "%s".', \get_class($extension), $path)); + $path = str_replace([$ns, str_replace('http://', 'https://', $ns)], str_replace('\\', '/', $extension->getXsdValidationBasePath()) . '/', $items[$i + 1]); + if (!is_file($path)) { + throw new RuntimeException(sprintf('Extension "%s" references a non-existent XSD file "%s".', get_class($extension), $path)); } $schemaLocations[$items[$i]] = $path; } @@ -503,22 +548,22 @@ public function validateSchema(\DOMDocument $dom) $tmpfiles = []; $imports = ''; foreach ($schemaLocations as $namespace => $location) { - $parts = \explode('/', $location); + $parts = explode('/', $location); $locationstart = 'file:///'; - if (0 === \stripos($location, 'phar://')) { - $tmpfile = \tempnam(\sys_get_temp_dir(), 'symfony'); + if (0 === stripos($location, 'phar://')) { + $tmpfile = tempnam(sys_get_temp_dir(), 'symfony'); if ($tmpfile) { - \copy($location, $tmpfile); + copy($location, $tmpfile); $tmpfiles[] = $tmpfile; - $parts = \explode('/', \str_replace('\\', '/', $tmpfile)); + $parts = explode('/', str_replace('\\', '/', $tmpfile)); } else { - \array_shift($parts); + array_shift($parts); $locationstart = 'phar:///'; } } - $drive = '\\' === \DIRECTORY_SEPARATOR ? \array_shift($parts) . '/' : ''; - $location = $locationstart . $drive . \implode('/', \array_map('rawurlencode', $parts)); - $imports .= \sprintf(' ' . "\n", $namespace, $location); + $drive = '\\' === DIRECTORY_SEPARATOR ? array_shift($parts) . '/' : ''; + $location = $locationstart . $drive . implode('/', array_map('rawurlencode', $parts)); + $imports .= sprintf(' ' . "\n", $namespace, $location); } $source = << @@ -531,11 +576,11 @@ public function validateSchema(\DOMDocument $dom) {$imports} EOF; - $disableEntities = \libxml_disable_entity_loader(\false); + $disableEntities = libxml_disable_entity_loader(false); $valid = @$dom->schemaValidateSource($source); - \libxml_disable_entity_loader($disableEntities); + libxml_disable_entity_loader($disableEntities); foreach ($tmpfiles as $tmpfile) { - @\unlink($tmpfile); + @unlink($tmpfile); } return $valid; } @@ -544,16 +589,16 @@ public function validateSchema(\DOMDocument $dom) * * @param string $file */ - private function validateAlias(\DOMElement $alias, $file) + private function validateAlias(DOMElement $alias, $file) { foreach ($alias->attributes as $name => $node) { - if (!\in_array($name, ['alias', 'id', 'public'])) { - @\trigger_error(\sprintf('Using the attribute "%s" is deprecated for the service "%s" which is defined as an alias in "%s". Allowed attributes for service aliases are "alias", "id" and "public". The XmlFileLoader will raise an exception in Symfony 4.0, instead of silently ignoring unsupported attributes.', $name, $alias->getAttribute('id'), $file), \E_USER_DEPRECATED); + if (!in_array($name, ['alias', 'id', 'public'])) { + @trigger_error(sprintf('Using the attribute "%s" is deprecated for the service "%s" which is defined as an alias in "%s". Allowed attributes for service aliases are "alias", "id" and "public". The XmlFileLoader will raise an exception in Symfony 4.0, instead of silently ignoring unsupported attributes.', $name, $alias->getAttribute('id'), $file), E_USER_DEPRECATED); } } foreach ($alias->childNodes as $child) { - if ($child instanceof \DOMElement && self::NS === $child->namespaceURI) { - @\trigger_error(\sprintf('Using the element "%s" is deprecated for the service "%s" which is defined as an alias in "%s". The XmlFileLoader will raise an exception in Symfony 4.0, instead of silently ignoring unsupported elements.', $child->localName, $alias->getAttribute('id'), $file), \E_USER_DEPRECATED); + if ($child instanceof DOMElement && self::NS === $child->namespaceURI) { + @trigger_error(sprintf('Using the element "%s" is deprecated for the service "%s" which is defined as an alias in "%s". The XmlFileLoader will raise an exception in Symfony 4.0, instead of silently ignoring unsupported elements.', $child->localName, $alias->getAttribute('id'), $file), E_USER_DEPRECATED); } } } @@ -564,32 +609,32 @@ private function validateAlias(\DOMElement $alias, $file) * * @throws InvalidArgumentException When no extension is found corresponding to a tag */ - private function validateExtensions(\DOMDocument $dom, $file) + private function validateExtensions(DOMDocument $dom, $file) { foreach ($dom->documentElement->childNodes as $node) { - if (!$node instanceof \DOMElement || 'http://symfony.com/schema/dic/services' === $node->namespaceURI) { + if (!$node instanceof DOMElement || 'http://symfony.com/schema/dic/services' === $node->namespaceURI) { continue; } // can it be handled by an extension? if (!$this->container->hasExtension($node->namespaceURI)) { - $extensionNamespaces = \array_filter(\array_map(function ($ext) { + $extensionNamespaces = array_filter(array_map(function ($ext) { return $ext->getNamespace(); }, $this->container->getExtensions())); - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('There is no extension able to load the configuration for "%s" (in "%s"). Looked for namespace "%s", found "%s".', $node->tagName, $file, $node->namespaceURI, $extensionNamespaces ? \sprintf('"%s"', \implode('", "', $extensionNamespaces)) : 'none')); + throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in "%s"). Looked for namespace "%s", found "%s".', $node->tagName, $file, $node->namespaceURI, $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none')); } } } /** * Loads from an extension. */ - private function loadFromExtensions(\DOMDocument $xml) + private function loadFromExtensions(DOMDocument $xml) { foreach ($xml->documentElement->childNodes as $node) { - if (!$node instanceof \DOMElement || self::NS === $node->namespaceURI) { + if (!$node instanceof DOMElement || self::NS === $node->namespaceURI) { continue; } $values = static::convertDomElementToArray($node); - if (!\is_array($values)) { + if (!is_array($values)) { $values = []; } $this->container->loadFromExtension($node->namespaceURI, $values); @@ -610,12 +655,12 @@ private function loadFromExtensions(\DOMDocument $xml) * * * The nested-tags are converted to keys (bar) * - * @param \DOMElement $element A \DOMElement instance + * @param DOMElement $element A \DOMElement instance * * @return mixed */ - public static function convertDomElementToArray(\DOMElement $element) + public static function convertDomElementToArray(DOMElement $element) { - return \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Util\XmlUtils::convertDomElementToArray($element); + return XmlUtils::convertDomElementToArray($element); } } diff --git a/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php b/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php index 4a1e5e8f6..4c40b997a 100644 --- a/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php +++ b/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php @@ -27,12 +27,42 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser as YamlParser; use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue; use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml; +use LogicException; +use function array_filter; +use function array_key_exists; +use function array_map; +use function array_merge; +use function class_exists; +use function dirname; +use function explode; +use function file_exists; +use function gettype; +use function implode; +use function in_array; +use function is_array; +use function is_scalar; +use function is_string; +use function pathinfo; +use function preg_match; +use function preg_replace; +use function restore_error_handler; +use function serialize; +use function set_error_handler; +use function sprintf; +use function stream_is_local; +use function strpos; +use function substr; +use function trigger_error; +use function unserialize; +use const E_USER_DEPRECATED; +use const PATHINFO_EXTENSION; + /** * YamlFileLoader loads YAML files service definitions. * * @author Fabien Potencier */ -class YamlFileLoader extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\FileLoader +class YamlFileLoader extends FileLoader { private static $serviceKeywords = ['alias' => 'alias', 'parent' => 'parent', 'class' => 'class', 'shared' => 'shared', 'synthetic' => 'synthetic', 'lazy' => 'lazy', 'public' => 'public', 'abstract' => 'abstract', 'deprecated' => 'deprecated', 'factory' => 'factory', 'file' => 'file', 'arguments' => 'arguments', 'properties' => 'properties', 'configurator' => 'configurator', 'calls' => 'calls', 'tags' => 'tags', 'decorates' => 'decorates', 'decoration_inner_name' => 'decoration_inner_name', 'decoration_priority' => 'decoration_priority', 'autowire' => 'autowire', 'autowiring_types' => 'autowiring_types', 'autoconfigure' => 'autoconfigure', 'bind' => 'bind']; private static $prototypeKeywords = ['resource' => 'resource', 'namespace' => 'namespace', 'exclude' => 'exclude', 'parent' => 'parent', 'shared' => 'shared', 'lazy' => 'lazy', 'public' => 'public', 'abstract' => 'abstract', 'deprecated' => 'deprecated', 'factory' => 'factory', 'arguments' => 'arguments', 'properties' => 'properties', 'configurator' => 'configurator', 'calls' => 'calls', 'tags' => 'tags', 'autowire' => 'autowire', 'autoconfigure' => 'autoconfigure', 'bind' => 'bind']; @@ -57,19 +87,19 @@ public function load($resource, $type = null) $this->parseImports($content, $path); // parameters if (isset($content['parameters'])) { - if (!\is_array($content['parameters'])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The "parameters" key should contain an array in "%s". Check your YAML syntax.', $path)); + if (!is_array($content['parameters'])) { + throw new InvalidArgumentException(sprintf('The "parameters" key should contain an array in "%s". Check your YAML syntax.', $path)); } foreach ($content['parameters'] as $key => $value) { - $this->container->setParameter($key, $this->resolveServices($value, $path, \true)); + $this->container->setParameter($key, $this->resolveServices($value, $path, true)); } } // extensions $this->loadFromExtensions($content); // services $this->anonymousServicesCount = 0; - $this->anonymousServicesSuffix = '~' . \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder::hash($path); - $this->setCurrentDir(\dirname($path)); + $this->anonymousServicesSuffix = '~' . ContainerBuilder::hash($path); + $this->setCurrentDir(dirname($path)); try { $this->parseDefinitions($content, $path); } finally { @@ -81,13 +111,13 @@ public function load($resource, $type = null) */ public function supports($resource, $type = null) { - if (!\is_string($resource)) { - return \false; + if (!is_string($resource)) { + return false; } - if (null === $type && \in_array(\pathinfo($resource, \PATHINFO_EXTENSION), ['yaml', 'yml'], \true)) { - return \true; + if (null === $type && in_array(pathinfo($resource, PATHINFO_EXTENSION), ['yaml', 'yml'], true)) { + return true; } - return \in_array($type, ['yaml', 'yml'], \true); + return in_array($type, ['yaml', 'yml'], true); } /** * Parses all imports. @@ -99,19 +129,19 @@ private function parseImports(array $content, $file) if (!isset($content['imports'])) { return; } - if (!\is_array($content['imports'])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The "imports" key should contain an array in "%s". Check your YAML syntax.', $file)); + if (!is_array($content['imports'])) { + throw new InvalidArgumentException(sprintf('The "imports" key should contain an array in "%s". Check your YAML syntax.', $file)); } - $defaultDirectory = \dirname($file); + $defaultDirectory = dirname($file); foreach ($content['imports'] as $import) { - if (!\is_array($import)) { + if (!is_array($import)) { $import = ['resource' => $import]; } if (!isset($import['resource'])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('An import should provide a resource in "%s". Check your YAML syntax.', $file)); + throw new InvalidArgumentException(sprintf('An import should provide a resource in "%s". Check your YAML syntax.', $file)); } $this->setCurrentDir($defaultDirectory); - $this->import($import['resource'], isset($import['type']) ? $import['type'] : null, isset($import['ignore_errors']) ? (bool) $import['ignore_errors'] : \false, $file); + $this->import($import['resource'], isset($import['type']) ? $import['type'] : null, isset($import['ignore_errors']) ? (bool) $import['ignore_errors'] : false, $file); } } /** @@ -124,28 +154,28 @@ private function parseDefinitions(array $content, $file) if (!isset($content['services'])) { return; } - if (!\is_array($content['services'])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The "services" key should contain an array in "%s". Check your YAML syntax.', $file)); + if (!is_array($content['services'])) { + throw new InvalidArgumentException(sprintf('The "services" key should contain an array in "%s". Check your YAML syntax.', $file)); } - if (\array_key_exists('_instanceof', $content['services'])) { + if (array_key_exists('_instanceof', $content['services'])) { $instanceof = $content['services']['_instanceof']; unset($content['services']['_instanceof']); - if (!\is_array($instanceof)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Service "_instanceof" key must be an array, "%s" given in "%s".', \gettype($instanceof), $file)); + if (!is_array($instanceof)) { + throw new InvalidArgumentException(sprintf('Service "_instanceof" key must be an array, "%s" given in "%s".', gettype($instanceof), $file)); } $this->instanceof = []; - $this->isLoadingInstanceof = \true; + $this->isLoadingInstanceof = true; foreach ($instanceof as $id => $service) { - if (!$service || !\is_array($service)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Type definition "%s" must be a non-empty array within "_instanceof" in "%s". Check your YAML syntax.', $id, $file)); + if (!$service || !is_array($service)) { + throw new InvalidArgumentException(sprintf('Type definition "%s" must be a non-empty array within "_instanceof" in "%s". Check your YAML syntax.', $id, $file)); } - if (\is_string($service) && 0 === \strpos($service, '@')) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Type definition "%s" cannot be an alias within "_instanceof" in "%s". Check your YAML syntax.', $id, $file)); + if (is_string($service) && 0 === strpos($service, '@')) { + throw new InvalidArgumentException(sprintf('Type definition "%s" cannot be an alias within "_instanceof" in "%s". Check your YAML syntax.', $id, $file)); } $this->parseDefinition($id, $service, $file, []); } } - $this->isLoadingInstanceof = \false; + $this->isLoadingInstanceof = false; $defaults = $this->parseDefaults($content, $file); foreach ($content['services'] as $id => $service) { $this->parseDefinition($id, $service, $file, $defaults); @@ -160,48 +190,48 @@ private function parseDefinitions(array $content, $file) */ private function parseDefaults(array &$content, $file) { - if (!\array_key_exists('_defaults', $content['services'])) { + if (!array_key_exists('_defaults', $content['services'])) { return []; } $defaults = $content['services']['_defaults']; unset($content['services']['_defaults']); - if (!\is_array($defaults)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Service "_defaults" key must be an array, "%s" given in "%s".', \gettype($defaults), $file)); + if (!is_array($defaults)) { + throw new InvalidArgumentException(sprintf('Service "_defaults" key must be an array, "%s" given in "%s".', gettype($defaults), $file)); } foreach ($defaults as $key => $default) { if (!isset(self::$defaultsKeywords[$key])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The configuration key "%s" cannot be used to define a default value in "%s". Allowed keys are "%s".', $key, $file, \implode('", "', self::$defaultsKeywords))); + throw new InvalidArgumentException(sprintf('The configuration key "%s" cannot be used to define a default value in "%s". Allowed keys are "%s".', $key, $file, implode('", "', self::$defaultsKeywords))); } } if (isset($defaults['tags'])) { - if (!\is_array($tags = $defaults['tags'])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Parameter "tags" in "_defaults" must be an array in "%s". Check your YAML syntax.', $file)); + if (!is_array($tags = $defaults['tags'])) { + throw new InvalidArgumentException(sprintf('Parameter "tags" in "_defaults" must be an array in "%s". Check your YAML syntax.', $file)); } foreach ($tags as $tag) { - if (!\is_array($tag)) { + if (!is_array($tag)) { $tag = ['name' => $tag]; } if (!isset($tag['name'])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('A "tags" entry in "_defaults" is missing a "name" key in "%s".', $file)); + throw new InvalidArgumentException(sprintf('A "tags" entry in "_defaults" is missing a "name" key in "%s".', $file)); } $name = $tag['name']; unset($tag['name']); - if (!\is_string($name) || '' === $name) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The tag name in "_defaults" must be a non-empty string in "%s".', $file)); + if (!is_string($name) || '' === $name) { + throw new InvalidArgumentException(sprintf('The tag name in "_defaults" must be a non-empty string in "%s".', $file)); } foreach ($tag as $attribute => $value) { - if (!\is_scalar($value) && null !== $value) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Tag "%s", attribute "%s" in "_defaults" must be of a scalar-type in "%s". Check your YAML syntax.', $name, $attribute, $file)); + if (!is_scalar($value) && null !== $value) { + throw new InvalidArgumentException(sprintf('Tag "%s", attribute "%s" in "_defaults" must be of a scalar-type in "%s". Check your YAML syntax.', $name, $attribute, $file)); } } } } if (isset($defaults['bind'])) { - if (!\is_array($defaults['bind'])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Parameter "bind" in "_defaults" must be an array in "%s". Check your YAML syntax.', $file)); + if (!is_array($defaults['bind'])) { + throw new InvalidArgumentException(sprintf('Parameter "bind" in "_defaults" must be an array in "%s". Check your YAML syntax.', $file)); } - $defaults['bind'] = \array_map(function ($v) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\BoundArgument($v); + $defaults['bind'] = array_map(function ($v) { + return new BoundArgument($v); }, $this->resolveServices($defaults['bind'], $file)); } return $defaults; @@ -212,11 +242,11 @@ private function parseDefaults(array &$content, $file) private function isUsingShortSyntax(array $service) { foreach ($service as $key => $value) { - if (\is_string($key) && ('' === $key || '$' !== $key[0])) { - return \false; + if (is_string($key) && ('' === $key || '$' !== $key[0])) { + return false; } } - return \true; + return true; } /** * Parses a definition. @@ -229,45 +259,45 @@ private function isUsingShortSyntax(array $service) */ private function parseDefinition($id, $service, $file, array $defaults) { - if (\preg_match('/^_[a-zA-Z0-9_]*$/', $id)) { - @\trigger_error(\sprintf('Service names that start with an underscore are deprecated since Symfony 3.3 and will be reserved in 4.0. Rename the "%s" service or define it in XML instead.', $id), \E_USER_DEPRECATED); + if (preg_match('/^_[a-zA-Z0-9_]*$/', $id)) { + @trigger_error(sprintf('Service names that start with an underscore are deprecated since Symfony 3.3 and will be reserved in 4.0. Rename the "%s" service or define it in XML instead.', $id), E_USER_DEPRECATED); } - if (\is_string($service) && 0 === \strpos($service, '@')) { - $this->container->setAlias($id, $alias = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Alias(\substr($service, 1))); + if (is_string($service) && 0 === strpos($service, '@')) { + $this->container->setAlias($id, $alias = new Alias(substr($service, 1))); if (isset($defaults['public'])) { $alias->setPublic($defaults['public']); } return; } - if (\is_array($service) && $this->isUsingShortSyntax($service)) { + if (is_array($service) && $this->isUsingShortSyntax($service)) { $service = ['arguments' => $service]; } if (null === $service) { $service = []; } - if (!\is_array($service)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('A service definition must be an array or a string starting with "@" but "%s" found for service "%s" in "%s". Check your YAML syntax.', \gettype($service), $id, $file)); + if (!is_array($service)) { + throw new InvalidArgumentException(sprintf('A service definition must be an array or a string starting with "@" but "%s" found for service "%s" in "%s". Check your YAML syntax.', gettype($service), $id, $file)); } $this->checkDefinition($id, $service, $file); if (isset($service['alias'])) { - $this->container->setAlias($id, $alias = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Alias($service['alias'])); - if (\array_key_exists('public', $service)) { + $this->container->setAlias($id, $alias = new Alias($service['alias'])); + if (array_key_exists('public', $service)) { $alias->setPublic($service['public']); } elseif (isset($defaults['public'])) { $alias->setPublic($defaults['public']); } foreach ($service as $key => $value) { - if (!\in_array($key, ['alias', 'public'])) { - @\trigger_error(\sprintf('The configuration key "%s" is unsupported for the service "%s" which is defined as an alias in "%s". Allowed configuration keys for service aliases are "alias" and "public". The YamlFileLoader will raise an exception in Symfony 4.0, instead of silently ignoring unsupported attributes.', $key, $id, $file), \E_USER_DEPRECATED); + if (!in_array($key, ['alias', 'public'])) { + @trigger_error(sprintf('The configuration key "%s" is unsupported for the service "%s" which is defined as an alias in "%s". Allowed configuration keys for service aliases are "alias" and "public". The YamlFileLoader will raise an exception in Symfony 4.0, instead of silently ignoring unsupported attributes.', $key, $id, $file), E_USER_DEPRECATED); } } return; } if ($this->isLoadingInstanceof) { - $definition = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition(''); + $definition = new ChildDefinition(''); } elseif (isset($service['parent'])) { if (!empty($this->instanceof)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The service "%s" cannot use the "parent" option in the same file where "_instanceof" configuration is defined as using both is not supported. Move your child definitions to a separate file.', $id)); + throw new InvalidArgumentException(sprintf('The service "%s" cannot use the "parent" option in the same file where "_instanceof" configuration is defined as using both is not supported. Move your child definitions to a separate file.', $id)); } foreach ($defaults as $k => $v) { if ('tags' === $k) { @@ -276,15 +306,15 @@ private function parseDefinition($id, $service, $file, array $defaults) continue; } if ('bind' === $k) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Attribute "bind" on service "%s" cannot be inherited from "_defaults" when a "parent" is set. Move your child definitions to a separate file.', $id)); + throw new InvalidArgumentException(sprintf('Attribute "bind" on service "%s" cannot be inherited from "_defaults" when a "parent" is set. Move your child definitions to a separate file.', $id)); } if (!isset($service[$k])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Attribute "%s" on service "%s" cannot be inherited from "_defaults" when a "parent" is set. Move your child definitions to a separate file or define this attribute explicitly.', $k, $id)); + throw new InvalidArgumentException(sprintf('Attribute "%s" on service "%s" cannot be inherited from "_defaults" when a "parent" is set. Move your child definitions to a separate file or define this attribute explicitly.', $k, $id)); } } - $definition = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition($service['parent']); + $definition = new ChildDefinition($service['parent']); } else { - $definition = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(); + $definition = new Definition(); if (isset($defaults['public'])) { $definition->setPublic($defaults['public']); } @@ -314,8 +344,8 @@ private function parseDefinition($id, $service, $file, array $defaults) if (isset($service['abstract'])) { $definition->setAbstract($service['abstract']); } - if (\array_key_exists('deprecated', $service)) { - $definition->setDeprecated(\true, $service['deprecated']); + if (array_key_exists('deprecated', $service)) { + $definition->setDeprecated(true, $service['deprecated']); } if (isset($service['factory'])) { $definition->setFactory($this->parseCallable($service['factory'], 'factory', $id, $file)); @@ -333,8 +363,8 @@ private function parseDefinition($id, $service, $file, array $defaults) $definition->setConfigurator($this->parseCallable($service['configurator'], 'configurator', $id, $file)); } if (isset($service['calls'])) { - if (!\is_array($service['calls'])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Parameter "calls" must be an array for service "%s" in "%s". Check your YAML syntax.', $id, $file)); + if (!is_array($service['calls'])) { + throw new InvalidArgumentException(sprintf('Parameter "calls" must be an array for service "%s" in "%s". Check your YAML syntax.', $id, $file)); } foreach ($service['calls'] as $call) { if (isset($call['method'])) { @@ -344,41 +374,41 @@ private function parseDefinition($id, $service, $file, array $defaults) $method = $call[0]; $args = isset($call[1]) ? $this->resolveServices($call[1], $file) : []; } - if (!\is_array($args)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The second parameter for function call "%s" must be an array of its arguments for service "%s" in "%s". Check your YAML syntax.', $method, $id, $file)); + if (!is_array($args)) { + throw new InvalidArgumentException(sprintf('The second parameter for function call "%s" must be an array of its arguments for service "%s" in "%s". Check your YAML syntax.', $method, $id, $file)); } $definition->addMethodCall($method, $args); } } $tags = isset($service['tags']) ? $service['tags'] : []; - if (!\is_array($tags)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Parameter "tags" must be an array for service "%s" in "%s". Check your YAML syntax.', $id, $file)); + if (!is_array($tags)) { + throw new InvalidArgumentException(sprintf('Parameter "tags" must be an array for service "%s" in "%s". Check your YAML syntax.', $id, $file)); } if (isset($defaults['tags'])) { - $tags = \array_merge($tags, $defaults['tags']); + $tags = array_merge($tags, $defaults['tags']); } foreach ($tags as $tag) { - if (!\is_array($tag)) { + if (!is_array($tag)) { $tag = ['name' => $tag]; } if (!isset($tag['name'])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('A "tags" entry is missing a "name" key for service "%s" in "%s".', $id, $file)); + throw new InvalidArgumentException(sprintf('A "tags" entry is missing a "name" key for service "%s" in "%s".', $id, $file)); } $name = $tag['name']; unset($tag['name']); - if (!\is_string($name) || '' === $name) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The tag name for service "%s" in "%s" must be a non-empty string.', $id, $file)); + if (!is_string($name) || '' === $name) { + throw new InvalidArgumentException(sprintf('The tag name for service "%s" in "%s" must be a non-empty string.', $id, $file)); } foreach ($tag as $attribute => $value) { - if (!\is_scalar($value) && null !== $value) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('A "tags" attribute must be of a scalar-type for service "%s", tag "%s", attribute "%s" in "%s". Check your YAML syntax.', $id, $name, $attribute, $file)); + if (!is_scalar($value) && null !== $value) { + throw new InvalidArgumentException(sprintf('A "tags" attribute must be of a scalar-type for service "%s", tag "%s", attribute "%s" in "%s". Check your YAML syntax.', $id, $name, $attribute, $file)); } } $definition->addTag($name, $tag); } if (isset($service['decorates'])) { if ('' !== $service['decorates'] && '@' === $service['decorates'][0]) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The value of the "decorates" option for the "%s" service must be the id of the service without the "@" prefix (replace "%s" with "%s").', $id, $service['decorates'], \substr($service['decorates'], 1))); + throw new InvalidArgumentException(sprintf('The value of the "decorates" option for the "%s" service must be the id of the service without the "@" prefix (replace "%s" with "%s").', $id, $service['decorates'], substr($service['decorates'], 1))); } $renameId = isset($service['decoration_inner_name']) ? $service['decoration_inner_name'] : null; $priority = isset($service['decoration_priority']) ? $service['decoration_priority'] : 0; @@ -388,15 +418,15 @@ private function parseDefinition($id, $service, $file, array $defaults) $definition->setAutowired($service['autowire']); } if (isset($service['autowiring_types'])) { - if (\is_string($service['autowiring_types'])) { + if (is_string($service['autowiring_types'])) { $definition->addAutowiringType($service['autowiring_types']); } else { - if (!\is_array($service['autowiring_types'])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Parameter "autowiring_types" must be a string or an array for service "%s" in "%s". Check your YAML syntax.', $id, $file)); + if (!is_array($service['autowiring_types'])) { + throw new InvalidArgumentException(sprintf('Parameter "autowiring_types" must be a string or an array for service "%s" in "%s". Check your YAML syntax.', $id, $file)); } foreach ($service['autowiring_types'] as $autowiringType) { - if (!\is_string($autowiringType)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('A "autowiring_types" attribute must be of type string for service "%s" in "%s". Check your YAML syntax.', $id, $file)); + if (!is_string($autowiringType)) { + throw new InvalidArgumentException(sprintf('A "autowiring_types" attribute must be of type string for service "%s" in "%s". Check your YAML syntax.', $id, $file)); } $definition->addAutowiringType($autowiringType); } @@ -404,28 +434,28 @@ private function parseDefinition($id, $service, $file, array $defaults) } if (isset($defaults['bind']) || isset($service['bind'])) { // deep clone, to avoid multiple process of the same instance in the passes - $bindings = isset($defaults['bind']) ? \unserialize(\serialize($defaults['bind'])) : []; + $bindings = isset($defaults['bind']) ? unserialize(serialize($defaults['bind'])) : []; if (isset($service['bind'])) { - if (!\is_array($service['bind'])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Parameter "bind" must be an array for service "%s" in "%s". Check your YAML syntax.', $id, $file)); + if (!is_array($service['bind'])) { + throw new InvalidArgumentException(sprintf('Parameter "bind" must be an array for service "%s" in "%s". Check your YAML syntax.', $id, $file)); } - $bindings = \array_merge($bindings, $this->resolveServices($service['bind'], $file)); + $bindings = array_merge($bindings, $this->resolveServices($service['bind'], $file)); } $definition->setBindings($bindings); } if (isset($service['autoconfigure'])) { - if (!$definition instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition) { + if (!$definition instanceof ChildDefinition) { $definition->setAutoconfigured($service['autoconfigure']); } elseif ($service['autoconfigure']) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The service "%s" cannot have a "parent" and also have "autoconfigure". Try setting "autoconfigure: false" for the service.', $id)); + throw new InvalidArgumentException(sprintf('The service "%s" cannot have a "parent" and also have "autoconfigure". Try setting "autoconfigure: false" for the service.', $id)); } } - if (\array_key_exists('namespace', $service) && !\array_key_exists('resource', $service)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('A "resource" attribute must be set when the "namespace" attribute is set for service "%s" in "%s". Check your YAML syntax.', $id, $file)); + if (array_key_exists('namespace', $service) && !array_key_exists('resource', $service)) { + throw new InvalidArgumentException(sprintf('A "resource" attribute must be set when the "namespace" attribute is set for service "%s" in "%s". Check your YAML syntax.', $id, $file)); } - if (\array_key_exists('resource', $service)) { - if (!\is_string($service['resource'])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('A "resource" attribute must be of type string for service "%s" in "%s". Check your YAML syntax.', $id, $file)); + if (array_key_exists('resource', $service)) { + if (!is_string($service['resource'])) { + throw new InvalidArgumentException(sprintf('A "resource" attribute must be of type string for service "%s" in "%s". Check your YAML syntax.', $id, $file)); } $exclude = isset($service['exclude']) ? $service['exclude'] : null; $namespace = isset($service['namespace']) ? $service['namespace'] : $id; @@ -448,26 +478,26 @@ private function parseDefinition($id, $service, $file, array $defaults) */ private function parseCallable($callable, $parameter, $id, $file) { - if (\is_string($callable)) { + if (is_string($callable)) { if ('' !== $callable && '@' === $callable[0]) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The value of the "%s" option for the "%s" service must be the id of the service without the "@" prefix (replace "%s" with "%s").', $parameter, $id, $callable, \substr($callable, 1))); + throw new InvalidArgumentException(sprintf('The value of the "%s" option for the "%s" service must be the id of the service without the "@" prefix (replace "%s" with "%s").', $parameter, $id, $callable, substr($callable, 1))); } - if (\false !== \strpos($callable, ':') && \false === \strpos($callable, '::')) { - $parts = \explode(':', $callable); + if (false !== strpos($callable, ':') && false === strpos($callable, '::')) { + $parts = explode(':', $callable); return [$this->resolveServices('@' . $parts[0], $file), $parts[1]]; } return $callable; } - if (\is_array($callable)) { + if (is_array($callable)) { if (isset($callable[0]) && isset($callable[1])) { return [$this->resolveServices($callable[0], $file), $callable[1]]; } if ('factory' === $parameter && isset($callable[1]) && null === $callable[0]) { return $callable; } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Parameter "%s" must contain an array with two elements for service "%s" in "%s". Check your YAML syntax.', $parameter, $id, $file)); + throw new InvalidArgumentException(sprintf('Parameter "%s" must contain an array with two elements for service "%s" in "%s". Check your YAML syntax.', $parameter, $id, $file)); } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Parameter "%s" must be a string or an array for service "%s" in "%s". Check your YAML syntax.', $parameter, $id, $file)); + throw new InvalidArgumentException(sprintf('Parameter "%s" must be a string or an array for service "%s" in "%s". Check your YAML syntax.', $parameter, $id, $file)); } /** * Loads a YAML file. @@ -480,28 +510,28 @@ private function parseCallable($callable, $parameter, $id, $file) */ protected function loadFile($file) { - if (!\class_exists('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Parser')) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException('Unable to load YAML config files as the Symfony Yaml Component is not installed.'); + if (!class_exists('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Parser')) { + throw new RuntimeException('Unable to load YAML config files as the Symfony Yaml Component is not installed.'); } - if (!\stream_is_local($file)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('This is not a local file "%s".', $file)); + if (!stream_is_local($file)) { + throw new InvalidArgumentException(sprintf('This is not a local file "%s".', $file)); } - if (!\file_exists($file)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The file "%s" does not exist.', $file)); + if (!file_exists($file)) { + throw new InvalidArgumentException(sprintf('The file "%s" does not exist.', $file)); } if (null === $this->yamlParser) { - $this->yamlParser = new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser(); + $this->yamlParser = new YamlParser(); } - $prevErrorHandler = \set_error_handler(function ($level, $message, $script, $line) use($file, &$prevErrorHandler) { - $message = \E_USER_DEPRECATED === $level ? \preg_replace('/ on line \\d+/', ' in "' . $file . '"$0', $message) : $message; - return $prevErrorHandler ? $prevErrorHandler($level, $message, $script, $line) : \false; + $prevErrorHandler = set_error_handler(function ($level, $message, $script, $line) use($file, &$prevErrorHandler) { + $message = E_USER_DEPRECATED === $level ? preg_replace('/ on line \\d+/', ' in "' . $file . '"$0', $message) : $message; + return $prevErrorHandler ? $prevErrorHandler($level, $message, $script, $line) : false; }); try { - $configuration = $this->yamlParser->parseFile($file, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_CONSTANT | \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_CUSTOM_TAGS); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException $e) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The file "%s" does not contain valid YAML: %s.', $file, $e->getMessage()), 0, $e); + $configuration = $this->yamlParser->parseFile($file, Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS); + } catch (ParseException $e) { + throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML: %s.', $file, $e->getMessage()), 0, $e); } finally { - \restore_error_handler(); + restore_error_handler(); } return $this->validate($configuration, $file); } @@ -520,18 +550,18 @@ private function validate($content, $file) if (null === $content) { return $content; } - if (!\is_array($content)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The service file "%s" is not valid. It should contain an array. Check your YAML syntax.', $file)); + if (!is_array($content)) { + throw new InvalidArgumentException(sprintf('The service file "%s" is not valid. It should contain an array. Check your YAML syntax.', $file)); } foreach ($content as $namespace => $data) { - if (\in_array($namespace, ['imports', 'parameters', 'services'])) { + if (in_array($namespace, ['imports', 'parameters', 'services'])) { continue; } if (!$this->container->hasExtension($namespace)) { - $extensionNamespaces = \array_filter(\array_map(function ($ext) { + $extensionNamespaces = array_filter(array_map(function ($ext) { return $ext->getAlias(); }, $this->container->getExtensions())); - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('There is no extension able to load the configuration for "%s" (in "%s"). Looked for namespace "%s", found "%s".', $namespace, $file, $namespace, $extensionNamespaces ? \sprintf('"%s"', \implode('", "', $extensionNamespaces)) : 'none')); + throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in "%s"). Looked for namespace "%s", found "%s".', $namespace, $file, $namespace, $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none')); } } return $content; @@ -545,76 +575,76 @@ private function validate($content, $file) * * @return array|string|Reference|ArgumentInterface */ - private function resolveServices($value, $file, $isParameter = \false) + private function resolveServices($value, $file, $isParameter = false) { - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue) { + if ($value instanceof TaggedValue) { $argument = $value->getValue(); if ('iterator' === $value->getTag()) { - if (!\is_array($argument)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('"!iterator" tag only accepts sequences in "%s".', $file)); + if (!is_array($argument)) { + throw new InvalidArgumentException(sprintf('"!iterator" tag only accepts sequences in "%s".', $file)); } $argument = $this->resolveServices($argument, $file, $isParameter); try { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument($argument); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException $e) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('"!iterator" tag only accepts arrays of "@service" references in "%s".', $file)); + return new IteratorArgument($argument); + } catch (InvalidArgumentException $e) { + throw new InvalidArgumentException(sprintf('"!iterator" tag only accepts arrays of "@service" references in "%s".', $file)); } } if ('tagged' === $value->getTag()) { - if (!\is_string($argument) || !$argument) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('"!tagged" tag only accepts non empty string in "%s".', $file)); + if (!is_string($argument) || !$argument) { + throw new InvalidArgumentException(sprintf('"!tagged" tag only accepts non empty string in "%s".', $file)); } - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument($argument); + return new TaggedIteratorArgument($argument); } if ('service' === $value->getTag()) { if ($isParameter) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Using an anonymous service in a parameter is not allowed in "%s".', $file)); + throw new InvalidArgumentException(sprintf('Using an anonymous service in a parameter is not allowed in "%s".', $file)); } $isLoadingInstanceof = $this->isLoadingInstanceof; - $this->isLoadingInstanceof = \false; + $this->isLoadingInstanceof = false; $instanceof = $this->instanceof; $this->instanceof = []; - $id = \sprintf('%d_%s', ++$this->anonymousServicesCount, \preg_replace('/^.*\\\\/', '', isset($argument['class']) ? $argument['class'] : '') . $this->anonymousServicesSuffix); + $id = sprintf('%d_%s', ++$this->anonymousServicesCount, preg_replace('/^.*\\\\/', '', isset($argument['class']) ? $argument['class'] : '') . $this->anonymousServicesSuffix); $this->parseDefinition($id, $argument, $file, []); if (!$this->container->hasDefinition($id)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Creating an alias using the tag "!service" is not allowed in "%s".', $file)); + throw new InvalidArgumentException(sprintf('Creating an alias using the tag "!service" is not allowed in "%s".', $file)); } - $this->container->getDefinition($id)->setPublic(\false); + $this->container->getDefinition($id)->setPublic(false); $this->isLoadingInstanceof = $isLoadingInstanceof; $this->instanceof = $instanceof; - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference($id); + return new Reference($id); } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Unsupported tag "!%s".', $value->getTag())); + throw new InvalidArgumentException(sprintf('Unsupported tag "!%s".', $value->getTag())); } - if (\is_array($value)) { + if (is_array($value)) { foreach ($value as $k => $v) { $value[$k] = $this->resolveServices($v, $file, $isParameter); } - } elseif (\is_string($value) && 0 === \strpos($value, '@=')) { - if (!\class_exists(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression::class)) { - throw new \LogicException(\sprintf('The "@=" expression syntax cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".')); + } elseif (is_string($value) && 0 === strpos($value, '@=')) { + if (!class_exists(Expression::class)) { + throw new LogicException(sprintf('The "@=" expression syntax cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".')); } - return new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression(\substr($value, 2)); - } elseif (\is_string($value) && 0 === \strpos($value, '@')) { - if (0 === \strpos($value, '@@')) { - $value = \substr($value, 1); + return new Expression(substr($value, 2)); + } elseif (is_string($value) && 0 === strpos($value, '@')) { + if (0 === strpos($value, '@@')) { + $value = substr($value, 1); $invalidBehavior = null; - } elseif (0 === \strpos($value, '@!')) { - $value = \substr($value, 2); - $invalidBehavior = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE; - } elseif (0 === \strpos($value, '@?')) { - $value = \substr($value, 2); - $invalidBehavior = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE; + } elseif (0 === strpos($value, '@!')) { + $value = substr($value, 2); + $invalidBehavior = ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE; + } elseif (0 === strpos($value, '@?')) { + $value = substr($value, 2); + $invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE; } else { - $value = \substr($value, 1); - $invalidBehavior = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE; + $value = substr($value, 1); + $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE; } - if ('=' === \substr($value, -1)) { - @\trigger_error(\sprintf('The "=" suffix that used to disable strict references in Symfony 2.x is deprecated since Symfony 3.3 and will be unsupported in 4.0. Remove it in "%s".', $value), \E_USER_DEPRECATED); - $value = \substr($value, 0, -1); + if ('=' === substr($value, -1)) { + @trigger_error(sprintf('The "=" suffix that used to disable strict references in Symfony 2.x is deprecated since Symfony 3.3 and will be unsupported in 4.0. Remove it in "%s".', $value), E_USER_DEPRECATED); + $value = substr($value, 0, -1); } if (null !== $invalidBehavior) { - $value = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference($value, $invalidBehavior); + $value = new Reference($value, $invalidBehavior); } } return $value; @@ -625,10 +655,10 @@ private function resolveServices($value, $file, $isParameter = \false) private function loadFromExtensions(array $content) { foreach ($content as $namespace => $values) { - if (\in_array($namespace, ['imports', 'parameters', 'services'])) { + if (in_array($namespace, ['imports', 'parameters', 'services'])) { continue; } - if (!\is_array($values) && null !== $values) { + if (!is_array($values) && null !== $values) { $values = []; } $this->container->loadFromExtension($namespace, $values); @@ -653,9 +683,9 @@ private function checkDefinition($id, array $definition, $file) foreach ($definition as $key => $value) { if (!isset($keywords[$key])) { if ($throw) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The configuration key "%s" is unsupported for definition "%s" in "%s". Allowed configuration keys are "%s".', $key, $id, $file, \implode('", "', $keywords))); + throw new InvalidArgumentException(sprintf('The configuration key "%s" is unsupported for definition "%s" in "%s". Allowed configuration keys are "%s".', $key, $id, $file, implode('", "', $keywords))); } - @\trigger_error(\sprintf('The configuration key "%s" is unsupported for service definition "%s" in "%s". Allowed configuration keys are "%s". The YamlFileLoader object will raise an exception instead in Symfony 4.0 when detecting an unsupported service configuration key.', $key, $id, $file, \implode('", "', $keywords)), \E_USER_DEPRECATED); + @trigger_error(sprintf('The configuration key "%s" is unsupported for service definition "%s" in "%s". Allowed configuration keys are "%s". The YamlFileLoader object will raise an exception instead in Symfony 4.0 when detecting an unsupported service configuration key.', $key, $id, $file, implode('", "', $keywords)), E_USER_DEPRECATED); } } } diff --git a/vendor/symfony/dependency-injection/Loader/index.php b/vendor/symfony/dependency-injection/Loader/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Loader/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Loader/schema/dic/index.php b/vendor/symfony/dependency-injection/Loader/schema/dic/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Loader/schema/dic/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Loader/schema/dic/services/index.php b/vendor/symfony/dependency-injection/Loader/schema/dic/services/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Loader/schema/dic/services/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Loader/schema/index.php b/vendor/symfony/dependency-injection/Loader/schema/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Loader/schema/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/ParameterBag/EnvPlaceholderParameterBag.php b/vendor/symfony/dependency-injection/ParameterBag/EnvPlaceholderParameterBag.php index 04d9463a3..583abf14b 100644 --- a/vendor/symfony/dependency-injection/ParameterBag/EnvPlaceholderParameterBag.php +++ b/vendor/symfony/dependency-injection/ParameterBag/EnvPlaceholderParameterBag.php @@ -12,10 +12,22 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; +use function gettype; +use function is_numeric; +use function is_scalar; +use function md5; +use function mt_rand; +use function preg_match; +use function sprintf; +use function str_replace; +use function strpos; +use function substr; +use function uniqid; + /** * @author Nicolas Grekas */ -class EnvPlaceholderParameterBag extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag +class EnvPlaceholderParameterBag extends ParameterBag { private $envPlaceholders = []; private $providedTypes = []; @@ -24,25 +36,25 @@ class EnvPlaceholderParameterBag extends \_PhpScoper5ea00cc67502b\Symfony\Compon */ public function get($name) { - if (0 === \strpos($name, 'env(') && ')' === \substr($name, -1) && 'env()' !== $name) { - $env = \substr($name, 4, -1); + if (0 === strpos($name, 'env(') && ')' === substr($name, -1) && 'env()' !== $name) { + $env = substr($name, 4, -1); if (isset($this->envPlaceholders[$env])) { foreach ($this->envPlaceholders[$env] as $placeholder) { return $placeholder; // return first result } } - if (!\preg_match('/^(?:\\w++:)*+\\w++$/', $env)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Invalid "%s" name: only "word" characters are allowed.', $name)); + if (!preg_match('/^(?:\\w++:)*+\\w++$/', $env)) { + throw new InvalidArgumentException(sprintf('Invalid "%s" name: only "word" characters are allowed.', $name)); } if ($this->has($name)) { $defaultValue = parent::get($name); - if (null !== $defaultValue && !\is_scalar($defaultValue)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('The default value of an env() parameter must be scalar or null, but "%s" given to "%s".', \gettype($defaultValue), $name)); + if (null !== $defaultValue && !is_scalar($defaultValue)) { + throw new RuntimeException(sprintf('The default value of an env() parameter must be scalar or null, but "%s" given to "%s".', gettype($defaultValue), $name)); } } - $uniqueName = \md5($name . \uniqid(\mt_rand(), \true)); - $placeholder = \sprintf('env_%s_%s', \str_replace(':', '_', $env), $uniqueName); + $uniqueName = md5($name . uniqid(mt_rand(), true)); + $placeholder = sprintf('env_%s_%s', str_replace(':', '_', $env), $uniqueName); $this->envPlaceholders[$env][$placeholder] = $placeholder; return $placeholder; } @@ -98,10 +110,10 @@ public function resolve() if (!$this->has($name = "env({$env})")) { continue; } - if (\is_numeric($default = $this->parameters[$name])) { + if (is_numeric($default = $this->parameters[$name])) { $this->parameters[$name] = (string) $default; - } elseif (null !== $default && !\is_scalar($default)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('The default value of env parameter "%s" must be scalar or null, "%s" given.', $env, \gettype($default))); + } elseif (null !== $default && !is_scalar($default)) { + throw new RuntimeException(sprintf('The default value of env parameter "%s" must be scalar or null, "%s" given.', $env, gettype($default))); } } } diff --git a/vendor/symfony/dependency-injection/ParameterBag/FrozenParameterBag.php b/vendor/symfony/dependency-injection/ParameterBag/FrozenParameterBag.php index c480d1039..c9351a822 100644 --- a/vendor/symfony/dependency-injection/ParameterBag/FrozenParameterBag.php +++ b/vendor/symfony/dependency-injection/ParameterBag/FrozenParameterBag.php @@ -16,7 +16,7 @@ * * @author Fabien Potencier */ -class FrozenParameterBag extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag +class FrozenParameterBag extends ParameterBag { /** * For performance reasons, the constructor assumes that @@ -29,34 +29,34 @@ class FrozenParameterBag extends \_PhpScoper5ea00cc67502b\Symfony\Component\Depe public function __construct(array $parameters = []) { $this->parameters = $parameters; - $this->resolved = \true; + $this->resolved = true; } /** * {@inheritdoc} */ public function clear() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('Impossible to call clear() on a frozen ParameterBag.'); + throw new LogicException('Impossible to call clear() on a frozen ParameterBag.'); } /** * {@inheritdoc} */ public function add(array $parameters) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('Impossible to call add() on a frozen ParameterBag.'); + throw new LogicException('Impossible to call add() on a frozen ParameterBag.'); } /** * {@inheritdoc} */ public function set($name, $value) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('Impossible to call set() on a frozen ParameterBag.'); + throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); } /** * {@inheritdoc} */ public function remove($name) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('Impossible to call remove() on a frozen ParameterBag.'); + throw new LogicException('Impossible to call remove() on a frozen ParameterBag.'); } } diff --git a/vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php b/vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php index ac3862db0..9a4364007 100644 --- a/vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php +++ b/vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php @@ -13,15 +13,37 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; +use function array_key_exists; +use function array_keys; +use function array_map; +use function array_pop; +use function count; +use function explode; +use function gettype; +use function is_array; +use function is_numeric; +use function is_string; +use function levenshtein; +use function preg_match; +use function preg_replace_callback; +use function sprintf; +use function str_replace; +use function strlen; +use function strpos; +use function strtolower; +use function substr; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * Holds parameters. * * @author Fabien Potencier */ -class ParameterBag implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface +class ParameterBag implements ParameterBagInterface { protected $parameters = []; - protected $resolved = \false; + protected $resolved = false; private $normalizedNames = []; /** * @param array $parameters An array of parameters @@ -61,32 +83,32 @@ public function all() public function get($name) { $name = $this->normalizeName($name); - if (!\array_key_exists($name, $this->parameters)) { + if (!array_key_exists($name, $this->parameters)) { if (!$name) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException($name); + throw new ParameterNotFoundException($name); } $alternatives = []; foreach ($this->parameters as $key => $parameterValue) { - $lev = \levenshtein($name, $key); - if ($lev <= \strlen($name) / 3 || \false !== \strpos($key, $name)) { + $lev = levenshtein($name, $key); + if ($lev <= strlen($name) / 3 || false !== strpos($key, $name)) { $alternatives[] = $key; } } $nonNestedAlternative = null; - if (!\count($alternatives) && \false !== \strpos($name, '.')) { - $namePartsLength = \array_map('strlen', \explode('.', $name)); - $key = \substr($name, 0, -1 * (1 + \array_pop($namePartsLength))); - while (\count($namePartsLength)) { + if (!count($alternatives) && false !== strpos($name, '.')) { + $namePartsLength = array_map('strlen', explode('.', $name)); + $key = substr($name, 0, -1 * (1 + array_pop($namePartsLength))); + while (count($namePartsLength)) { if ($this->has($key)) { - if (\is_array($this->get($key))) { + if (is_array($this->get($key))) { $nonNestedAlternative = $key; } break; } - $key = \substr($key, 0, -1 * (1 + \array_pop($namePartsLength))); + $key = substr($key, 0, -1 * (1 + array_pop($namePartsLength))); } } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException($name, null, null, null, $alternatives, $nonNestedAlternative); + throw new ParameterNotFoundException($name, null, null, null, $alternatives, $nonNestedAlternative); } return $this->parameters[$name]; } @@ -105,7 +127,7 @@ public function set($name, $value) */ public function has($name) { - return \array_key_exists($this->normalizeName($name), $this->parameters); + return array_key_exists($this->normalizeName($name), $this->parameters); } /** * Removes a parameter. @@ -129,13 +151,13 @@ public function resolve() try { $value = $this->resolveValue($value); $parameters[$key] = $this->unescapeValue($value); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException $e) { + } catch (ParameterNotFoundException $e) { $e->setSourceKey($key); throw $e; } } $this->parameters = $parameters; - $this->resolved = \true; + $this->resolved = true; } /** * Replaces parameter placeholders (%name%) by their values. @@ -151,14 +173,14 @@ public function resolve() */ public function resolveValue($value, array $resolving = []) { - if (\is_array($value)) { + if (is_array($value)) { $args = []; foreach ($value as $k => $v) { - $args[\is_string($k) ? $this->resolveValue($k, $resolving) : $k] = $this->resolveValue($v, $resolving); + $args[is_string($k) ? $this->resolveValue($k, $resolving) : $k] = $this->resolveValue($v, $resolving); } return $args; } - if (!\is_string($value) || 2 > \strlen($value)) { + if (!is_string($value) || 2 > strlen($value)) { return $value; } return $this->resolveString($value, $resolving); @@ -180,33 +202,33 @@ public function resolveString($value, array $resolving = []) // we do this to deal with non string values (Boolean, integer, ...) // as the preg_replace_callback throw an exception when trying // a non-string in a parameter value - if (\preg_match('/^%([^%\\s]+)%$/', $value, $match)) { + if (preg_match('/^%([^%\\s]+)%$/', $value, $match)) { $key = $match[1]; - $lcKey = \strtolower($key); + $lcKey = strtolower($key); // strtolower() to be removed in 4.0 if (isset($resolving[$lcKey])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException(\array_keys($resolving)); + throw new ParameterCircularReferenceException(array_keys($resolving)); } - $resolving[$lcKey] = \true; + $resolving[$lcKey] = true; return $this->resolved ? $this->get($key) : $this->resolveValue($this->get($key), $resolving); } - return \preg_replace_callback('/%%|%([^%\\s]+)%/', function ($match) use($resolving, $value) { + return preg_replace_callback('/%%|%([^%\\s]+)%/', function ($match) use($resolving, $value) { // skip %% if (!isset($match[1])) { return '%%'; } $key = $match[1]; - $lcKey = \strtolower($key); + $lcKey = strtolower($key); // strtolower() to be removed in 4.0 if (isset($resolving[$lcKey])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException(\array_keys($resolving)); + throw new ParameterCircularReferenceException(array_keys($resolving)); } $resolved = $this->get($key); - if (!\is_string($resolved) && !\is_numeric($resolved)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('A string value must be composed of strings and/or numbers, but found parameter "%s" of type "%s" inside string value "%s".', $key, \gettype($resolved), $value)); + if (!is_string($resolved) && !is_numeric($resolved)) { + throw new RuntimeException(sprintf('A string value must be composed of strings and/or numbers, but found parameter "%s" of type "%s" inside string value "%s".', $key, gettype($resolved), $value)); } $resolved = (string) $resolved; - $resolving[$lcKey] = \true; + $resolving[$lcKey] = true; return $this->isResolved() ? $resolved : $this->resolveString($resolved, $resolving); }, $value); } @@ -219,10 +241,10 @@ public function isResolved() */ public function escapeValue($value) { - if (\is_string($value)) { - return \str_replace('%', '%%', $value); + if (is_string($value)) { + return str_replace('%', '%%', $value); } - if (\is_array($value)) { + if (is_array($value)) { $result = []; foreach ($value as $k => $v) { $result[$k] = $this->escapeValue($v); @@ -236,10 +258,10 @@ public function escapeValue($value) */ public function unescapeValue($value) { - if (\is_string($value)) { - return \str_replace('%%', '%', $value); + if (is_string($value)) { + return str_replace('%%', '%', $value); } - if (\is_array($value)) { + if (is_array($value)) { $result = []; foreach ($value as $k => $v) { $result[$k] = $this->unescapeValue($v); @@ -250,10 +272,10 @@ public function unescapeValue($value) } private function normalizeName($name) { - if (isset($this->normalizedNames[$normalizedName = \strtolower($name)])) { + if (isset($this->normalizedNames[$normalizedName = strtolower($name)])) { $normalizedName = $this->normalizedNames[$normalizedName]; if ((string) $name !== $normalizedName) { - @\trigger_error(\sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), \E_USER_DEPRECATED); + @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), E_USER_DEPRECATED); } } else { $normalizedName = $this->normalizedNames[$normalizedName] = (string) $name; diff --git a/vendor/symfony/dependency-injection/ParameterBag/index.php b/vendor/symfony/dependency-injection/ParameterBag/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/ParameterBag/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Reference.php b/vendor/symfony/dependency-injection/Reference.php index 25772bacb..e3875289e 100644 --- a/vendor/symfony/dependency-injection/Reference.php +++ b/vendor/symfony/dependency-injection/Reference.php @@ -25,7 +25,7 @@ class Reference * * @see Container */ - public function __construct($id, $invalidBehavior = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) + public function __construct($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) { $this->id = (string) $id; $this->invalidBehavior = $invalidBehavior; diff --git a/vendor/symfony/dependency-injection/ResettableContainerInterface.php b/vendor/symfony/dependency-injection/ResettableContainerInterface.php index f166506cc..a27771f4d 100644 --- a/vendor/symfony/dependency-injection/ResettableContainerInterface.php +++ b/vendor/symfony/dependency-injection/ResettableContainerInterface.php @@ -17,7 +17,7 @@ * * @author Christophe Coevoet */ -interface ResettableContainerInterface extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface +interface ResettableContainerInterface extends ContainerInterface { /** * Resets shared services from the container. diff --git a/vendor/symfony/dependency-injection/ServiceLocator.php b/vendor/symfony/dependency-injection/ServiceLocator.php index d95019ea6..b2ad41d11 100644 --- a/vendor/symfony/dependency-injection/ServiceLocator.php +++ b/vendor/symfony/dependency-injection/ServiceLocator.php @@ -13,11 +13,27 @@ use _PhpScoper5ea00cc67502b\Psr\Container\ContainerInterface as PsrContainerInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; +use function array_keys; +use function array_pop; +use function array_search; +use function array_slice; +use function array_values; +use function count; +use function debug_backtrace; +use function end; +use function get_class; +use function implode; +use function is_subclass_of; +use function preg_replace; +use function sprintf; +use const DEBUG_BACKTRACE_IGNORE_ARGS; +use const DEBUG_BACKTRACE_PROVIDE_OBJECT; + /** * @author Robin Chalas * @author Nicolas Grekas */ -class ServiceLocator implements \_PhpScoper5ea00cc67502b\Psr\Container\ContainerInterface +class ServiceLocator implements PsrContainerInterface { private $factories; private $loading = []; @@ -43,13 +59,13 @@ public function has($id) public function get($id) { if (!isset($this->factories[$id])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException($id, \end($this->loading) ?: null, null, [], $this->createServiceNotFoundMessage($id)); + throw new ServiceNotFoundException($id, end($this->loading) ?: null, null, [], $this->createServiceNotFoundMessage($id)); } if (isset($this->loading[$id])) { - $ids = \array_values($this->loading); - $ids = \array_slice($this->loading, \array_search($id, $ids)); + $ids = array_values($this->loading); + $ids = array_slice($this->loading, array_search($id, $ids)); $ids[] = $id; - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException($id, $ids); + throw new ServiceCircularReferenceException($id, $ids); } $this->loading[$id] = $id; try { @@ -65,7 +81,7 @@ public function __invoke($id) /** * @internal */ - public function withContext($externalId, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container $container) + public function withContext($externalId, Container $container) { $locator = clone $this; $locator->externalId = $externalId; @@ -75,13 +91,13 @@ public function withContext($externalId, \_PhpScoper5ea00cc67502b\Symfony\Compon private function createServiceNotFoundMessage($id) { if ($this->loading) { - return \sprintf('The service "%s" has a dependency on a non-existent service "%s". This locator %s', \end($this->loading), $id, $this->formatAlternatives()); + return sprintf('The service "%s" has a dependency on a non-existent service "%s". This locator %s', end($this->loading), $id, $this->formatAlternatives()); } - $class = \debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS, 3); - $class = isset($class[2]['object']) ? \get_class($class[2]['object']) : null; + $class = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS, 3); + $class = isset($class[2]['object']) ? get_class($class[2]['object']) : null; $externalId = $this->externalId ?: $class; $msg = []; - $msg[] = \sprintf('Service "%s" not found:', $id); + $msg[] = sprintf('Service "%s" not found:', $id); if (!$this->container) { $class = null; } elseif ($this->container->has($id) || isset($this->container->getRemovedIds()[$id])) { @@ -90,38 +106,38 @@ private function createServiceNotFoundMessage($id) try { $this->container->get($id); $class = null; - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException $e) { + } catch (ServiceNotFoundException $e) { if ($e->getAlternatives()) { - $msg[] = \sprintf('did you mean %s? Anyway,', $this->formatAlternatives($e->getAlternatives(), 'or')); + $msg[] = sprintf('did you mean %s? Anyway,', $this->formatAlternatives($e->getAlternatives(), 'or')); } else { $class = null; } } } if ($externalId) { - $msg[] = \sprintf('the container inside "%s" is a smaller service locator that %s', $externalId, $this->formatAlternatives()); + $msg[] = sprintf('the container inside "%s" is a smaller service locator that %s', $externalId, $this->formatAlternatives()); } else { - $msg[] = \sprintf('the current service locator %s', $this->formatAlternatives()); + $msg[] = sprintf('the current service locator %s', $this->formatAlternatives()); } if (!$class) { // no-op - } elseif (\is_subclass_of($class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceSubscriberInterface::class)) { - $msg[] = \sprintf('Unless you need extra laziness, try using dependency injection instead. Otherwise, you need to declare it using "%s::getSubscribedServices()".', \preg_replace('/([^\\\\]++\\\\)++/', '', $class)); + } elseif (is_subclass_of($class, ServiceSubscriberInterface::class)) { + $msg[] = sprintf('Unless you need extra laziness, try using dependency injection instead. Otherwise, you need to declare it using "%s::getSubscribedServices()".', preg_replace('/([^\\\\]++\\\\)++/', '', $class)); } else { $msg[] = 'Try using dependency injection instead.'; } - return \implode(' ', $msg); + return implode(' ', $msg); } private function formatAlternatives(array $alternatives = null, $separator = 'and') { $format = '"%s"%s'; if (null === $alternatives) { - if (!($alternatives = \array_keys($this->factories))) { + if (!($alternatives = array_keys($this->factories))) { return 'is empty...'; } - $format = \sprintf('only knows about the %s service%s.', $format, 1 < \count($alternatives) ? 's' : ''); + $format = sprintf('only knows about the %s service%s.', $format, 1 < count($alternatives) ? 's' : ''); } - $last = \array_pop($alternatives); - return \sprintf($format, $alternatives ? \implode('", "', $alternatives) : $last, $alternatives ? \sprintf(' %s "%s"', $separator, $last) : ''); + $last = array_pop($alternatives); + return sprintf($format, $alternatives ? implode('", "', $alternatives) : $last, $alternatives ? sprintf(' %s "%s"', $separator, $last) : ''); } } diff --git a/vendor/symfony/dependency-injection/TaggedContainerInterface.php b/vendor/symfony/dependency-injection/TaggedContainerInterface.php index 4b0543344..13497b9c2 100644 --- a/vendor/symfony/dependency-injection/TaggedContainerInterface.php +++ b/vendor/symfony/dependency-injection/TaggedContainerInterface.php @@ -15,7 +15,7 @@ * * @author Fabien Potencier */ -interface TaggedContainerInterface extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface +interface TaggedContainerInterface extends ContainerInterface { /** * Returns service ids for a given tag. diff --git a/vendor/symfony/dependency-injection/Tests/Argument/RewindableGeneratorTest.php b/vendor/symfony/dependency-injection/Tests/Argument/RewindableGeneratorTest.php index 554e00f51..8dd4c75ab 100644 --- a/vendor/symfony/dependency-injection/Tests/Argument/RewindableGeneratorTest.php +++ b/vendor/symfony/dependency-injection/Tests/Argument/RewindableGeneratorTest.php @@ -12,17 +12,20 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator; -class RewindableGeneratorTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use Countable; +use function count; + +class RewindableGeneratorTest extends TestCase { public function testImplementsCountable() { - $this->assertInstanceOf(\Countable::class, new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator(function () { + $this->assertInstanceOf(Countable::class, new RewindableGenerator(function () { (yield 1); }, 1)); } public function testCountUsesProvidedValue() { - $generator = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator(function () { + $generator = new RewindableGenerator(function () { (yield 1); }, 3); $this->assertCount(3, $generator); @@ -30,7 +33,7 @@ public function testCountUsesProvidedValue() public function testCountUsesProvidedValueAsCallback() { $called = 0; - $generator = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator(function () { + $generator = new RewindableGenerator(function () { (yield 1); }, function () use(&$called) { ++$called; @@ -38,7 +41,7 @@ public function testCountUsesProvidedValueAsCallback() }); $this->assertSame(0, $called, 'Count callback is called lazily'); $this->assertCount(3, $generator); - \count($generator); + count($generator); $this->assertSame(1, $called, 'Count callback is called only once'); } } diff --git a/vendor/symfony/dependency-injection/Tests/Argument/index.php b/vendor/symfony/dependency-injection/Tests/Argument/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Argument/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/ChildDefinitionTest.php b/vendor/symfony/dependency-injection/Tests/ChildDefinitionTest.php index c6bd482fd..857cf32c7 100644 --- a/vendor/symfony/dependency-injection/Tests/ChildDefinitionTest.php +++ b/vendor/symfony/dependency-injection/Tests/ChildDefinitionTest.php @@ -13,11 +13,13 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\DefinitionDecorator; -class ChildDefinitionTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use function ucfirst; + +class ChildDefinitionTest extends TestCase { public function testConstructor() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('foo'); + $def = new ChildDefinition('foo'); $this->assertSame('foo', $def->getParent()); $this->assertSame([], $def->getChanges()); } @@ -26,13 +28,13 @@ public function testConstructor() */ public function testSetProperty($property, $changeKey) { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('foo'); - $getter = 'get' . \ucfirst($property); - $setter = 'set' . \ucfirst($property); + $def = new ChildDefinition('foo'); + $getter = 'get' . ucfirst($property); + $setter = 'set' . ucfirst($property); $this->assertNull($def->{$getter}()); $this->assertSame($def, $def->{$setter}('foo')); $this->assertSame('foo', $def->{$getter}()); - $this->assertSame([$changeKey => \true], $def->getChanges()); + $this->assertSame([$changeKey => true], $def->getChanges()); } public function getPropertyTests() { @@ -40,31 +42,31 @@ public function getPropertyTests() } public function testSetPublic() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('foo'); + $def = new ChildDefinition('foo'); $this->assertTrue($def->isPublic()); - $this->assertSame($def, $def->setPublic(\false)); + $this->assertSame($def, $def->setPublic(false)); $this->assertFalse($def->isPublic()); - $this->assertSame(['public' => \true], $def->getChanges()); + $this->assertSame(['public' => true], $def->getChanges()); } public function testSetLazy() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('foo'); + $def = new ChildDefinition('foo'); $this->assertFalse($def->isLazy()); - $this->assertSame($def, $def->setLazy(\false)); + $this->assertSame($def, $def->setLazy(false)); $this->assertFalse($def->isLazy()); - $this->assertSame(['lazy' => \true], $def->getChanges()); + $this->assertSame(['lazy' => true], $def->getChanges()); } public function testSetAutowired() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('foo'); + $def = new ChildDefinition('foo'); $this->assertFalse($def->isAutowired()); - $this->assertSame($def, $def->setAutowired(\true)); + $this->assertSame($def, $def->setAutowired(true)); $this->assertTrue($def->isAutowired()); - $this->assertSame(['autowired' => \true], $def->getChanges()); + $this->assertSame(['autowired' => true], $def->getChanges()); } public function testSetArgument() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('foo'); + $def = new ChildDefinition('foo'); $this->assertSame([], $def->getArguments()); $this->assertSame($def, $def->replaceArgument(0, 'foo')); $this->assertSame(['index_0' => 'foo'], $def->getArguments()); @@ -72,12 +74,12 @@ public function testSetArgument() public function testReplaceArgumentShouldRequireIntegerIndex() { $this->expectException('InvalidArgumentException'); - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('foo'); + $def = new ChildDefinition('foo'); $def->replaceArgument('0', 'foo'); } public function testReplaceArgument() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('foo'); + $def = new ChildDefinition('foo'); $def->setArguments([0 => 'foo', 1 => 'bar']); $this->assertSame('foo', $def->getArgument(0)); $this->assertSame('bar', $def->getArgument(1)); @@ -92,25 +94,25 @@ public function testReplaceArgument() public function testGetArgumentShouldCheckBounds() { $this->expectException('OutOfBoundsException'); - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('foo'); + $def = new ChildDefinition('foo'); $def->setArguments([0 => 'foo']); $def->replaceArgument(0, 'foo'); $def->getArgument(1); } public function testDefinitionDecoratorAliasExistsForBackwardsCompatibility() { - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition::class, new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\DefinitionDecorator('foo')); + $this->assertInstanceOf(ChildDefinition::class, new DefinitionDecorator('foo')); } public function testCannotCallSetAutoconfigured() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\BadMethodCallException'); - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('foo'); - $def->setAutoconfigured(\true); + $def = new ChildDefinition('foo'); + $def->setAutoconfigured(true); } public function testCannotCallSetInstanceofConditionals() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\BadMethodCallException'); - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('foo'); - $def->setInstanceofConditionals(['Foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('')]); + $def = new ChildDefinition('foo'); + $def->setInstanceofConditionals(['Foo' => new ChildDefinition('')]); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php index 16f18febb..e0af749ba 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php @@ -17,16 +17,16 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; -class AnalyzeServiceReferencesPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class AnalyzeServiceReferencesPassTest extends TestCase { public function testProcess() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('a')->addArgument($ref1 = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b')); - $container->register('b')->addMethodCall('setA', [$ref2 = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('a')]); - $container->register('c')->addArgument($ref3 = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('a'))->addArgument($ref4 = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b')); - $container->register('d')->setProperty('foo', $ref5 = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b')); - $container->register('e')->setConfigurator([$ref6 = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b'), 'methodName']); + $container = new ContainerBuilder(); + $container->register('a')->addArgument($ref1 = new Reference('b')); + $container->register('b')->addMethodCall('setA', [$ref2 = new Reference('a')]); + $container->register('c')->addArgument($ref3 = new Reference('a'))->addArgument($ref4 = new Reference('b')); + $container->register('d')->setProperty('foo', $ref5 = new Reference('b')); + $container->register('e')->setConfigurator([$ref6 = new Reference('b'), 'methodName']); $graph = $this->process($container); $this->assertCount(4, $edges = $graph->getNode('b')->getInEdges()); $this->assertSame($ref1, $edges[0]->getValue()); @@ -36,9 +36,9 @@ public function testProcess() } public function testProcessMarksEdgesLazyWhenReferencedServiceIsLazy() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('a')->setLazy(\true)->addArgument($ref1 = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b')); - $container->register('b')->addArgument($ref2 = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('a')); + $container = new ContainerBuilder(); + $container->register('a')->setLazy(true)->addArgument($ref1 = new Reference('b')); + $container->register('b')->addArgument($ref2 = new Reference('a')); $graph = $this->process($container); $this->assertCount(1, $graph->getNode('b')->getInEdges()); $this->assertCount(1, $edges = $graph->getNode('a')->getInEdges()); @@ -47,10 +47,10 @@ public function testProcessMarksEdgesLazyWhenReferencedServiceIsLazy() } public function testProcessMarksEdgesLazyWhenReferencedFromIteratorArgument() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('a'); $container->register('b'); - $container->register('c')->addArgument($ref1 = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('a'))->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument([$ref2 = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b')])); + $container->register('c')->addArgument($ref1 = new Reference('a'))->addArgument(new IteratorArgument([$ref2 = new Reference('b')])); $graph = $this->process($container); $this->assertCount(1, $graph->getNode('a')->getInEdges()); $this->assertCount(1, $graph->getNode('b')->getInEdges()); @@ -62,28 +62,28 @@ public function testProcessMarksEdgesLazyWhenReferencedFromIteratorArgument() } public function testProcessDetectsReferencesFromInlinedDefinitions() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('a'); - $container->register('b')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(null, [$ref = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('a')])); + $container->register('b')->addArgument(new Definition(null, [$ref = new Reference('a')])); $graph = $this->process($container); $this->assertCount(1, $refs = $graph->getNode('a')->getInEdges()); $this->assertSame($ref, $refs[0]->getValue()); } public function testProcessDetectsReferencesFromIteratorArguments() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('a'); - $container->register('b')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument([$ref = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('a')])); + $container->register('b')->addArgument(new IteratorArgument([$ref = new Reference('a')])); $graph = $this->process($container); $this->assertCount(1, $refs = $graph->getNode('a')->getInEdges()); $this->assertSame($ref, $refs[0]->getValue()); } public function testProcessDetectsReferencesFromInlinedFactoryDefinitions() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('a'); - $factory = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(); - $factory->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('a'), 'a']); + $factory = new Definition(); + $factory->setFactory([new Reference('a'), 'a']); $container->register('b')->addArgument($factory); $graph = $this->process($container); $this->assertTrue($graph->hasNode('a')); @@ -91,24 +91,24 @@ public function testProcessDetectsReferencesFromInlinedFactoryDefinitions() } public function testProcessDoesNotSaveDuplicateReferences() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('a'); - $container->register('b')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(null, [$ref1 = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('a')]))->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(null, [$ref2 = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('a')])); + $container->register('b')->addArgument(new Definition(null, [$ref1 = new Reference('a')]))->addArgument(new Definition(null, [$ref2 = new Reference('a')])); $graph = $this->process($container); $this->assertCount(2, $graph->getNode('a')->getInEdges()); } public function testProcessDetectsFactoryReferences() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('foo', 'stdClass')->setFactory(['stdClass', 'getInstance']); - $container->register('bar', 'stdClass')->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo'), 'getInstance']); + $container->register('bar', 'stdClass')->setFactory([new Reference('foo'), 'getInstance']); $graph = $this->process($container); $this->assertTrue($graph->hasNode('foo')); $this->assertCount(1, $graph->getNode('foo')->getInEdges()); } - protected function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + protected function process(ContainerBuilder $container) { - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RepeatedPass([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass()]); + $pass = new RepeatedPass([new AnalyzeServiceReferencesPass()]); $pass->process($container); return $container->getCompiler()->getServiceReferenceGraph(); } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/AutoAliasServicePassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/AutoAliasServicePassTest.php index 43e7b1369..5175bc3cd 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/AutoAliasServicePassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/AutoAliasServicePassTest.php @@ -13,41 +13,41 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutoAliasServicePass; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; -class AutoAliasServicePassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class AutoAliasServicePassTest extends TestCase { public function testProcessWithMissingParameter() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\ParameterNotFoundException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('example')->addTag('auto_alias', ['format' => '%non_existing%.example']); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutoAliasServicePass(); + $pass = new AutoAliasServicePass(); $pass->process($container); } public function testProcessWithMissingFormat() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('example')->addTag('auto_alias', []); $container->setParameter('existing', 'mysql'); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutoAliasServicePass(); + $pass = new AutoAliasServicePass(); $pass->process($container); } public function testProcessWithNonExistingAlias() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('example', '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\ServiceClassDefault')->addTag('auto_alias', ['format' => '%existing%.example']); $container->setParameter('existing', 'mysql'); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutoAliasServicePass(); + $pass = new AutoAliasServicePass(); $pass->process($container); $this->assertEquals('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\ServiceClassDefault', $container->getDefinition('example')->getClass()); } public function testProcessWithExistingAlias() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('example', '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\ServiceClassDefault')->addTag('auto_alias', ['format' => '%existing%.example']); $container->register('mysql.example', '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\ServiceClassMysql'); $container->setParameter('existing', 'mysql'); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutoAliasServicePass(); + $pass = new AutoAliasServicePass(); $pass->process($container); $this->assertTrue($container->hasAlias('example')); $this->assertEquals('mysql.example', $container->getAlias('example')); @@ -55,13 +55,13 @@ public function testProcessWithExistingAlias() } public function testProcessWithManualAlias() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('example', '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\ServiceClassDefault')->addTag('auto_alias', ['format' => '%existing%.example']); $container->register('mysql.example', '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\ServiceClassMysql'); $container->register('mariadb.example', '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\ServiceClassMariaDb'); $container->setAlias('example', 'mariadb.example'); $container->setParameter('existing', 'mysql'); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutoAliasServicePass(); + $pass = new AutoAliasServicePass(); $pass->process($container); $this->assertTrue($container->hasAlias('example')); $this->assertEquals('mariadb.example', $container->getAlias('example')); @@ -71,9 +71,9 @@ public function testProcessWithManualAlias() class ServiceClassDefault { } -class ServiceClassMysql extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\ServiceClassDefault +class ServiceClassMysql extends ServiceClassDefault { } -class ServiceClassMariaDb extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\ServiceClassMysql +class ServiceClassMariaDb extends ServiceClassMysql { } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/AutowireExceptionPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/AutowireExceptionPassTest.php index eca212080..db8ada3e3 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/AutowireExceptionPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/AutowireExceptionPassTest.php @@ -16,57 +16,59 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\InlineServiceDefinitionsPass; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\AutowiringFailedException; +use Exception; + /** * @group legacy */ -class AutowireExceptionPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class AutowireExceptionPassTest extends TestCase { public function testThrowsException() { - $autowirePass = $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass::class)->getMock(); - $autowireException = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\AutowiringFailedException('foo_service_id', 'An autowiring exception message'); + $autowirePass = $this->getMockBuilder(AutowirePass::class)->getMock(); + $autowireException = new AutowiringFailedException('foo_service_id', 'An autowiring exception message'); $autowirePass->expects($this->any())->method('getAutowiringExceptions')->willReturn([$autowireException]); - $inlinePass = $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\InlineServiceDefinitionsPass::class)->getMock(); + $inlinePass = $this->getMockBuilder(InlineServiceDefinitionsPass::class)->getMock(); $inlinePass->expects($this->any())->method('getInlinedServiceIds')->willReturn([]); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('foo_service_id'); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowireExceptionPass($autowirePass, $inlinePass); + $pass = new AutowireExceptionPass($autowirePass, $inlinePass); try { $pass->process($container); $this->fail('->process() should throw the exception if the service id exists'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertSame($autowireException, $e); } } public function testThrowExceptionIfServiceInlined() { - $autowirePass = $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass::class)->getMock(); - $autowireException = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\AutowiringFailedException('a_service', 'An autowiring exception message'); + $autowirePass = $this->getMockBuilder(AutowirePass::class)->getMock(); + $autowireException = new AutowiringFailedException('a_service', 'An autowiring exception message'); $autowirePass->expects($this->any())->method('getAutowiringExceptions')->willReturn([$autowireException]); - $inlinePass = $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\InlineServiceDefinitionsPass::class)->getMock(); + $inlinePass = $this->getMockBuilder(InlineServiceDefinitionsPass::class)->getMock(); $inlinePass->expects($this->any())->method('getInlinedServiceIds')->willReturn([ // a_service inlined into b_service 'a_service' => ['b_service'], // b_service inlined into c_service 'b_service' => ['c_service'], ]); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); // ONLY register c_service in the final container $container->register('c_service', 'stdClass'); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowireExceptionPass($autowirePass, $inlinePass); + $pass = new AutowireExceptionPass($autowirePass, $inlinePass); try { $pass->process($container); $this->fail('->process() should throw the exception if the service id exists'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertSame($autowireException, $e); } } public function testDoNotThrowExceptionIfServiceInlinedButRemoved() { - $autowirePass = $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass::class)->getMock(); - $autowireException = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\AutowiringFailedException('a_service', 'An autowiring exception message'); + $autowirePass = $this->getMockBuilder(AutowirePass::class)->getMock(); + $autowireException = new AutowiringFailedException('a_service', 'An autowiring exception message'); $autowirePass->expects($this->any())->method('getAutowiringExceptions')->willReturn([$autowireException]); - $inlinePass = $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\InlineServiceDefinitionsPass::class)->getMock(); + $inlinePass = $this->getMockBuilder(InlineServiceDefinitionsPass::class)->getMock(); $inlinePass->expects($this->any())->method('getInlinedServiceIds')->willReturn([ // a_service inlined into b_service 'a_service' => ['b_service'], @@ -74,23 +76,23 @@ public function testDoNotThrowExceptionIfServiceInlinedButRemoved() 'b_service' => ['c_service'], ]); // do NOT register c_service in the container - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowireExceptionPass($autowirePass, $inlinePass); + $container = new ContainerBuilder(); + $pass = new AutowireExceptionPass($autowirePass, $inlinePass); $pass->process($container); // mark the test as passed - $this->assertTrue(\true); + $this->assertTrue(true); } public function testNoExceptionIfServiceRemoved() { - $autowirePass = $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass::class)->getMock(); - $autowireException = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\AutowiringFailedException('non_existent_service'); + $autowirePass = $this->getMockBuilder(AutowirePass::class)->getMock(); + $autowireException = new AutowiringFailedException('non_existent_service'); $autowirePass->expects($this->any())->method('getAutowiringExceptions')->willReturn([$autowireException]); - $inlinePass = $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\InlineServiceDefinitionsPass::class)->getMock(); + $inlinePass = $this->getMockBuilder(InlineServiceDefinitionsPass::class)->getMock(); $inlinePass->expects($this->any())->method('getInlinedServiceIds')->willReturn([]); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowireExceptionPass($autowirePass, $inlinePass); + $container = new ContainerBuilder(); + $pass = new AutowireExceptionPass($autowirePass, $inlinePass); $pass->process($container); // mark the test as passed - $this->assertTrue(\true); + $this->assertTrue(true); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/AutowirePassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/AutowirePassTest.php index 149b87dfa..5f76c0d21 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/AutowirePassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/AutowirePassTest.php @@ -23,36 +23,42 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\includes\FooVariadic; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference; +use ReflectionClass; +use ReflectionObject; +use SplFileObject; +use function array_column; +use function realpath; + require_once __DIR__ . '/../Fixtures/includes/autowiring_classes.php'; /** * @author Kévin Dunglas */ -class AutowirePassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class AutowirePassTest extends TestCase { public function testProcess() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class); - $barDefinition = $container->register('bar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Bar::class); - $barDefinition->setAutowired(\true); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass())->process($container); + $container = new ContainerBuilder(); + $container->register(Foo::class); + $barDefinition = $container->register('bar', Bar::class); + $barDefinition->setAutowired(true); + (new ResolveClassPass())->process($container); + (new AutowirePass())->process($container); $this->assertCount(1, $container->getDefinition('bar')->getArguments()); - $this->assertEquals(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class, (string) $container->getDefinition('bar')->getArgument(0)); + $this->assertEquals(Foo::class, (string) $container->getDefinition('bar')->getArgument(0)); } /** * @requires PHP 5.6 */ public function testProcessVariadic() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class); - $definition = $container->register('fooVariadic', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\includes\FooVariadic::class); - $definition->setAutowired(\true); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass())->process($container); + $container = new ContainerBuilder(); + $container->register(Foo::class); + $definition = $container->register('fooVariadic', FooVariadic::class); + $definition->setAutowired(true); + (new ResolveClassPass())->process($container); + (new AutowirePass())->process($container); $this->assertCount(1, $container->getDefinition('fooVariadic')->getArguments()); - $this->assertEquals(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class, (string) $container->getDefinition('fooVariadic')->getArgument(0)); + $this->assertEquals(Foo::class, (string) $container->getDefinition('fooVariadic')->getArgument(0)); } /** * @group legacy @@ -62,14 +68,14 @@ public function testProcessVariadic() */ public function testProcessAutowireParent() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\B::class); - $cDefinition = $container->register('c', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\C::class); - $cDefinition->setAutowired(\true); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass())->process($container); + $container = new ContainerBuilder(); + $container->register(B::class); + $cDefinition = $container->register('c', C::class); + $cDefinition->setAutowired(true); + (new ResolveClassPass())->process($container); + (new AutowirePass())->process($container); $this->assertCount(1, $container->getDefinition('c')->getArguments()); - $this->assertEquals(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\B::class, (string) $container->getDefinition('c')->getArgument(0)); + $this->assertEquals(B::class, (string) $container->getDefinition('c')->getArgument(0)); } /** * @group legacy @@ -79,15 +85,15 @@ public function testProcessAutowireParent() */ public function testProcessLegacyAutowireWithAvailableInterface() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->setAlias(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\AInterface::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\B::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\B::class); - $cDefinition = $container->register('c', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\C::class); - $cDefinition->setAutowired(\true); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass())->process($container); + $container = new ContainerBuilder(); + $container->setAlias(AInterface::class, B::class); + $container->register(B::class); + $cDefinition = $container->register('c', C::class); + $cDefinition->setAutowired(true); + (new ResolveClassPass())->process($container); + (new AutowirePass())->process($container); $this->assertCount(1, $container->getDefinition('c')->getArguments()); - $this->assertEquals(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\B::class, (string) $container->getDefinition('c')->getArgument(0)); + $this->assertEquals(B::class, (string) $container->getDefinition('c')->getArgument(0)); } /** * @group legacy @@ -97,55 +103,55 @@ public function testProcessLegacyAutowireWithAvailableInterface() */ public function testProcessAutowireInterface() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\F::class); - $gDefinition = $container->register('g', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\G::class); - $gDefinition->setAutowired(\true); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass())->process($container); + $container = new ContainerBuilder(); + $container->register(F::class); + $gDefinition = $container->register('g', G::class); + $gDefinition->setAutowired(true); + (new ResolveClassPass())->process($container); + (new AutowirePass())->process($container); $this->assertCount(3, $container->getDefinition('g')->getArguments()); - $this->assertEquals(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\F::class, (string) $container->getDefinition('g')->getArgument(0)); - $this->assertEquals(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\F::class, (string) $container->getDefinition('g')->getArgument(1)); - $this->assertEquals(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\F::class, (string) $container->getDefinition('g')->getArgument(2)); + $this->assertEquals(F::class, (string) $container->getDefinition('g')->getArgument(0)); + $this->assertEquals(F::class, (string) $container->getDefinition('g')->getArgument(1)); + $this->assertEquals(F::class, (string) $container->getDefinition('g')->getArgument(2)); } public function testCompleteExistingDefinition() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('b', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\B::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\DInterface::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\F::class); - $hDefinition = $container->register('h', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\H::class)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b')); - $hDefinition->setAutowired(\true); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass())->process($container); + $container = new ContainerBuilder(); + $container->register('b', B::class); + $container->register(DInterface::class, F::class); + $hDefinition = $container->register('h', H::class)->addArgument(new Reference('b')); + $hDefinition->setAutowired(true); + (new ResolveClassPass())->process($container); + (new AutowirePass())->process($container); $this->assertCount(2, $container->getDefinition('h')->getArguments()); $this->assertEquals('b', (string) $container->getDefinition('h')->getArgument(0)); - $this->assertEquals(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\DInterface::class, (string) $container->getDefinition('h')->getArgument(1)); + $this->assertEquals(DInterface::class, (string) $container->getDefinition('h')->getArgument(1)); } public function testCompleteExistingDefinitionWithNotDefinedArguments() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\B::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\DInterface::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\F::class); - $hDefinition = $container->register('h', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\H::class)->addArgument('')->addArgument(''); - $hDefinition->setAutowired(\true); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass())->process($container); + $container = new ContainerBuilder(); + $container->register(B::class); + $container->register(DInterface::class, F::class); + $hDefinition = $container->register('h', H::class)->addArgument('')->addArgument(''); + $hDefinition->setAutowired(true); + (new ResolveClassPass())->process($container); + (new AutowirePass())->process($container); $this->assertCount(2, $container->getDefinition('h')->getArguments()); - $this->assertEquals(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\B::class, (string) $container->getDefinition('h')->getArgument(0)); - $this->assertEquals(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\DInterface::class, (string) $container->getDefinition('h')->getArgument(1)); + $this->assertEquals(B::class, (string) $container->getDefinition('h')->getArgument(0)); + $this->assertEquals(DInterface::class, (string) $container->getDefinition('h')->getArgument(1)); } /** * @group legacy */ public function testExceptionsAreStored() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('c1', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CollisionA::class); - $container->register('c2', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CollisionB::class); - $container->register('c3', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CollisionB::class); - $aDefinition = $container->register('a', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CannotBeAutowired::class); - $aDefinition->setAutowired(\true); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass(\false); + $container = new ContainerBuilder(); + $container->register('c1', CollisionA::class); + $container->register('c2', CollisionB::class); + $container->register('c3', CollisionB::class); + $aDefinition = $container->register('a', CannotBeAutowired::class); + $aDefinition->setAutowired(true); + $pass = new AutowirePass(false); $pass->process($container); $this->assertCount(1, $pass->getAutowiringExceptions()); } @@ -153,83 +159,83 @@ public function testPrivateConstructorThrowsAutowireException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\AutowiringFailedException'); $this->expectExceptionMessage('Invalid service "private_service": constructor of class "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\PrivateConstructor" must be public.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->autowire('private_service', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\PrivateConstructor::class); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass(\true); + $container = new ContainerBuilder(); + $container->autowire('private_service', PrivateConstructor::class); + $pass = new AutowirePass(true); $pass->process($container); } public function testTypeCollision() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\AutowiringFailedException'); $this->expectExceptionMessage('Cannot autowire service "a": argument "$collision" of method "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\CannotBeAutowired::__construct()" references interface "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\CollisionInterface" but no such service exists. You should maybe alias this interface to one of these existing services: "c1", "c2", "c3".'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('c1', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CollisionA::class); - $container->register('c2', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CollisionB::class); - $container->register('c3', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CollisionB::class); - $aDefinition = $container->register('a', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CannotBeAutowired::class); - $aDefinition->setAutowired(\true); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass(); + $container = new ContainerBuilder(); + $container->register('c1', CollisionA::class); + $container->register('c2', CollisionB::class); + $container->register('c3', CollisionB::class); + $aDefinition = $container->register('a', CannotBeAutowired::class); + $aDefinition->setAutowired(true); + $pass = new AutowirePass(); $pass->process($container); } public function testTypeNotGuessable() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\AutowiringFailedException'); $this->expectExceptionMessage('Cannot autowire service "a": argument "$k" of method "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\NotGuessableArgument::__construct()" references class "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\Foo" but no such service exists. You should maybe alias this class to one of these existing services: "a1", "a2".'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('a1', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class); - $container->register('a2', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class); - $aDefinition = $container->register('a', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\NotGuessableArgument::class); - $aDefinition->setAutowired(\true); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass(); + $container = new ContainerBuilder(); + $container->register('a1', Foo::class); + $container->register('a2', Foo::class); + $aDefinition = $container->register('a', NotGuessableArgument::class); + $aDefinition->setAutowired(true); + $pass = new AutowirePass(); $pass->process($container); } public function testTypeNotGuessableWithSubclass() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\AutowiringFailedException'); $this->expectExceptionMessage('Cannot autowire service "a": argument "$k" of method "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\NotGuessableArgumentForSubclass::__construct()" references class "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\A" but no such service exists. You should maybe alias this class to one of these existing services: "a1", "a2".'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('a1', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\B::class); - $container->register('a2', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\B::class); - $aDefinition = $container->register('a', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\NotGuessableArgumentForSubclass::class); - $aDefinition->setAutowired(\true); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass(); + $container = new ContainerBuilder(); + $container->register('a1', B::class); + $container->register('a2', B::class); + $aDefinition = $container->register('a', NotGuessableArgumentForSubclass::class); + $aDefinition->setAutowired(true); + $pass = new AutowirePass(); $pass->process($container); } public function testTypeNotGuessableNoServicesFound() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\AutowiringFailedException'); $this->expectExceptionMessage('Cannot autowire service "a": argument "$collision" of method "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\CannotBeAutowired::__construct()" references interface "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\CollisionInterface" but no such service exists.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $aDefinition = $container->register('a', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CannotBeAutowired::class); - $aDefinition->setAutowired(\true); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass(); + $container = new ContainerBuilder(); + $aDefinition = $container->register('a', CannotBeAutowired::class); + $aDefinition->setAutowired(true); + $pass = new AutowirePass(); $pass->process($container); } public function testTypeNotGuessableWithTypeSet() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('a1', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class); - $container->register('a2', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class); - $aDefinition = $container->register('a', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\NotGuessableArgument::class); - $aDefinition->setAutowired(\true); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass(); + $container = new ContainerBuilder(); + $container->register('a1', Foo::class); + $container->register('a2', Foo::class); + $container->register(Foo::class, Foo::class); + $aDefinition = $container->register('a', NotGuessableArgument::class); + $aDefinition->setAutowired(true); + $pass = new AutowirePass(); $pass->process($container); $this->assertCount(1, $container->getDefinition('a')->getArguments()); - $this->assertEquals(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class, (string) $container->getDefinition('a')->getArgument(0)); + $this->assertEquals(Foo::class, (string) $container->getDefinition('a')->getArgument(0)); } public function testWithTypeSet() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('c1', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CollisionA::class); - $container->register('c2', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CollisionB::class); - $container->setAlias(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CollisionInterface::class, 'c2'); - $aDefinition = $container->register('a', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CannotBeAutowired::class); - $aDefinition->setAutowired(\true); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass(); + $container = new ContainerBuilder(); + $container->register('c1', CollisionA::class); + $container->register('c2', CollisionB::class); + $container->setAlias(CollisionInterface::class, 'c2'); + $aDefinition = $container->register('a', CannotBeAutowired::class); + $aDefinition->setAutowired(true); + $pass = new AutowirePass(); $pass->process($container); $this->assertCount(1, $container->getDefinition('a')->getArguments()); - $this->assertEquals(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CollisionInterface::class, (string) $container->getDefinition('a')->getArgument(0)); + $this->assertEquals(CollisionInterface::class, (string) $container->getDefinition('a')->getArgument(0)); } /** * @group legacy @@ -238,76 +244,76 @@ public function testWithTypeSet() */ public function testCreateDefinition() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $coopTilleulsDefinition = $container->register('coop_tilleuls', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\LesTilleuls::class); - $coopTilleulsDefinition->setAutowired(\true); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass(); + $container = new ContainerBuilder(); + $coopTilleulsDefinition = $container->register('coop_tilleuls', LesTilleuls::class); + $coopTilleulsDefinition->setAutowired(true); + $pass = new AutowirePass(); $pass->process($container); $this->assertCount(2, $container->getDefinition('coop_tilleuls')->getArguments()); $this->assertEquals('_PhpScoper5ea00cc67502b\\autowired.Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\Dunglas', $container->getDefinition('coop_tilleuls')->getArgument(0)); $this->assertEquals('_PhpScoper5ea00cc67502b\\autowired.Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\Dunglas', $container->getDefinition('coop_tilleuls')->getArgument(1)); $dunglasDefinition = $container->getDefinition('_PhpScoper5ea00cc67502b\\autowired.Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\Dunglas'); - $this->assertEquals(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Dunglas::class, $dunglasDefinition->getClass()); + $this->assertEquals(Dunglas::class, $dunglasDefinition->getClass()); $this->assertFalse($dunglasDefinition->isPublic()); $this->assertCount(1, $dunglasDefinition->getArguments()); $this->assertEquals('_PhpScoper5ea00cc67502b\\autowired.Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\Lille', $dunglasDefinition->getArgument(0)); $lilleDefinition = $container->getDefinition('_PhpScoper5ea00cc67502b\\autowired.Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\Lille'); - $this->assertEquals(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Lille::class, $lilleDefinition->getClass()); + $this->assertEquals(Lille::class, $lilleDefinition->getClass()); } public function testResolveParameter() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->setParameter('class_name', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Bar::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class); + $container = new ContainerBuilder(); + $container->setParameter('class_name', Bar::class); + $container->register(Foo::class); $barDefinition = $container->register('bar', '%class_name%'); - $barDefinition->setAutowired(\true); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass())->process($container); - $this->assertEquals(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class, $container->getDefinition('bar')->getArgument(0)); + $barDefinition->setAutowired(true); + (new ResolveClassPass())->process($container); + (new AutowirePass())->process($container); + $this->assertEquals(Foo::class, $container->getDefinition('bar')->getArgument(0)); } public function testOptionalParameter() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class); - $optDefinition = $container->register('opt', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\OptionalParameter::class); - $optDefinition->setAutowired(\true); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass())->process($container); + $container = new ContainerBuilder(); + $container->register(A::class); + $container->register(Foo::class); + $optDefinition = $container->register('opt', OptionalParameter::class); + $optDefinition->setAutowired(true); + (new ResolveClassPass())->process($container); + (new AutowirePass())->process($container); $definition = $container->getDefinition('opt'); $this->assertNull($definition->getArgument(0)); - $this->assertEquals(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class, $definition->getArgument(1)); - $this->assertEquals(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class, $definition->getArgument(2)); + $this->assertEquals(A::class, $definition->getArgument(1)); + $this->assertEquals(Foo::class, $definition->getArgument(2)); } public function testDontTriggerAutowiring() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class); - $container->register('bar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Bar::class); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass())->process($container); + $container = new ContainerBuilder(); + $container->register(Foo::class); + $container->register('bar', Bar::class); + (new ResolveClassPass())->process($container); + (new AutowirePass())->process($container); $this->assertCount(0, $container->getDefinition('bar')->getArguments()); } public function testClassNotFoundThrowsException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\AutowiringFailedException'); $this->expectExceptionMessage('Cannot autowire service "a": argument "$r" of method "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\BadTypeHintedArgument::__construct()" has type "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\NotARealClass" but this class was not found.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $aDefinition = $container->register('a', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\BadTypeHintedArgument::class); - $aDefinition->setAutowired(\true); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Dunglas::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Dunglas::class); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass(); + $container = new ContainerBuilder(); + $aDefinition = $container->register('a', BadTypeHintedArgument::class); + $aDefinition->setAutowired(true); + $container->register(Dunglas::class, Dunglas::class); + $pass = new AutowirePass(); $pass->process($container); } public function testParentClassNotFoundThrowsException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\AutowiringFailedException'); $this->expectExceptionMessageRegExp('{^Cannot autowire service "a": argument "\\$r" of method "(Symfony\\\\Component\\\\DependencyInjection\\\\Tests\\\\Compiler\\\\)BadParentTypeHintedArgument::__construct\\(\\)" has type "\\1OptionalServiceClass" but this class is missing a parent class \\(Class "?Symfony\\\\Bug\\\\NotExistClass"? not found}'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $aDefinition = $container->register('a', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\BadParentTypeHintedArgument::class); - $aDefinition->setAutowired(\true); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Dunglas::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Dunglas::class); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass(); + $container = new ContainerBuilder(); + $aDefinition = $container->register('a', BadParentTypeHintedArgument::class); + $aDefinition->setAutowired(true); + $container->register(Dunglas::class, Dunglas::class); + $pass = new AutowirePass(); $pass->process($container); } /** @@ -318,136 +324,136 @@ public function testParentClassNotFoundThrowsException() */ public function testDontUseAbstractServices() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class)->setAbstract(\true); - $container->register('foo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class); - $container->register('bar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Bar::class)->setAutowired(\true); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass())->process($container); + $container = new ContainerBuilder(); + $container->register(Foo::class)->setAbstract(true); + $container->register('foo', Foo::class); + $container->register('bar', Bar::class)->setAutowired(true); + (new ResolveClassPass())->process($container); + (new AutowirePass())->process($container); } public function testSomeSpecificArgumentsAreSet() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Dunglas::class); - $container->register('multiple', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\MultipleArguments::class)->setAutowired(\true)->setArguments([1 => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo'), 3 => ['bar']]); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass())->process($container); + $container = new ContainerBuilder(); + $container->register('foo', Foo::class); + $container->register(A::class); + $container->register(Dunglas::class); + $container->register('multiple', MultipleArguments::class)->setAutowired(true)->setArguments([1 => new Reference('foo'), 3 => ['bar']]); + (new ResolveClassPass())->process($container); + (new AutowirePass())->process($container); $definition = $container->getDefinition('multiple'); - $this->assertEquals([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\MultipleArguments::class), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Dunglas::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Dunglas::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\MultipleArguments::class), ['bar']], $definition->getArguments()); + $this->assertEquals([new TypedReference(A::class, A::class, MultipleArguments::class), new Reference('foo'), new TypedReference(Dunglas::class, Dunglas::class, MultipleArguments::class), ['bar']], $definition->getArguments()); } public function testScalarArgsCannotBeAutowired() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\AutowiringFailedException'); $this->expectExceptionMessage('Cannot autowire service "arg_no_type_hint": argument "$bar" of method "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\MultipleArguments::__construct()" is type-hinted "array", you should configure its value explicitly.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Dunglas::class); - $container->register('arg_no_type_hint', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\MultipleArguments::class)->setArguments([1 => 'foo'])->setAutowired(\true); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass())->process($container); + $container = new ContainerBuilder(); + $container->register(A::class); + $container->register(Dunglas::class); + $container->register('arg_no_type_hint', MultipleArguments::class)->setArguments([1 => 'foo'])->setAutowired(true); + (new ResolveClassPass())->process($container); + (new AutowirePass())->process($container); } public function testNoTypeArgsCannotBeAutowired() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\AutowiringFailedException'); $this->expectExceptionMessage('Cannot autowire service "arg_no_type_hint": argument "$foo" of method "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\MultipleArguments::__construct()" has no type-hint, you should configure its value explicitly.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Dunglas::class); - $container->register('arg_no_type_hint', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\MultipleArguments::class)->setAutowired(\true); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass())->process($container); + $container = new ContainerBuilder(); + $container->register(A::class); + $container->register(Dunglas::class); + $container->register('arg_no_type_hint', MultipleArguments::class)->setAutowired(true); + (new ResolveClassPass())->process($container); + (new AutowirePass())->process($container); } public function testOptionalScalarNotReallyOptionalUsesDefaultValue() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Lille::class); - $definition = $container->register('not_really_optional_scalar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\MultipleArgumentsOptionalScalarNotReallyOptional::class)->setAutowired(\true); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass())->process($container); + $container = new ContainerBuilder(); + $container->register(A::class); + $container->register(Lille::class); + $definition = $container->register('not_really_optional_scalar', MultipleArgumentsOptionalScalarNotReallyOptional::class)->setAutowired(true); + (new ResolveClassPass())->process($container); + (new AutowirePass())->process($container); $this->assertSame('default_val', $definition->getArgument(1)); } public function testOptionalScalarArgsDontMessUpOrder() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Lille::class); - $container->register('with_optional_scalar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\MultipleArgumentsOptionalScalar::class)->setAutowired(\true); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass())->process($container); + $container = new ContainerBuilder(); + $container->register(A::class); + $container->register(Lille::class); + $container->register('with_optional_scalar', MultipleArgumentsOptionalScalar::class)->setAutowired(true); + (new ResolveClassPass())->process($container); + (new AutowirePass())->process($container); $definition = $container->getDefinition('with_optional_scalar'); $this->assertEquals([ - new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\MultipleArgumentsOptionalScalar::class), + new TypedReference(A::class, A::class, MultipleArgumentsOptionalScalar::class), // use the default value 'default_val', - new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Lille::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Lille::class), + new TypedReference(Lille::class, Lille::class), ], $definition->getArguments()); } public function testOptionalScalarArgsNotPassedIfLast() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Lille::class); - $container->register('with_optional_scalar_last', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\MultipleArgumentsOptionalScalarLast::class)->setAutowired(\true); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass())->process($container); + $container = new ContainerBuilder(); + $container->register(A::class); + $container->register(Lille::class); + $container->register('with_optional_scalar_last', MultipleArgumentsOptionalScalarLast::class)->setAutowired(true); + (new ResolveClassPass())->process($container); + (new AutowirePass())->process($container); $definition = $container->getDefinition('with_optional_scalar_last'); - $this->assertEquals([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\MultipleArgumentsOptionalScalarLast::class), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Lille::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Lille::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\MultipleArgumentsOptionalScalarLast::class)], $definition->getArguments()); + $this->assertEquals([new TypedReference(A::class, A::class, MultipleArgumentsOptionalScalarLast::class), new TypedReference(Lille::class, Lille::class, MultipleArgumentsOptionalScalarLast::class)], $definition->getArguments()); } public function testOptionalArgsNoRequiredForCoreClasses() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', \SplFileObject::class)->addArgument('foo.txt')->setAutowired(\true); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass())->process($container); + $container = new ContainerBuilder(); + $container->register('foo', SplFileObject::class)->addArgument('foo.txt')->setAutowired(true); + (new AutowirePass())->process($container); $definition = $container->getDefinition('foo'); $this->assertEquals(['foo.txt'], $definition->getArguments()); } public function testSetterInjection() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CollisionA::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CollisionB::class); + $container = new ContainerBuilder(); + $container->register(Foo::class); + $container->register(A::class); + $container->register(CollisionA::class); + $container->register(CollisionB::class); // manually configure *one* call, to override autowiring - $container->register('setter_injection', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\SetterInjection::class)->setAutowired(\true)->addMethodCall('setWithCallsConfigured', ['manual_arg1', 'manual_arg2']); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass())->process($container); + $container->register('setter_injection', SetterInjection::class)->setAutowired(true)->addMethodCall('setWithCallsConfigured', ['manual_arg1', 'manual_arg2']); + (new ResolveClassPass())->process($container); + (new AutowireRequiredMethodsPass())->process($container); + (new AutowirePass())->process($container); $methodCalls = $container->getDefinition('setter_injection')->getMethodCalls(); - $this->assertEquals(['setWithCallsConfigured', 'setFoo', 'setDependencies', 'setChildMethodWithoutDocBlock'], \array_column($methodCalls, 0)); + $this->assertEquals(['setWithCallsConfigured', 'setFoo', 'setDependencies', 'setChildMethodWithoutDocBlock'], array_column($methodCalls, 0)); // test setWithCallsConfigured args $this->assertEquals(['manual_arg1', 'manual_arg2'], $methodCalls[0][1]); // test setFoo args - $this->assertEquals([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\SetterInjection::class)], $methodCalls[1][1]); + $this->assertEquals([new TypedReference(Foo::class, Foo::class, SetterInjection::class)], $methodCalls[1][1]); } public function testWithNonExistingSetterAndAutowiring() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); $this->expectExceptionMessage('Invalid service "Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CaseSensitiveClass": method "setLogger()" does not exist.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $definition = $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass::class)->setAutowired(\true); + $container = new ContainerBuilder(); + $definition = $container->register(CaseSensitiveClass::class, CaseSensitiveClass::class)->setAutowired(true); $definition->addMethodCall('setLogger'); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass())->process($container); + (new ResolveClassPass())->process($container); + (new AutowireRequiredMethodsPass())->process($container); + (new AutowirePass())->process($container); } public function testExplicitMethodInjection() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CollisionA::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CollisionB::class); - $container->register('setter_injection', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\SetterInjection::class)->setAutowired(\true)->addMethodCall('notASetter', []); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass())->process($container); + $container = new ContainerBuilder(); + $container->register(Foo::class); + $container->register(A::class); + $container->register(CollisionA::class); + $container->register(CollisionB::class); + $container->register('setter_injection', SetterInjection::class)->setAutowired(true)->addMethodCall('notASetter', []); + (new ResolveClassPass())->process($container); + (new AutowireRequiredMethodsPass())->process($container); + (new AutowirePass())->process($container); $methodCalls = $container->getDefinition('setter_injection')->getMethodCalls(); - $this->assertEquals(['notASetter', 'setFoo', 'setDependencies', 'setWithCallsConfigured', 'setChildMethodWithoutDocBlock'], \array_column($methodCalls, 0)); - $this->assertEquals([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\SetterInjection::class)], $methodCalls[0][1]); + $this->assertEquals(['notASetter', 'setFoo', 'setDependencies', 'setWithCallsConfigured', 'setChildMethodWithoutDocBlock'], array_column($methodCalls, 0)); + $this->assertEquals([new TypedReference(A::class, A::class, SetterInjection::class)], $methodCalls[0][1]); } /** * @group legacy @@ -455,11 +461,11 @@ public function testExplicitMethodInjection() */ public function testTypedReference() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('bar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Bar::class)->setProperty('a', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Bar::class)]); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass(); + $container = new ContainerBuilder(); + $container->register('bar', Bar::class)->setProperty('a', [new TypedReference(A::class, A::class, Bar::class)]); + $pass = new AutowirePass(); $pass->process($container); - $this->assertSame(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class, $container->getDefinition('autowired.' . \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class)->getClass()); + $this->assertSame(A::class, $container->getDefinition('autowired.' . A::class)->getClass()); } /** * @dataProvider getCreateResourceTests @@ -467,12 +473,12 @@ public function testTypedReference() */ public function testCreateResourceForClass($className, $isEqual) { - $startingResource = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass::createResourceForClass(new \ReflectionClass(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\ClassForResource::class)); - $newResource = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass::createResourceForClass(new \ReflectionClass(__NAMESPACE__ . '\\' . $className)); + $startingResource = AutowirePass::createResourceForClass(new ReflectionClass(ClassForResource::class)); + $newResource = AutowirePass::createResourceForClass(new ReflectionClass(__NAMESPACE__ . '\\' . $className)); // hack so the objects don't differ by the class name - $startingReflObject = new \ReflectionObject($startingResource); + $startingReflObject = new ReflectionObject($startingResource); $reflProp = $startingReflObject->getProperty('class'); - $reflProp->setAccessible(\true); + $reflProp->setAccessible(true); $reflProp->setValue($startingResource, __NAMESPACE__ . '\\' . $className); if ($isEqual) { $this->assertEquals($startingResource, $newResource); @@ -482,31 +488,31 @@ public function testCreateResourceForClass($className, $isEqual) } public function getCreateResourceTests() { - return [['IdenticalClassResource', \true], ['ClassChangedConstructorArgs', \false]]; + return [['IdenticalClassResource', true], ['ClassChangedConstructorArgs', false]]; } public function testIgnoreServiceWithClassNotExisting() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('class_not_exist', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\OptionalServiceClass::class); - $barDefinition = $container->register('bar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Bar::class); - $barDefinition->setAutowired(\true); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass(); + $container = new ContainerBuilder(); + $container->register('class_not_exist', OptionalServiceClass::class); + $barDefinition = $container->register('bar', Bar::class); + $barDefinition->setAutowired(true); + $container->register(Foo::class, Foo::class); + $pass = new AutowirePass(); $pass->process($container); $this->assertTrue($container->hasDefinition('bar')); } public function testSetterInjectionCollisionThrowsException() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('c1', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CollisionA::class); - $container->register('c2', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CollisionB::class); - $aDefinition = $container->register('setter_injection_collision', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\SetterInjectionCollision::class); - $aDefinition->setAutowired(\true); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass())->process($container); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass(); + $container = new ContainerBuilder(); + $container->register('c1', CollisionA::class); + $container->register('c2', CollisionB::class); + $aDefinition = $container->register('setter_injection_collision', SetterInjectionCollision::class); + $aDefinition->setAutowired(true); + (new AutowireRequiredMethodsPass())->process($container); + $pass = new AutowirePass(); try { $pass->process($container); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\AutowiringFailedException $e) { + } catch (AutowiringFailedException $e) { } $this->assertNotNull($e); $this->assertSame('Cannot autowire service "setter_injection_collision": argument "$collision" of method "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\SetterInjectionCollision::setMultipleInstancesForOneArg()" references interface "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\CollisionInterface" but no such service exists. You should maybe alias this interface to one of these existing services: "c1", "c2".', $e->getMessage()); @@ -515,11 +521,11 @@ public function testInterfaceWithNoImplementationSuggestToWriteOne() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\AutowiringFailedException'); $this->expectExceptionMessage('Cannot autowire service "my_service": argument "$i" of method "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\K::__construct()" references interface "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\IInterface" but no such service exists. Did you create a class that implements this interface?'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $aDefinition = $container->register('my_service', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\K::class); - $aDefinition->setAutowired(\true); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass())->process($container); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass(); + $container = new ContainerBuilder(); + $aDefinition = $container->register('my_service', K::class); + $aDefinition->setAutowired(true); + (new AutowireRequiredMethodsPass())->process($container); + $pass = new AutowirePass(); $pass->process($container); } /** @@ -530,11 +536,11 @@ public function testInterfaceWithNoImplementationSuggestToWriteOne() */ public function testProcessDoesNotTriggerDeprecations() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('deprecated', '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\DeprecatedClass')->setDeprecated(\true); - $container->register('foo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class); - $container->register('bar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Bar::class)->setAutowired(\true); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass(); + $container = new ContainerBuilder(); + $container->register('deprecated', '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\DeprecatedClass')->setDeprecated(true); + $container->register('foo', Foo::class); + $container->register('bar', Bar::class)->setAutowired(true); + $pass = new AutowirePass(); $pass->process($container); $this->assertTrue($container->hasDefinition('deprecated')); $this->assertTrue($container->hasDefinition('foo')); @@ -542,22 +548,22 @@ public function testProcessDoesNotTriggerDeprecations() } public function testEmptyStringIsKept() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Lille::class); - $container->register('foo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\MultipleArgumentsOptionalScalar::class)->setAutowired(\true)->setArguments(['', '']); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass())->process($container); - $this->assertEquals([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\MultipleArgumentsOptionalScalar::class), '', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Lille::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Lille::class)], $container->getDefinition('foo')->getArguments()); + $container = new ContainerBuilder(); + $container->register(A::class); + $container->register(Lille::class); + $container->register('foo', MultipleArgumentsOptionalScalar::class)->setAutowired(true)->setArguments(['', '']); + (new ResolveClassPass())->process($container); + (new AutowirePass())->process($container); + $this->assertEquals([new TypedReference(A::class, A::class, MultipleArgumentsOptionalScalar::class), '', new TypedReference(Lille::class, Lille::class)], $container->getDefinition('foo')->getArguments()); } public function testWithFactory() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class); - $definition = $container->register('a', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class)->setFactory([\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class, 'create'])->setAutowired(\true); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass())->process($container); - $this->assertEquals([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class)], $definition->getArguments()); + $container = new ContainerBuilder(); + $container->register(Foo::class); + $definition = $container->register('a', A::class)->setFactory([A::class, 'create'])->setAutowired(true); + (new ResolveClassPass())->process($container); + (new AutowirePass())->process($container); + $this->assertEquals([new TypedReference(Foo::class, Foo::class, A::class)], $definition->getArguments()); } /** * @dataProvider provideNotWireableCalls @@ -565,16 +571,16 @@ public function testWithFactory() public function testNotWireableCalls($method, $expectedMsg) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\AutowiringFailedException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $foo = $container->register('foo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\NotWireable::class)->setAutowired(\true)->addMethodCall('setBar', [])->addMethodCall('setOptionalNotAutowireable', [])->addMethodCall('setOptionalNoTypeHint', [])->addMethodCall('setOptionalArgNoAutowireable', []); + $container = new ContainerBuilder(); + $foo = $container->register('foo', NotWireable::class)->setAutowired(true)->addMethodCall('setBar', [])->addMethodCall('setOptionalNotAutowireable', [])->addMethodCall('setOptionalNoTypeHint', [])->addMethodCall('setOptionalArgNoAutowireable', []); if ($method) { $foo->addMethodCall($method, []); } - $this->expectException(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException::class); + $this->expectException(RuntimeException::class); $this->expectExceptionMessage($expectedMsg); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass())->process($container); + (new ResolveClassPass())->process($container); + (new AutowireRequiredMethodsPass())->process($container); + (new AutowirePass())->process($container); } public function provideNotWireableCalls() { @@ -588,11 +594,11 @@ public function provideNotWireableCalls() */ public function testByIdAlternative() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->setAlias(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\IInterface::class, 'i'); - $container->register('i', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\I::class); - $container->register('j', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\J::class)->setAutowired(\true); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass(); + $container = new ContainerBuilder(); + $container->setAlias(IInterface::class, 'i'); + $container->register('i', I::class); + $container->register('j', J::class)->setAutowired(true); + $pass = new AutowirePass(); $pass->process($container); } /** @@ -601,46 +607,46 @@ public function testByIdAlternative() */ public function testTypedReferenceDeprecationNotice() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('aClass', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class); - $container->setAlias(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\AInterface::class, 'aClass'); - $container->register('bar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Bar::class)->setProperty('a', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Bar::class)]); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass(); + $container = new ContainerBuilder(); + $container->register('aClass', A::class); + $container->setAlias(AInterface::class, 'aClass'); + $container->register('bar', Bar::class)->setProperty('a', [new TypedReference(A::class, A::class, Bar::class)]); + $pass = new AutowirePass(); $pass->process($container); } public function testExceptionWhenAliasExists() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\AutowiringFailedException'); $this->expectExceptionMessage('Cannot autowire service "j": argument "$i" of method "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\J::__construct()" references class "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\I" but no such service exists. Try changing the type-hint to "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\IInterface" instead.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); // multiple I services... but there *is* IInterface available - $container->setAlias(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\IInterface::class, 'i'); - $container->register('i', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\I::class); - $container->register('i2', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\I::class); + $container->setAlias(IInterface::class, 'i'); + $container->register('i', I::class); + $container->register('i2', I::class); // J type-hints against I concretely - $container->register('j', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\J::class)->setAutowired(\true); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass(); + $container->register('j', J::class)->setAutowired(true); + $pass = new AutowirePass(); $pass->process($container); } public function testExceptionWhenAliasDoesNotExist() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\AutowiringFailedException'); $this->expectExceptionMessage('Cannot autowire service "j": argument "$i" of method "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\J::__construct()" references class "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\I" but no such service exists. You should maybe alias this class to one of these existing services: "i", "i2".'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); // multiple I instances... but no IInterface alias - $container->register('i', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\I::class); - $container->register('i2', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\I::class); + $container->register('i', I::class); + $container->register('i2', I::class); // J type-hints against I concretely - $container->register('j', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\J::class)->setAutowired(\true); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass(); + $container->register('j', J::class)->setAutowired(true); + $pass = new AutowirePass(); $pass->process($container); } public function testInlineServicesAreNotCandidates() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(\realpath(__DIR__ . '/../Fixtures/xml'))); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(realpath(__DIR__ . '/../Fixtures/xml'))); $loader->load('services_inline_not_candidate.xml'); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass(); + $pass = new AutowirePass(); $pass->process($container); $this->assertSame([], $container->getDefinition('autowired')->getArguments()); } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/AutowireRequiredMethodsPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/AutowireRequiredMethodsPassTest.php index c2cc427c9..11cb3fb42 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/AutowireRequiredMethodsPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/AutowireRequiredMethodsPassTest.php @@ -14,22 +14,24 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; +use function array_column; + require_once __DIR__ . '/../Fixtures/includes/autowiring_classes.php'; -class AutowireRequiredMethodsPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class AutowireRequiredMethodsPassTest extends TestCase { public function testSetterInjection() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CollisionA::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CollisionB::class); + $container = new ContainerBuilder(); + $container->register(Foo::class); + $container->register(A::class); + $container->register(CollisionA::class); + $container->register(CollisionB::class); // manually configure *one* call, to override autowiring - $container->register('setter_injection', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\SetterInjection::class)->setAutowired(\true)->addMethodCall('setWithCallsConfigured', ['manual_arg1', 'manual_arg2']); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass())->process($container); + $container->register('setter_injection', SetterInjection::class)->setAutowired(true)->addMethodCall('setWithCallsConfigured', ['manual_arg1', 'manual_arg2']); + (new ResolveClassPass())->process($container); + (new AutowireRequiredMethodsPass())->process($container); $methodCalls = $container->getDefinition('setter_injection')->getMethodCalls(); - $this->assertEquals(['setWithCallsConfigured', 'setFoo', 'setDependencies', 'setChildMethodWithoutDocBlock'], \array_column($methodCalls, 0)); + $this->assertEquals(['setWithCallsConfigured', 'setFoo', 'setDependencies', 'setChildMethodWithoutDocBlock'], array_column($methodCalls, 0)); // test setWithCallsConfigured args $this->assertEquals(['manual_arg1', 'manual_arg2'], $methodCalls[0][1]); // test setFoo args @@ -37,16 +39,16 @@ public function testSetterInjection() } public function testExplicitMethodInjection() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CollisionA::class); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CollisionB::class); - $container->register('setter_injection', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\SetterInjection::class)->setAutowired(\true)->addMethodCall('notASetter', []); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass())->process($container); + $container = new ContainerBuilder(); + $container->register(Foo::class); + $container->register(A::class); + $container->register(CollisionA::class); + $container->register(CollisionB::class); + $container->register('setter_injection', SetterInjection::class)->setAutowired(true)->addMethodCall('notASetter', []); + (new ResolveClassPass())->process($container); + (new AutowireRequiredMethodsPass())->process($container); $methodCalls = $container->getDefinition('setter_injection')->getMethodCalls(); - $this->assertEquals(['notASetter', 'setFoo', 'setDependencies', 'setWithCallsConfigured', 'setChildMethodWithoutDocBlock'], \array_column($methodCalls, 0)); + $this->assertEquals(['notASetter', 'setFoo', 'setDependencies', 'setWithCallsConfigured', 'setChildMethodWithoutDocBlock'], array_column($methodCalls, 0)); $this->assertEquals([], $methodCalls[0][1]); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/CheckArgumentsValidityPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/CheckArgumentsValidityPassTest.php index 186afd941..d8fd8623c 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/CheckArgumentsValidityPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/CheckArgumentsValidityPassTest.php @@ -16,15 +16,15 @@ /** * @author Kévin Dunglas */ -class CheckArgumentsValidityPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class CheckArgumentsValidityPassTest extends TestCase { public function testProcess() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $definition = $container->register('foo'); $definition->setArguments([null, 1, 'a']); $definition->setMethodCalls([['bar', ['a', 'b']], ['baz', ['c', 'd']]]); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CheckArgumentsValidityPass(); + $pass = new CheckArgumentsValidityPass(); $pass->process($container); $this->assertEquals([null, 1, 'a'], $container->getDefinition('foo')->getArguments()); $this->assertEquals([['bar', ['a', 'b']], ['baz', ['c', 'd']]], $container->getDefinition('foo')->getMethodCalls()); @@ -35,11 +35,11 @@ public function testProcess() public function testException(array $arguments, array $methodCalls) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $definition = $container->register('foo'); $definition->setArguments($arguments); $definition->setMethodCalls($methodCalls); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CheckArgumentsValidityPass(); + $pass = new CheckArgumentsValidityPass(); $pass->process($container); } public function definitionProvider() @@ -48,10 +48,10 @@ public function definitionProvider() } public function testNoException() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $definition = $container->register('foo'); $definition->setArguments([null, 'a' => 'a']); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CheckArgumentsValidityPass(\false); + $pass = new CheckArgumentsValidityPass(false); $pass->process($container); $this->assertCount(1, $definition->getErrors()); } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/CheckCircularReferencesPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/CheckCircularReferencesPassTest.php index 2813ba20c..e6a66e0eb 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/CheckCircularReferencesPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/CheckCircularReferencesPassTest.php @@ -17,21 +17,21 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\Compiler; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; -class CheckCircularReferencesPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class CheckCircularReferencesPassTest extends TestCase { public function testProcess() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\ServiceCircularReferenceException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('a')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b')); - $container->register('b')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('a')); + $container = new ContainerBuilder(); + $container->register('a')->addArgument(new Reference('b')); + $container->register('b')->addArgument(new Reference('a')); $this->process($container); } public function testProcessWithAliases() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\ServiceCircularReferenceException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('a')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b')); + $container = new ContainerBuilder(); + $container->register('a')->addArgument(new Reference('b')); $container->setAlias('b', 'c'); $container->setAlias('c', 'a'); $this->process($container); @@ -39,69 +39,69 @@ public function testProcessWithAliases() public function testProcessWithFactory() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\ServiceCircularReferenceException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('a', 'stdClass')->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b'), 'getInstance']); - $container->register('b', 'stdClass')->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('a'), 'getInstance']); + $container = new ContainerBuilder(); + $container->register('a', 'stdClass')->setFactory([new Reference('b'), 'getInstance']); + $container->register('b', 'stdClass')->setFactory([new Reference('a'), 'getInstance']); $this->process($container); } public function testProcessDetectsIndirectCircularReference() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\ServiceCircularReferenceException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('a')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b')); - $container->register('b')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('c')); - $container->register('c')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('a')); + $container = new ContainerBuilder(); + $container->register('a')->addArgument(new Reference('b')); + $container->register('b')->addArgument(new Reference('c')); + $container->register('c')->addArgument(new Reference('a')); $this->process($container); } public function testProcessDetectsIndirectCircularReferenceWithFactory() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\ServiceCircularReferenceException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('a')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b')); - $container->register('b', 'stdClass')->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('c'), 'getInstance']); - $container->register('c')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('a')); + $container = new ContainerBuilder(); + $container->register('a')->addArgument(new Reference('b')); + $container->register('b', 'stdClass')->setFactory([new Reference('c'), 'getInstance']); + $container->register('c')->addArgument(new Reference('a')); $this->process($container); } public function testDeepCircularReference() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\ServiceCircularReferenceException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('a')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b')); - $container->register('b')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('c')); - $container->register('c')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b')); + $container = new ContainerBuilder(); + $container->register('a')->addArgument(new Reference('b')); + $container->register('b')->addArgument(new Reference('c')); + $container->register('c')->addArgument(new Reference('b')); $this->process($container); } public function testProcessIgnoresMethodCalls() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('a')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b')); - $container->register('b')->addMethodCall('setA', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('a')]); + $container = new ContainerBuilder(); + $container->register('a')->addArgument(new Reference('b')); + $container->register('b')->addMethodCall('setA', [new Reference('a')]); $this->process($container); $this->addToAssertionCount(1); } public function testProcessIgnoresLazyServices() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('a')->setLazy(\true)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b')); - $container->register('b')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('a')); + $container = new ContainerBuilder(); + $container->register('a')->setLazy(true)->addArgument(new Reference('b')); + $container->register('b')->addArgument(new Reference('a')); $this->process($container); // just make sure that a lazily loaded service does not trigger a CircularReferenceException $this->addToAssertionCount(1); } public function testProcessIgnoresIteratorArguments() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('a')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b')); - $container->register('b')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('a')])); + $container = new ContainerBuilder(); + $container->register('a')->addArgument(new Reference('b')); + $container->register('b')->addArgument(new IteratorArgument([new Reference('a')])); $this->process($container); // just make sure that an IteratorArgument does not trigger a CircularReferenceException $this->addToAssertionCount(1); } - protected function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + protected function process(ContainerBuilder $container) { - $compiler = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\Compiler(); + $compiler = new Compiler(); $passConfig = $compiler->getPassConfig(); - $passConfig->setOptimizationPasses([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass(\true), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CheckCircularReferencesPass()]); + $passConfig->setOptimizationPasses([new AnalyzeServiceReferencesPass(true), new CheckCircularReferencesPass()]); $passConfig->setRemovingPasses([]); $compiler->compile($container); } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/CheckDefinitionValidityPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/CheckDefinitionValidityPassTest.php index 859a1ee0f..da9472a20 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/CheckDefinitionValidityPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/CheckDefinitionValidityPassTest.php @@ -13,35 +13,35 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CheckDefinitionValidityPass; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; -class CheckDefinitionValidityPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class CheckDefinitionValidityPassTest extends TestCase { public function testProcessDetectsSyntheticNonPublicDefinitions() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('a')->setSynthetic(\true)->setPublic(\false); + $container = new ContainerBuilder(); + $container->register('a')->setSynthetic(true)->setPublic(false); $this->process($container); } public function testProcessDetectsNonSyntheticNonAbstractDefinitionWithoutClass() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('a')->setSynthetic(\false)->setAbstract(\false); + $container = new ContainerBuilder(); + $container->register('a')->setSynthetic(false)->setAbstract(false); $this->process($container); } public function testProcess() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('a', 'class'); - $container->register('b', 'class')->setSynthetic(\true)->setPublic(\true); - $container->register('c', 'class')->setAbstract(\true); - $container->register('d', 'class')->setSynthetic(\true); + $container->register('b', 'class')->setSynthetic(true)->setPublic(true); + $container->register('c', 'class')->setAbstract(true); + $container->register('d', 'class')->setSynthetic(true); $this->process($container); $this->addToAssertionCount(1); } public function testValidTags() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('a', 'class')->addTag('foo', ['bar' => 'baz']); $container->register('b', 'class')->addTag('foo', ['bar' => null]); $container->register('c', 'class')->addTag('foo', ['bar' => 1]); @@ -52,38 +52,38 @@ public function testValidTags() public function testInvalidTags() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('a', 'class')->addTag('foo', ['bar' => ['baz' => 'baz']]); $this->process($container); } public function testDynamicPublicServiceName() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\EnvParameterException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $env = $container->getParameterBag()->get('env(BAR)'); - $container->register("foo.{$env}", 'class')->setPublic(\true); + $container->register("foo.{$env}", 'class')->setPublic(true); $this->process($container); } public function testDynamicPublicAliasName() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\EnvParameterException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $env = $container->getParameterBag()->get('env(BAR)'); - $container->setAlias("foo.{$env}", 'class')->setPublic(\true); + $container->setAlias("foo.{$env}", 'class')->setPublic(true); $this->process($container); } public function testDynamicPrivateName() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $env = $container->getParameterBag()->get('env(BAR)'); $container->register("foo.{$env}", 'class'); $container->setAlias("bar.{$env}", 'class'); $this->process($container); $this->addToAssertionCount(1); } - protected function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + protected function process(ContainerBuilder $container) { - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CheckDefinitionValidityPass(); + $pass = new CheckDefinitionValidityPass(); $pass->process($container); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php index fe6ca3af9..7f29946fc 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php @@ -16,12 +16,12 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; -class CheckExceptionOnInvalidReferenceBehaviorPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class CheckExceptionOnInvalidReferenceBehaviorPassTest extends TestCase { public function testProcess() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('a', '\\stdClass')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b')); + $container = new ContainerBuilder(); + $container->register('a', '\\stdClass')->addArgument(new Reference('b')); $container->register('b', '\\stdClass'); $this->process($container); $this->addToAssertionCount(1); @@ -29,29 +29,29 @@ public function testProcess() public function testProcessThrowsExceptionOnInvalidReference() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('a', '\\stdClass')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b')); + $container = new ContainerBuilder(); + $container->register('a', '\\stdClass')->addArgument(new Reference('b')); $this->process($container); } public function testProcessThrowsExceptionOnInvalidReferenceFromInlinedDefinition() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(); - $def->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b')); + $container = new ContainerBuilder(); + $def = new Definition(); + $def->addArgument(new Reference('b')); $container->register('a', '\\stdClass')->addArgument($def); $this->process($container); } public function testProcessDefinitionWithBindings() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('b')->setBindings([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\BoundArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('a'))]); + $container = new ContainerBuilder(); + $container->register('b')->setBindings([new BoundArgument(new Reference('a'))]); $this->process($container); $this->addToAssertionCount(1); } - private function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + private function process(ContainerBuilder $container) { - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass(); + $pass = new CheckExceptionOnInvalidReferenceBehaviorPass(); $pass->process($container); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/CheckReferenceValidityPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/CheckReferenceValidityPassTest.php index 98628a8a2..da812cf41 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/CheckReferenceValidityPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/CheckReferenceValidityPassTest.php @@ -14,27 +14,27 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CheckReferenceValidityPass; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; -class CheckReferenceValidityPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class CheckReferenceValidityPassTest extends TestCase { public function testProcessDetectsReferenceToAbstractDefinition() { $this->expectException('RuntimeException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('a')->setAbstract(\true); - $container->register('b')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('a')); + $container = new ContainerBuilder(); + $container->register('a')->setAbstract(true); + $container->register('b')->addArgument(new Reference('a')); $this->process($container); } public function testProcess() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('a')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b')); + $container = new ContainerBuilder(); + $container->register('a')->addArgument(new Reference('b')); $container->register('b'); $this->process($container); $this->addToAssertionCount(1); } - protected function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + protected function process(ContainerBuilder $container) { - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CheckReferenceValidityPass(); + $pass = new CheckReferenceValidityPass(); $pass->process($container); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/DecoratorServicePassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/DecoratorServicePassTest.php index 3255b0510..f95a7e234 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/DecoratorServicePassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/DecoratorServicePassTest.php @@ -14,15 +14,15 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Alias; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\DecoratorServicePass; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; -class DecoratorServicePassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class DecoratorServicePassTest extends TestCase { public function testProcessWithoutAlias() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $fooDefinition = $container->register('foo')->setPublic(\false); - $fooExtendedDefinition = $container->register('foo.extended')->setPublic(\true)->setDecoratedService('foo'); - $barDefinition = $container->register('bar')->setPublic(\true); - $barExtendedDefinition = $container->register('bar.extended')->setPublic(\true)->setDecoratedService('bar', 'bar.yoo'); + $container = new ContainerBuilder(); + $fooDefinition = $container->register('foo')->setPublic(false); + $fooExtendedDefinition = $container->register('foo.extended')->setPublic(true)->setDecoratedService('foo'); + $barDefinition = $container->register('bar')->setPublic(true); + $barExtendedDefinition = $container->register('bar.extended')->setPublic(true)->setDecoratedService('bar', 'bar.yoo'); $this->process($container); $this->assertEquals('foo.extended', $container->getAlias('foo')); $this->assertFalse($container->getAlias('foo')->isPublic()); @@ -37,10 +37,10 @@ public function testProcessWithoutAlias() } public function testProcessWithAlias() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo')->setPublic(\true); - $container->setAlias('foo.alias', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Alias('foo', \false)); - $fooExtendedDefinition = $container->register('foo.extended')->setPublic(\true)->setDecoratedService('foo.alias'); + $container = new ContainerBuilder(); + $container->register('foo')->setPublic(true); + $container->setAlias('foo.alias', new Alias('foo', false)); + $fooExtendedDefinition = $container->register('foo.extended')->setPublic(true)->setDecoratedService('foo.alias'); $this->process($container); $this->assertEquals('foo.extended', $container->getAlias('foo.alias')); $this->assertFalse($container->getAlias('foo.alias')->isPublic()); @@ -50,11 +50,11 @@ public function testProcessWithAlias() } public function testProcessWithPriority() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $fooDefinition = $container->register('foo')->setPublic(\false); - $barDefinition = $container->register('bar')->setPublic(\true)->setDecoratedService('foo'); - $bazDefinition = $container->register('baz')->setPublic(\true)->setDecoratedService('foo', null, 5); - $quxDefinition = $container->register('qux')->setPublic(\true)->setDecoratedService('foo', null, 3); + $container = new ContainerBuilder(); + $fooDefinition = $container->register('foo')->setPublic(false); + $barDefinition = $container->register('bar')->setPublic(true)->setDecoratedService('foo'); + $bazDefinition = $container->register('baz')->setPublic(true)->setDecoratedService('foo', null, 5); + $quxDefinition = $container->register('qux')->setPublic(true)->setDecoratedService('foo', null, 3); $this->process($container); $this->assertEquals('bar', $container->getAlias('foo')); $this->assertFalse($container->getAlias('foo')->isPublic()); @@ -70,7 +70,7 @@ public function testProcessWithPriority() } public function testProcessMovesTagsFromDecoratedDefinitionToDecoratingDefinition() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('foo')->setTags(['bar' => ['attr' => 'baz']]); $container->register('baz')->setTags(['foobar' => ['attr' => 'bar']])->setDecoratedService('foo'); $this->process($container); @@ -82,7 +82,7 @@ public function testProcessMovesTagsFromDecoratedDefinitionToDecoratingDefinitio */ public function testProcessMergesAutowiringTypesInDecoratingDefinitionAndRemoveThemFromDecoratedDefinition() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent')->addAutowiringType('Bar'); $container->register('child')->setDecoratedService('parent')->addAutowiringType('Foo'); $this->process($container); @@ -91,17 +91,17 @@ public function testProcessMergesAutowiringTypesInDecoratingDefinitionAndRemoveT } public function testProcessMovesTagsFromDecoratedDefinitionToDecoratingDefinitionMultipleTimes() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo')->setPublic(\true)->setTags(['bar' => ['attr' => 'baz']]); + $container = new ContainerBuilder(); + $container->register('foo')->setPublic(true)->setTags(['bar' => ['attr' => 'baz']]); $container->register('deco1')->setDecoratedService('foo', null, 50); $container->register('deco2')->setDecoratedService('foo', null, 2); $this->process($container); $this->assertEmpty($container->getDefinition('deco1')->getTags()); $this->assertEquals(['bar' => ['attr' => 'baz']], $container->getDefinition('deco2')->getTags()); } - protected function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + protected function process(ContainerBuilder $container) { - $repeatedPass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\DecoratorServicePass(); + $repeatedPass = new DecoratorServicePass(); $repeatedPass->process($container); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/DefinitionErrorExceptionPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/DefinitionErrorExceptionPassTest.php index 127be7a00..ea6df0ed3 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/DefinitionErrorExceptionPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/DefinitionErrorExceptionPassTest.php @@ -14,26 +14,26 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\DefinitionErrorExceptionPass; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; -class DefinitionErrorExceptionPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class DefinitionErrorExceptionPassTest extends TestCase { public function testThrowsException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); $this->expectExceptionMessage('Things went wrong!'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(); + $container = new ContainerBuilder(); + $def = new Definition(); $def->addError('Things went wrong!'); $def->addError('Now something else!'); $container->register('foo_service_id')->setArguments([$def]); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\DefinitionErrorExceptionPass(); + $pass = new DefinitionErrorExceptionPass(); $pass->process($container); } public function testNoExceptionThrown() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(); + $container = new ContainerBuilder(); + $def = new Definition(); $container->register('foo_service_id')->setArguments([$def]); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\DefinitionErrorExceptionPass(); + $pass = new DefinitionErrorExceptionPass(); $pass->process($container); $this->assertSame($def, $container->getDefinition('foo_service_id')->getArgument(0)); } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ExtensionCompilerPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ExtensionCompilerPassTest.php index 42dc961c4..b6c31e231 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ExtensionCompilerPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ExtensionCompilerPassTest.php @@ -18,21 +18,21 @@ /** * @author Wouter J */ -class ExtensionCompilerPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class ExtensionCompilerPassTest extends TestCase { private $container; private $pass; protected function setUp() { - $this->container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $this->pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ExtensionCompilerPass(); + $this->container = new ContainerBuilder(); + $this->pass = new ExtensionCompilerPass(); } public function testProcess() { - $extension1 = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CompilerPassExtension('extension1'); - $extension2 = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\DummyExtension('extension2'); - $extension3 = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\DummyExtension('extension3'); - $extension4 = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CompilerPassExtension('extension4'); + $extension1 = new CompilerPassExtension('extension1'); + $extension2 = new DummyExtension('extension2'); + $extension3 = new DummyExtension('extension3'); + $extension4 = new CompilerPassExtension('extension4'); $this->container->registerExtension($extension1); $this->container->registerExtension($extension2); $this->container->registerExtension($extension3); @@ -44,7 +44,7 @@ public function testProcess() $this->assertTrue($this->container->hasDefinition('extension4')); } } -class DummyExtension extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Extension\Extension +class DummyExtension extends Extension { private $alias; public function __construct($alias) @@ -55,14 +55,14 @@ public function getAlias() { return $this->alias; } - public function load(array $configs, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container) { } - public function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function process(ContainerBuilder $container) { $container->register($this->alias); } } -class CompilerPassExtension extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\DummyExtension implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface +class CompilerPassExtension extends DummyExtension implements CompilerPassInterface { } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/FactoryReturnTypePassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/FactoryReturnTypePassTest.php index 6c17f5d72..f0f699dba 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/FactoryReturnTypePassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/FactoryReturnTypePassTest.php @@ -17,28 +17,33 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummy; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\factoryFunction; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryParent; +use ReflectionMethod; +use stdClass; +use function defined; +use function method_exists; + /** * @author Guilhem N. * * @group legacy */ -class FactoryReturnTypePassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class FactoryReturnTypePassTest extends TestCase { public function testProcess() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $factory = $container->register('factory'); - $factory->setFactory([\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummy::class, 'createFactory']); + $factory->setFactory([FactoryDummy::class, 'createFactory']); $container->setAlias('alias_factory', 'factory'); $foo = $container->register('foo'); - $foo->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('alias_factory'), 'create']); + $foo->setFactory([new Reference('alias_factory'), 'create']); $bar = $container->register('bar', __CLASS__); - $bar->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('factory'), 'create']); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\FactoryReturnTypePass(); + $bar->setFactory([new Reference('factory'), 'create']); + $pass = new FactoryReturnTypePass(); $pass->process($container); - if (\method_exists(\ReflectionMethod::class, 'getReturnType')) { - $this->assertEquals(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummy::class, $factory->getClass()); - $this->assertEquals(\stdClass::class, $foo->getClass()); + if (method_exists(ReflectionMethod::class, 'getReturnType')) { + $this->assertEquals(FactoryDummy::class, $factory->getClass()); + $this->assertEquals(stdClass::class, $foo->getClass()); } else { $this->assertNull($factory->getClass()); $this->assertNull($foo->getClass()); @@ -48,17 +53,17 @@ public function testProcess() /** * @dataProvider returnTypesProvider */ - public function testReturnTypes($factory, $returnType, $hhvmSupport = \true) + public function testReturnTypes($factory, $returnType, $hhvmSupport = true) { - if (!$hhvmSupport && \defined('HHVM_VERSION')) { + if (!$hhvmSupport && defined('HHVM_VERSION')) { $this->markTestSkipped('Scalar typehints not supported by hhvm.'); } - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $service = $container->register('service'); $service->setFactory($factory); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\FactoryReturnTypePass(); + $pass = new FactoryReturnTypePass(); $pass->process($container); - if (\method_exists(\ReflectionMethod::class, 'getReturnType')) { + if (method_exists(ReflectionMethod::class, 'getReturnType')) { $this->assertEquals($returnType, $service->getClass()); } else { $this->assertNull($service->getClass()); @@ -68,20 +73,20 @@ public function returnTypesProvider() { return [ // must be loaded before the function as they are in the same file - [[\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummy::class, 'createBuiltin'], null, \false], - [[\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummy::class, 'createParent'], \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryParent::class], - [[\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummy::class, 'createSelf'], \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummy::class], - [\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\factoryFunction::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummy::class], + [[FactoryDummy::class, 'createBuiltin'], null, false], + [[FactoryDummy::class, 'createParent'], FactoryParent::class], + [[FactoryDummy::class, 'createSelf'], FactoryDummy::class], + [factoryFunction::class, FactoryDummy::class], ]; } public function testCircularReference() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $factory = $container->register('factory'); - $factory->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('factory2'), 'createSelf']); + $factory->setFactory([new Reference('factory2'), 'createSelf']); $factory2 = $container->register('factory2'); - $factory2->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('factory'), 'create']); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\FactoryReturnTypePass(); + $factory2->setFactory([new Reference('factory'), 'create']); + $pass = new FactoryReturnTypePass(); $pass->process($container); $this->assertNull($factory->getClass()); $this->assertNull($factory2->getClass()); @@ -92,10 +97,10 @@ public function testCircularReference() */ public function testCompile() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $factory = $container->register('factory'); - $factory->setFactory([\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummy::class, 'createFactory']); + $factory->setFactory([FactoryDummy::class, 'createFactory']); $container->compile(); - $this->assertEquals(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummy::class, $container->getDefinition('factory')->getClass()); + $this->assertEquals(FactoryDummy::class, $container->getDefinition('factory')->getClass()); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/InlineServiceDefinitionsPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/InlineServiceDefinitionsPassTest.php index ff8ee059d..a00e1312f 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/InlineServiceDefinitionsPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/InlineServiceDefinitionsPassTest.php @@ -19,13 +19,13 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; -class InlineServiceDefinitionsPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class InlineServiceDefinitionsPassTest extends TestCase { public function testProcess() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('inlinable.service')->setPublic(\false); - $container->register('service')->setArguments([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('inlinable.service')]); + $container = new ContainerBuilder(); + $container->register('inlinable.service')->setPublic(false); + $container->register('service')->setArguments([new Reference('inlinable.service')]); $this->process($container); $arguments = $container->getDefinition('service')->getArguments(); $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Definition', $arguments[0]); @@ -33,21 +33,21 @@ public function testProcess() } public function testProcessDoesNotInlinesWhenAliasedServiceIsShared() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo')->setPublic(\false); + $container = new ContainerBuilder(); + $container->register('foo')->setPublic(false); $container->setAlias('moo', 'foo'); - $container->register('service')->setArguments([$ref = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo')]); + $container->register('service')->setArguments([$ref = new Reference('foo')]); $this->process($container); $arguments = $container->getDefinition('service')->getArguments(); $this->assertSame($ref, $arguments[0]); } public function testProcessDoesInlineNonSharedService() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo')->setShared(\false); - $container->register('bar')->setPublic(\false)->setShared(\false); + $container = new ContainerBuilder(); + $container->register('foo')->setShared(false); + $container->register('bar')->setPublic(false)->setShared(false); $container->setAlias('moo', 'bar'); - $container->register('service')->setArguments([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo'), $ref = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('moo'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar')]); + $container->register('service')->setArguments([new Reference('foo'), $ref = new Reference('moo'), new Reference('bar')]); $this->process($container); $arguments = $container->getDefinition('service')->getArguments(); $this->assertEquals($container->getDefinition('foo'), $arguments[0]); @@ -58,28 +58,28 @@ public function testProcessDoesInlineNonSharedService() } public function testProcessDoesNotInlineMixedServicesLoop() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar'))->setShared(\false); - $container->register('bar')->setPublic(\false)->addMethodCall('setFoo', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo')]); + $container = new ContainerBuilder(); + $container->register('foo')->addArgument(new Reference('bar'))->setShared(false); + $container->register('bar')->setPublic(false)->addMethodCall('setFoo', [new Reference('foo')]); $this->process($container); - $this->assertEquals(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar'), $container->getDefinition('foo')->getArgument(0)); + $this->assertEquals(new Reference('bar'), $container->getDefinition('foo')->getArgument(0)); } public function testProcessThrowsOnNonSharedLoops() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\ServiceCircularReferenceException'); $this->expectExceptionMessage('Circular reference detected for service "bar", path: "bar -> foo -> bar".'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar'))->setShared(\false); - $container->register('bar')->setShared(\false)->addMethodCall('setFoo', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo')]); + $container = new ContainerBuilder(); + $container->register('foo')->addArgument(new Reference('bar'))->setShared(false); + $container->register('bar')->setShared(false)->addMethodCall('setFoo', [new Reference('foo')]); $this->process($container); } public function testProcessNestedNonSharedServices() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar1'))->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar2')); - $container->register('bar1')->setShared(\false)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz')); - $container->register('bar2')->setShared(\false)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz')); - $container->register('baz')->setShared(\false); + $container = new ContainerBuilder(); + $container->register('foo')->addArgument(new Reference('bar1'))->addArgument(new Reference('bar2')); + $container->register('bar1')->setShared(false)->addArgument(new Reference('baz')); + $container->register('bar2')->setShared(false)->addArgument(new Reference('baz')); + $container->register('baz')->setShared(false); $this->process($container); $baz1 = $container->getDefinition('foo')->getArgument(0)->getArgument(0); $baz2 = $container->getDefinition('foo')->getArgument(1)->getArgument(0); @@ -89,9 +89,9 @@ public function testProcessNestedNonSharedServices() } public function testProcessInlinesIfMultipleReferencesButAllFromTheSameDefinition() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $a = $container->register('a')->setPublic(\false); - $b = $container->register('b')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('a'))->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(null, [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('a')])); + $container = new ContainerBuilder(); + $a = $container->register('a')->setPublic(false); + $b = $container->register('b')->addArgument(new Reference('a'))->addArgument(new Definition(null, [new Reference('a')])); $this->process($container); $arguments = $b->getArguments(); $this->assertSame($a, $arguments[0]); @@ -100,20 +100,20 @@ public function testProcessInlinesIfMultipleReferencesButAllFromTheSameDefinitio } public function testProcessInlinesPrivateFactoryReference() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('a')->setPublic(\false); - $b = $container->register('b')->setPublic(\false)->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('a'), 'a']); - $container->register('foo')->setArguments([$ref = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b')]); + $container = new ContainerBuilder(); + $container->register('a')->setPublic(false); + $b = $container->register('b')->setPublic(false)->setFactory([new Reference('a'), 'a']); + $container->register('foo')->setArguments([$ref = new Reference('b')]); $this->process($container); $inlinedArguments = $container->getDefinition('foo')->getArguments(); $this->assertSame($b, $inlinedArguments[0]); } public function testProcessDoesNotInlinePrivateFactoryIfReferencedMultipleTimesWithinTheSameDefinition() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('a'); - $container->register('b')->setPublic(\false)->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('a'), 'a']); - $container->register('foo')->setArguments([$ref1 = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b'), $ref2 = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b')]); + $container->register('b')->setPublic(false)->setFactory([new Reference('a'), 'a']); + $container->register('foo')->setArguments([$ref1 = new Reference('b'), $ref2 = new Reference('b')]); $this->process($container); $args = $container->getDefinition('foo')->getArguments(); $this->assertSame($ref1, $args[0]); @@ -121,46 +121,46 @@ public function testProcessDoesNotInlinePrivateFactoryIfReferencedMultipleTimesW } public function testProcessDoesNotInlineReferenceWhenUsedByInlineFactory() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('a'); - $container->register('b')->setPublic(\false)->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('a'), 'a']); - $inlineFactory = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(); - $inlineFactory->setPublic(\false); - $inlineFactory->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b'), 'b']); - $container->register('foo')->setArguments([$ref = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b'), $inlineFactory]); + $container->register('b')->setPublic(false)->setFactory([new Reference('a'), 'a']); + $inlineFactory = new Definition(); + $inlineFactory->setPublic(false); + $inlineFactory->setFactory([new Reference('b'), 'b']); + $container->register('foo')->setArguments([$ref = new Reference('b'), $inlineFactory]); $this->process($container); $args = $container->getDefinition('foo')->getArguments(); $this->assertSame($ref, $args[0]); } public function testProcessDoesNotInlineWhenServiceIsPrivateButLazy() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo')->setPublic(\false)->setLazy(\true); - $container->register('service')->setArguments([$ref = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo')]); + $container = new ContainerBuilder(); + $container->register('foo')->setPublic(false)->setLazy(true); + $container->register('service')->setArguments([$ref = new Reference('foo')]); $this->process($container); $arguments = $container->getDefinition('service')->getArguments(); $this->assertSame($ref, $arguments[0]); } public function testProcessDoesNotInlineWhenServiceReferencesItself() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo')->setPublic(\false)->addMethodCall('foo', [$ref = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo')]); + $container = new ContainerBuilder(); + $container->register('foo')->setPublic(false)->addMethodCall('foo', [$ref = new Reference('foo')]); $this->process($container); $calls = $container->getDefinition('foo')->getMethodCalls(); $this->assertSame($ref, $calls[0][1][0]); } public function testProcessDoesNotSetLazyArgumentValuesAfterInlining() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('inline')->setShared(\false); - $container->register('service-closure')->setArguments([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('inline'))]); - $container->register('iterator')->setArguments([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('inline')])]); + $container = new ContainerBuilder(); + $container->register('inline')->setShared(false); + $container->register('service-closure')->setArguments([new ServiceClosureArgument(new Reference('inline'))]); + $container->register('iterator')->setArguments([new IteratorArgument([new Reference('inline')])]); $this->process($container); $values = $container->getDefinition('service-closure')->getArgument(0)->getValues(); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference::class, $values[0]); + $this->assertInstanceOf(Reference::class, $values[0]); $this->assertSame('inline', (string) $values[0]); $values = $container->getDefinition('iterator')->getArgument(0)->getValues(); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference::class, $values[0]); + $this->assertInstanceOf(Reference::class, $values[0]); $this->assertSame('inline', (string) $values[0]); } /** @@ -168,18 +168,18 @@ public function testProcessDoesNotSetLazyArgumentValuesAfterInlining() */ public function testGetInlinedServiceIdData() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('inlinable.service')->setPublic(\false); - $container->register('non_inlinable.service')->setPublic(\true); - $container->register('other_service')->setArguments([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('inlinable.service')]); - $inlinePass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\InlineServiceDefinitionsPass(); - $repeatedPass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RepeatedPass([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass(), $inlinePass]); + $container = new ContainerBuilder(); + $container->register('inlinable.service')->setPublic(false); + $container->register('non_inlinable.service')->setPublic(true); + $container->register('other_service')->setArguments([new Reference('inlinable.service')]); + $inlinePass = new InlineServiceDefinitionsPass(); + $repeatedPass = new RepeatedPass([new AnalyzeServiceReferencesPass(), $inlinePass]); $repeatedPass->process($container); $this->assertEquals(['inlinable.service' => ['other_service']], $inlinePass->getInlinedServiceIds()); } - protected function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + protected function process(ContainerBuilder $container) { - $repeatedPass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RepeatedPass([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\InlineServiceDefinitionsPass()]); + $repeatedPass = new RepeatedPass([new AnalyzeServiceReferencesPass(), new InlineServiceDefinitionsPass()]); $repeatedPass->process($container); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/IntegrationTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/IntegrationTest.php index c6d5ad79e..633bca361 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/IntegrationTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/IntegrationTest.php @@ -20,7 +20,7 @@ /** * This class tests the integration of the different compiler passes. */ -class IntegrationTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class IntegrationTest extends TestCase { /** * This tests that dependencies are correctly processed. @@ -33,11 +33,11 @@ class IntegrationTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCas */ public function testProcessRemovesAndInlinesRecursively() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->setResourceTracking(\false); - $a = $container->register('a', '\\stdClass')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('c')); - $container->register('b', '\\stdClass')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('c'))->setPublic(\false); - $c = $container->register('c', '\\stdClass')->setPublic(\false); + $container = new ContainerBuilder(); + $container->setResourceTracking(false); + $a = $container->register('a', '\\stdClass')->addArgument(new Reference('c')); + $container->register('b', '\\stdClass')->addArgument(new Reference('c'))->setPublic(false); + $c = $container->register('c', '\\stdClass')->setPublic(false); $container->compile(); $this->assertTrue($container->hasDefinition('a')); $arguments = $a->getArguments(); @@ -47,11 +47,11 @@ public function testProcessRemovesAndInlinesRecursively() } public function testProcessInlinesReferencesToAliases() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->setResourceTracking(\false); - $a = $container->register('a', '\\stdClass')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b')); - $container->setAlias('b', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Alias('c', \false)); - $c = $container->register('c', '\\stdClass')->setPublic(\false); + $container = new ContainerBuilder(); + $container->setResourceTracking(false); + $a = $container->register('a', '\\stdClass')->addArgument(new Reference('b')); + $container->setAlias('b', new Alias('c', false)); + $c = $container->register('c', '\\stdClass')->setPublic(false); $container->compile(); $this->assertTrue($container->hasDefinition('a')); $arguments = $a->getArguments(); @@ -61,11 +61,11 @@ public function testProcessInlinesReferencesToAliases() } public function testProcessInlinesWhenThereAreMultipleReferencesButFromTheSameDefinition() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->setResourceTracking(\false); - $container->register('a', '\\stdClass')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b'))->addMethodCall('setC', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('c')]); - $container->register('b', '\\stdClass')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('c'))->setPublic(\false); - $container->register('c', '\\stdClass')->setPublic(\false); + $container = new ContainerBuilder(); + $container->setResourceTracking(false); + $container->register('a', '\\stdClass')->addArgument(new Reference('b'))->addMethodCall('setC', [new Reference('c')]); + $container->register('b', '\\stdClass')->addArgument(new Reference('c'))->setPublic(false); + $container->register('c', '\\stdClass')->setPublic(false); $container->compile(); $this->assertTrue($container->hasDefinition('a')); $this->assertFalse($container->hasDefinition('b')); @@ -73,28 +73,28 @@ public function testProcessInlinesWhenThereAreMultipleReferencesButFromTheSameDe } public function testCanDecorateServiceSubscriber() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\ServiceSubscriberStub::class)->addTag('container.service_subscriber')->setPublic(\true); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\DecoratedServiceSubscriber::class)->setDecoratedService(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\ServiceSubscriberStub::class); + $container = new ContainerBuilder(); + $container->register(ServiceSubscriberStub::class)->addTag('container.service_subscriber')->setPublic(true); + $container->register(DecoratedServiceSubscriber::class)->setDecoratedService(ServiceSubscriberStub::class); $container->compile(); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\DecoratedServiceSubscriber::class, $container->get(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\ServiceSubscriberStub::class)); + $this->assertInstanceOf(DecoratedServiceSubscriber::class, $container->get(ServiceSubscriberStub::class)); } /** * @dataProvider getYamlCompileTests */ - public function testYamlContainerCompiles($directory, $actualServiceId, $expectedServiceId, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $mainContainer = null) + public function testYamlContainerCompiles($directory, $actualServiceId, $expectedServiceId, ContainerBuilder $mainContainer = null) { // allow a container to be passed in, which might have autoconfigure settings - $container = $mainContainer ?: new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->setResourceTracking(\false); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(__DIR__ . '/../Fixtures/yaml/integration/' . $directory)); + $container = $mainContainer ?: new ContainerBuilder(); + $container->setResourceTracking(false); + $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Fixtures/yaml/integration/' . $directory)); $loader->load('main.yml'); $container->compile(); $actualService = $container->getDefinition($actualServiceId); // create a fresh ContainerBuilder, to avoid autoconfigure stuff - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->setResourceTracking(\false); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(__DIR__ . '/../Fixtures/yaml/integration/' . $directory)); + $container = new ContainerBuilder(); + $container->setResourceTracking(false); + $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Fixtures/yaml/integration/' . $directory)); $loader->load('expected.yml'); $container->compile(); $expectedService = $container->getDefinition($expectedServiceId); @@ -105,14 +105,14 @@ public function testYamlContainerCompiles($directory, $actualServiceId, $expecte } public function getYamlCompileTests() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->registerForAutoconfiguration(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\IntegrationTestStub::class); + $container = new ContainerBuilder(); + $container->registerForAutoconfiguration(IntegrationTestStub::class); (yield ['autoconfigure_child_not_applied', 'child_service', 'child_service_expected', $container]); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->registerForAutoconfiguration(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\IntegrationTestStub::class); + $container = new ContainerBuilder(); + $container->registerForAutoconfiguration(IntegrationTestStub::class); (yield ['autoconfigure_parent_child', 'child_service', 'child_service_expected', $container]); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->registerForAutoconfiguration(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\IntegrationTestStub::class)->addTag('from_autoconfigure'); + $container = new ContainerBuilder(); + $container->registerForAutoconfiguration(IntegrationTestStub::class)->addTag('from_autoconfigure'); (yield ['autoconfigure_parent_child_tags', 'child_service', 'child_service_expected', $container]); (yield ['child_parent', 'child_service', 'child_service_expected']); (yield ['defaults_child_tags', 'child_service', 'child_service_expected']); @@ -121,7 +121,7 @@ public function getYamlCompileTests() (yield ['instanceof_parent_child', 'child_service', 'child_service_expected']); } } -class ServiceSubscriberStub implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceSubscriberInterface +class ServiceSubscriberStub implements ServiceSubscriberInterface { public static function getSubscribedServices() { @@ -131,7 +131,7 @@ public static function getSubscribedServices() class DecoratedServiceSubscriber { } -class IntegrationTestStub extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\IntegrationTestStubParent +class IntegrationTestStub extends IntegrationTestStubParent { } class IntegrationTestStubParent diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/MergeExtensionConfigurationPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/MergeExtensionConfigurationPassTest.php index 0a48710dc..86ad5896f 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/MergeExtensionConfigurationPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/MergeExtensionConfigurationPassTest.php @@ -19,103 +19,106 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Extension\Extension; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; -class MergeExtensionConfigurationPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use Exception; +use function array_keys; + +class MergeExtensionConfigurationPassTest extends TestCase { public function testExpressionLanguageProviderForwarding() { $tmpProviders = []; $extension = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface')->getMock(); - $extension->expects($this->any())->method('getXsdValidationBasePath')->willReturn(\false); + $extension->expects($this->any())->method('getXsdValidationBasePath')->willReturn(false); $extension->expects($this->any())->method('getNamespace')->willReturn('http://example.org/schema/dic/foo'); $extension->expects($this->any())->method('getAlias')->willReturn('foo'); - $extension->expects($this->once())->method('load')->willReturnCallback(function (array $config, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) use(&$tmpProviders) { + $extension->expects($this->once())->method('load')->willReturnCallback(function (array $config, ContainerBuilder $container) use(&$tmpProviders) { $tmpProviders = $container->getExpressionLanguageProviders(); }); $provider = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\ExpressionLanguage\\ExpressionFunctionProviderInterface')->getMock(); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag()); + $container = new ContainerBuilder(new ParameterBag()); $container->registerExtension($extension); - $container->prependExtensionConfig('foo', ['bar' => \true]); + $container->prependExtensionConfig('foo', ['bar' => true]); $container->addExpressionLanguageProvider($provider); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass(); + $pass = new MergeExtensionConfigurationPass(); $pass->process($container); $this->assertEquals([$provider], $tmpProviders); } public function testExtensionLoadGetAMergeExtensionConfigurationContainerBuilderInstance() { - $extension = $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\FooExtension::class)->setMethods(['load'])->getMock(); - $extension->expects($this->once())->method('load')->with($this->isType('array'), $this->isInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationContainerBuilder::class)); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag()); + $extension = $this->getMockBuilder(FooExtension::class)->setMethods(['load'])->getMock(); + $extension->expects($this->once())->method('load')->with($this->isType('array'), $this->isInstanceOf(MergeExtensionConfigurationContainerBuilder::class)); + $container = new ContainerBuilder(new ParameterBag()); $container->registerExtension($extension); $container->prependExtensionConfig('foo', []); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass(); + $pass = new MergeExtensionConfigurationPass(); $pass->process($container); } public function testExtensionConfigurationIsTrackedByDefault() { - $extension = $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\FooExtension::class)->setMethods(['getConfiguration'])->getMock(); - $extension->expects($this->exactly(2))->method('getConfiguration')->willReturn(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\FooConfiguration()); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag()); + $extension = $this->getMockBuilder(FooExtension::class)->setMethods(['getConfiguration'])->getMock(); + $extension->expects($this->exactly(2))->method('getConfiguration')->willReturn(new FooConfiguration()); + $container = new ContainerBuilder(new ParameterBag()); $container->registerExtension($extension); - $container->prependExtensionConfig('foo', ['bar' => \true]); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass(); + $container->prependExtensionConfig('foo', ['bar' => true]); + $pass = new MergeExtensionConfigurationPass(); $pass->process($container); - $this->assertContainsEquals(new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\FileResource(__FILE__), $container->getResources()); + $this->assertContainsEquals(new FileResource(__FILE__), $container->getResources()); } public function testOverriddenEnvsAreMerged() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->registerExtension(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\FooExtension()); + $container = new ContainerBuilder(); + $container->registerExtension(new FooExtension()); $container->prependExtensionConfig('foo', ['bar' => '%env(FOO)%']); $container->prependExtensionConfig('foo', ['bar' => '%env(BAR)%', 'baz' => '%env(BAZ)%']); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass(); + $pass = new MergeExtensionConfigurationPass(); $pass->process($container); - $this->assertSame(['BAZ', 'FOO'], \array_keys($container->getParameterBag()->getEnvPlaceholders())); + $this->assertSame(['BAZ', 'FOO'], array_keys($container->getParameterBag()->getEnvPlaceholders())); $this->assertSame(['BAZ' => 1, 'FOO' => 0], $container->getEnvCounters()); } public function testProcessedEnvsAreIncompatibleWithResolve() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); $this->expectExceptionMessage('Using a cast in "env(int:FOO)" is incompatible with resolution at compile time in "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\BarExtension". The logic in the extension should be moved to a compiler pass, or an env parameter with no cast should be used instead.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->registerExtension(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\BarExtension()); + $container = new ContainerBuilder(); + $container->registerExtension(new BarExtension()); $container->prependExtensionConfig('bar', []); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass())->process($container); + (new MergeExtensionConfigurationPass())->process($container); } public function testThrowingExtensionsGetMergedBag() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->registerExtension(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\ThrowingExtension()); + $container = new ContainerBuilder(); + $container->registerExtension(new ThrowingExtension()); $container->prependExtensionConfig('throwing', ['bar' => '%env(FOO)%']); try { - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass(); + $pass = new MergeExtensionConfigurationPass(); $pass->process($container); $this->fail('An exception should have been thrown.'); - } catch (\Exception $e) { + } catch (Exception $e) { } - $this->assertSame(['FOO'], \array_keys($container->getParameterBag()->getEnvPlaceholders())); + $this->assertSame(['FOO'], array_keys($container->getParameterBag()->getEnvPlaceholders())); } } -class FooConfiguration implements \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\ConfigurationInterface +class FooConfiguration implements ConfigurationInterface { public function getConfigTreeBuilder() { - $treeBuilder = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Definition\Builder\TreeBuilder(); + $treeBuilder = new TreeBuilder(); $rootNode = $treeBuilder->root('foo'); $rootNode->children()->scalarNode('bar')->end()->scalarNode('baz')->end()->end(); return $treeBuilder; } } -class FooExtension extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Extension\Extension +class FooExtension extends Extension { public function getAlias() { return 'foo'; } - public function getConfiguration(array $config, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function getConfiguration(array $config, ContainerBuilder $container) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\FooConfiguration(); + return new FooConfiguration(); } - public function load(array $configs, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container) { $configuration = $this->getConfiguration($configs, $container); $config = $this->processConfiguration($configuration, $configs); @@ -125,25 +128,25 @@ public function load(array $configs, \_PhpScoper5ea00cc67502b\Symfony\Component\ } } } -class BarExtension extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Extension\Extension +class BarExtension extends Extension { - public function load(array $configs, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container) { - $container->resolveEnvPlaceholders('%env(int:FOO)%', \true); + $container->resolveEnvPlaceholders('%env(int:FOO)%', true); } } -class ThrowingExtension extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Extension\Extension +class ThrowingExtension extends Extension { public function getAlias() { return 'throwing'; } - public function getConfiguration(array $config, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function getConfiguration(array $config, ContainerBuilder $container) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\FooConfiguration(); + return new FooConfiguration(); } - public function load(array $configs, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container) { - throw new \Exception(); + throw new Exception(); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/OptionalServiceClass.php b/vendor/symfony/dependency-injection/Tests/Compiler/OptionalServiceClass.php index 147af1e25..7359d35a1 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/OptionalServiceClass.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/OptionalServiceClass.php @@ -11,6 +11,6 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler; use _PhpScoper5ea00cc67502b\Symfony\Bug\NotExistClass; -class OptionalServiceClass extends \_PhpScoper5ea00cc67502b\Symfony\Bug\NotExistClass +class OptionalServiceClass extends NotExistClass { } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/PassConfigTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/PassConfigTest.php index 103262b1e..57a91e915 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/PassConfigTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/PassConfigTest.php @@ -16,16 +16,16 @@ /** * @author Guilhem N */ -class PassConfigTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class PassConfigTest extends TestCase { public function testPassOrdering() { - $config = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\PassConfig(); + $config = new PassConfig(); $config->setBeforeOptimizationPasses([]); - $pass1 = $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface::class)->getMock(); - $config->addPass($pass1, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 10); - $pass2 = $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface::class)->getMock(); - $config->addPass($pass2, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 30); + $pass1 = $this->getMockBuilder(CompilerPassInterface::class)->getMock(); + $config->addPass($pass1, PassConfig::TYPE_BEFORE_OPTIMIZATION, 10); + $pass2 = $this->getMockBuilder(CompilerPassInterface::class)->getMock(); + $config->addPass($pass2, PassConfig::TYPE_BEFORE_OPTIMIZATION, 30); $passes = $config->getBeforeOptimizationPasses(); $this->assertSame($pass2, $passes[0]); $this->assertSame($pass1, $passes[1]); diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/PriorityTaggedServiceTraitTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/PriorityTaggedServiceTraitTest.php index 339becfb1..da07ef4bc 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/PriorityTaggedServiceTraitTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/PriorityTaggedServiceTraitTest.php @@ -14,27 +14,27 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; -class PriorityTaggedServiceTraitTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class PriorityTaggedServiceTraitTest extends TestCase { public function testThatCacheWarmersAreProcessedInPriorityOrder() { $services = ['my_service1' => ['my_custom_tag' => ['priority' => 100]], 'my_service2' => ['my_custom_tag' => ['priority' => 200]], 'my_service3' => ['my_custom_tag' => ['priority' => -501]], 'my_service4' => ['my_custom_tag' => []], 'my_service5' => ['my_custom_tag' => ['priority' => -1]], 'my_service6' => ['my_custom_tag' => ['priority' => -500]], 'my_service7' => ['my_custom_tag' => ['priority' => -499]], 'my_service8' => ['my_custom_tag' => ['priority' => 1]], 'my_service9' => ['my_custom_tag' => ['priority' => -2]], 'my_service10' => ['my_custom_tag' => ['priority' => -1000]], 'my_service11' => ['my_custom_tag' => ['priority' => -1001]], 'my_service12' => ['my_custom_tag' => ['priority' => -1002]], 'my_service13' => ['my_custom_tag' => ['priority' => -1003]], 'my_service14' => ['my_custom_tag' => ['priority' => -1000]], 'my_service15' => ['my_custom_tag' => ['priority' => 1]], 'my_service16' => ['my_custom_tag' => ['priority' => -1]], 'my_service17' => ['my_custom_tag' => ['priority' => 200]], 'my_service18' => ['my_custom_tag' => ['priority' => 100]], 'my_service19' => ['my_custom_tag' => []]]; - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); foreach ($services as $id => $tags) { $definition = $container->register($id); foreach ($tags as $name => $attributes) { $definition->addTag($name, $attributes); } } - $expected = [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('my_service2'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('my_service17'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('my_service1'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('my_service18'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('my_service8'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('my_service15'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('my_service4'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('my_service19'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('my_service5'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('my_service16'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('my_service9'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('my_service7'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('my_service6'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('my_service3'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('my_service10'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('my_service14'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('my_service11'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('my_service12'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('my_service13')]; - $priorityTaggedServiceTraitImplementation = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\PriorityTaggedServiceTraitImplementation(); + $expected = [new Reference('my_service2'), new Reference('my_service17'), new Reference('my_service1'), new Reference('my_service18'), new Reference('my_service8'), new Reference('my_service15'), new Reference('my_service4'), new Reference('my_service19'), new Reference('my_service5'), new Reference('my_service16'), new Reference('my_service9'), new Reference('my_service7'), new Reference('my_service6'), new Reference('my_service3'), new Reference('my_service10'), new Reference('my_service14'), new Reference('my_service11'), new Reference('my_service12'), new Reference('my_service13')]; + $priorityTaggedServiceTraitImplementation = new PriorityTaggedServiceTraitImplementation(); $this->assertEquals($expected, $priorityTaggedServiceTraitImplementation->test('my_custom_tag', $container)); } } class PriorityTaggedServiceTraitImplementation { use PriorityTaggedServiceTrait; - public function test($tagName, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function test($tagName, ContainerBuilder $container) { return $this->findAndSortTaggedServices($tagName, $container); } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php index 838dae2d4..237570cea 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php @@ -14,36 +14,38 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RegisterEnvVarProcessorsPass; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\EnvVarProcessorInterface; -class RegisterEnvVarProcessorsPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use Closure; + +class RegisterEnvVarProcessorsPassTest extends TestCase { public function testSimpleProcessor() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\SimpleProcessor::class)->addTag('container.env_var_processor'); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RegisterEnvVarProcessorsPass())->process($container); + $container = new ContainerBuilder(); + $container->register('foo', SimpleProcessor::class)->addTag('container.env_var_processor'); + (new RegisterEnvVarProcessorsPass())->process($container); $this->assertTrue($container->has('container.env_var_processors_locator')); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\SimpleProcessor::class, $container->get('container.env_var_processors_locator')->get('foo')); + $this->assertInstanceOf(SimpleProcessor::class, $container->get('container.env_var_processors_locator')->get('foo')); $expected = ['foo' => ['string'], 'base64' => ['string'], 'bool' => ['bool'], 'const' => ['bool', 'int', 'float', 'string', 'array'], 'file' => ['string'], 'float' => ['float'], 'int' => ['int'], 'json' => ['array'], 'resolve' => ['string'], 'string' => ['string']]; $this->assertSame($expected, $container->getParameterBag()->getProvidedTypes()); } public function testNoProcessor() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RegisterEnvVarProcessorsPass())->process($container); + $container = new ContainerBuilder(); + (new RegisterEnvVarProcessorsPass())->process($container); $this->assertFalse($container->has('container.env_var_processors_locator')); } public function testBadProcessor() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('Invalid type "foo" returned by "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\BadProcessor::getProvidedTypes()", expected one of "array", "bool", "float", "int", "string".'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\BadProcessor::class)->addTag('container.env_var_processor'); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RegisterEnvVarProcessorsPass())->process($container); + $container = new ContainerBuilder(); + $container->register('foo', BadProcessor::class)->addTag('container.env_var_processor'); + (new RegisterEnvVarProcessorsPass())->process($container); } } -class SimpleProcessor implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\EnvVarProcessorInterface +class SimpleProcessor implements EnvVarProcessorInterface { - public function getEnv($prefix, $name, \Closure $getEnv) + public function getEnv($prefix, $name, Closure $getEnv) { return $getEnv($name); } @@ -52,7 +54,7 @@ public static function getProvidedTypes() return ['foo' => 'string']; } } -class BadProcessor extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\SimpleProcessor +class BadProcessor extends SimpleProcessor { public static function getProvidedTypes() { diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/RegisterServiceSubscribersPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/RegisterServiceSubscribersPassTest.php index 5193da027..f368ea628 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/RegisterServiceSubscribersPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/RegisterServiceSubscribersPassTest.php @@ -23,59 +23,59 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference; require_once __DIR__ . '/../Fixtures/includes/classes.php'; -class RegisterServiceSubscribersPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class RegisterServiceSubscribersPassTest extends TestCase { public function testInvalidClass() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('Service "foo" must implement interface "Symfony\\Component\\DependencyInjection\\ServiceSubscriberInterface".'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition::class)->addTag('container.service_subscriber'); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RegisterServiceSubscribersPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveServiceSubscribersPass())->process($container); + $container = new ContainerBuilder(); + $container->register('foo', CustomDefinition::class)->addTag('container.service_subscriber'); + (new RegisterServiceSubscribersPass())->process($container); + (new ResolveServiceSubscribersPass())->process($container); } public function testInvalidAttributes() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('The "container.service_subscriber" tag accepts only the "key" and "id" attributes, "bar" given for service "foo".'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::class)->addTag('container.service_subscriber', ['bar' => '123']); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RegisterServiceSubscribersPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveServiceSubscribersPass())->process($container); + $container = new ContainerBuilder(); + $container->register('foo', TestServiceSubscriber::class)->addTag('container.service_subscriber', ['bar' => '123']); + (new RegisterServiceSubscribersPass())->process($container); + (new ResolveServiceSubscribersPass())->process($container); } public function testNoAttributes() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::class)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference(\_PhpScoper5ea00cc67502b\Psr\Container\ContainerInterface::class))->addTag('container.service_subscriber'); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RegisterServiceSubscribersPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveServiceSubscribersPass())->process($container); + $container = new ContainerBuilder(); + $container->register('foo', TestServiceSubscriber::class)->addArgument(new Reference(PsrContainerInterface::class))->addTag('container.service_subscriber'); + (new RegisterServiceSubscribersPass())->process($container); + (new ResolveServiceSubscribersPass())->process($container); $foo = $container->getDefinition('foo'); $locator = $container->getDefinition((string) $foo->getArgument(0)); $this->assertFalse($locator->isPublic()); - $this->assertSame(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator::class, $locator->getClass()); - $expected = [\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::class => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::class)), \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition::class => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE)), 'bar' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::class)), 'baz' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE))]; + $this->assertSame(ServiceLocator::class, $locator->getClass()); + $expected = [TestServiceSubscriber::class => new ServiceClosureArgument(new TypedReference(TestServiceSubscriber::class, TestServiceSubscriber::class, TestServiceSubscriber::class)), CustomDefinition::class => new ServiceClosureArgument(new TypedReference(CustomDefinition::class, CustomDefinition::class, TestServiceSubscriber::class, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)), 'bar' => new ServiceClosureArgument(new TypedReference(CustomDefinition::class, CustomDefinition::class, TestServiceSubscriber::class)), 'baz' => new ServiceClosureArgument(new TypedReference(CustomDefinition::class, CustomDefinition::class, TestServiceSubscriber::class, ContainerInterface::IGNORE_ON_INVALID_REFERENCE))]; $this->assertEquals($expected, $container->getDefinition((string) $locator->getFactory()[0])->getArgument(0)); } public function testWithAttributes() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::class)->setAutowired(\true)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference(\_PhpScoper5ea00cc67502b\Psr\Container\ContainerInterface::class))->addTag('container.service_subscriber', ['key' => 'bar', 'id' => 'bar'])->addTag('container.service_subscriber', ['key' => 'bar', 'id' => 'baz']); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RegisterServiceSubscribersPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveServiceSubscribersPass())->process($container); + $container = new ContainerBuilder(); + $container->register('foo', TestServiceSubscriber::class)->setAutowired(true)->addArgument(new Reference(PsrContainerInterface::class))->addTag('container.service_subscriber', ['key' => 'bar', 'id' => 'bar'])->addTag('container.service_subscriber', ['key' => 'bar', 'id' => 'baz']); + (new RegisterServiceSubscribersPass())->process($container); + (new ResolveServiceSubscribersPass())->process($container); $foo = $container->getDefinition('foo'); $locator = $container->getDefinition((string) $foo->getArgument(0)); $this->assertFalse($locator->isPublic()); - $this->assertSame(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator::class, $locator->getClass()); - $expected = [\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::class => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::class)), \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition::class => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE)), 'bar' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference('bar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::class)), 'baz' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE))]; + $this->assertSame(ServiceLocator::class, $locator->getClass()); + $expected = [TestServiceSubscriber::class => new ServiceClosureArgument(new TypedReference(TestServiceSubscriber::class, TestServiceSubscriber::class, TestServiceSubscriber::class)), CustomDefinition::class => new ServiceClosureArgument(new TypedReference(CustomDefinition::class, CustomDefinition::class, TestServiceSubscriber::class, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)), 'bar' => new ServiceClosureArgument(new TypedReference('bar', CustomDefinition::class, TestServiceSubscriber::class)), 'baz' => new ServiceClosureArgument(new TypedReference(CustomDefinition::class, CustomDefinition::class, TestServiceSubscriber::class, ContainerInterface::IGNORE_ON_INVALID_REFERENCE))]; $this->assertEquals($expected, $container->getDefinition((string) $locator->getFactory()[0])->getArgument(0)); } public function testExtraServiceSubscriber() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('Service key "test" does not exist in the map returned by "Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber::getSubscribedServices()" for service "foo_service".'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo_service', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::class)->setAutowired(\true)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference(\_PhpScoper5ea00cc67502b\Psr\Container\ContainerInterface::class))->addTag('container.service_subscriber', ['key' => 'test', 'id' => \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::class]); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::class); + $container = new ContainerBuilder(); + $container->register('foo_service', TestServiceSubscriber::class)->setAutowired(true)->addArgument(new Reference(PsrContainerInterface::class))->addTag('container.service_subscriber', ['key' => 'test', 'id' => TestServiceSubscriber::class]); + $container->register(TestServiceSubscriber::class, TestServiceSubscriber::class); $container->compile(); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php index d79ad1b11..38084e5d6 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php @@ -18,14 +18,14 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; -class RemoveUnusedDefinitionsPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class RemoveUnusedDefinitionsPassTest extends TestCase { public function testProcess() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo')->setPublic(\false); - $container->register('bar')->setPublic(\false); - $container->register('moo')->setArguments([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar')]); + $container = new ContainerBuilder(); + $container->register('foo')->setPublic(false); + $container->register('bar')->setPublic(false); + $container->register('moo')->setArguments([new Reference('bar')]); $this->process($container); $this->assertFalse($container->hasDefinition('foo')); $this->assertTrue($container->hasDefinition('bar')); @@ -33,28 +33,28 @@ public function testProcess() } public function testProcessRemovesUnusedDefinitionsRecursively() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo')->setPublic(\false); - $container->register('bar')->setArguments([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo')])->setPublic(\false); + $container = new ContainerBuilder(); + $container->register('foo')->setPublic(false); + $container->register('bar')->setArguments([new Reference('foo')])->setPublic(false); $this->process($container); $this->assertFalse($container->hasDefinition('foo')); $this->assertFalse($container->hasDefinition('bar')); } public function testProcessWorksWithInlinedDefinitions() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo')->setPublic(\false); - $container->register('bar')->setArguments([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(null, [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo')])]); + $container = new ContainerBuilder(); + $container->register('foo')->setPublic(false); + $container->register('bar')->setArguments([new Definition(null, [new Reference('foo')])]); $this->process($container); $this->assertTrue($container->hasDefinition('foo')); $this->assertTrue($container->hasDefinition('bar')); } public function testProcessWontRemovePrivateFactory() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', 'stdClass')->setFactory(['stdClass', 'getInstance'])->setPublic(\false); - $container->register('bar', 'stdClass')->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo'), 'getInstance'])->setPublic(\false); - $container->register('foobar')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar')); + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass')->setFactory(['stdClass', 'getInstance'])->setPublic(false); + $container->register('bar', 'stdClass')->setFactory([new Reference('foo'), 'getInstance'])->setPublic(false); + $container->register('foobar')->addArgument(new Reference('bar')); $this->process($container); $this->assertTrue($container->hasDefinition('foo')); $this->assertTrue($container->hasDefinition('bar')); @@ -62,10 +62,10 @@ public function testProcessWontRemovePrivateFactory() } public function testProcessConsiderEnvVariablesAsUsedEvenInPrivateServices() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->setParameter('env(FOOBAR)', 'test'); - $container->register('foo')->setArguments(['%env(FOOBAR)%'])->setPublic(\false); - $resolvePass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass(); + $container->register('foo')->setArguments(['%env(FOOBAR)%'])->setPublic(false); + $resolvePass = new ResolveParameterPlaceHoldersPass(); $resolvePass->process($container); $this->process($container); $this->assertFalse($container->hasDefinition('foo')); @@ -73,9 +73,9 @@ public function testProcessConsiderEnvVariablesAsUsedEvenInPrivateServices() $this->assertArrayHasKey('FOOBAR', $envCounters); $this->assertSame(1, $envCounters['FOOBAR']); } - protected function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + protected function process(ContainerBuilder $container) { - $repeatedPass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RepeatedPass([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass(), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\RemoveUnusedDefinitionsPass()]); + $repeatedPass = new RepeatedPass([new AnalyzeServiceReferencesPass(), new RemoveUnusedDefinitionsPass()]); $repeatedPass->process($container); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php index 8e5d35eeb..b45653443 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php @@ -16,15 +16,15 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; require_once __DIR__ . '/../Fixtures/includes/foo.php'; -class ReplaceAliasByActualDefinitionPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class ReplaceAliasByActualDefinitionPassTest extends TestCase { public function testProcess() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $aDefinition = $container->register('a', '\\stdClass'); - $aDefinition->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b'), 'createA']); - $bDefinition = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('\\stdClass'); - $bDefinition->setPublic(\false); + $aDefinition->setFactory([new Reference('b'), 'createA']); + $bDefinition = new Definition('\\stdClass'); + $bDefinition->setPublic(false); $container->setDefinition('b', $bDefinition); $container->setAlias('a_alias', 'a'); $container->setAlias('b_alias', 'b'); @@ -41,13 +41,13 @@ public function testProcess() public function testProcessWithInvalidAlias() { $this->expectException('InvalidArgumentException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->setAlias('a_alias', 'a'); $this->process($container); } - protected function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + protected function process(ContainerBuilder $container) { - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ReplaceAliasByActualDefinitionPass(); + $pass = new ReplaceAliasByActualDefinitionPass(); $pass->process($container); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveBindingsPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveBindingsPassTest.php index be86ac262..4663ff8e9 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveBindingsPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveBindingsPassTest.php @@ -23,88 +23,88 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\ParentNotExists; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference; require_once __DIR__ . '/../Fixtures/includes/autowiring_classes.php'; -class ResolveBindingsPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class ResolveBindingsPassTest extends TestCase { public function testProcess() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $bindings = [\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass::class => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\BoundArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo'))]; - $definition = $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy::class); + $container = new ContainerBuilder(); + $bindings = [CaseSensitiveClass::class => new BoundArgument(new Reference('foo'))]; + $definition = $container->register(NamedArgumentsDummy::class, NamedArgumentsDummy::class); $definition->setArguments([1 => '123']); $definition->addMethodCall('setSensitiveClass'); $definition->setBindings($bindings); - $container->register('foo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass::class)->setBindings($bindings); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveBindingsPass(); + $container->register('foo', CaseSensitiveClass::class)->setBindings($bindings); + $pass = new ResolveBindingsPass(); $pass->process($container); - $this->assertEquals([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo'), '123'], $definition->getArguments()); - $this->assertEquals([['setSensitiveClass', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo')]]], $definition->getMethodCalls()); + $this->assertEquals([new Reference('foo'), '123'], $definition->getArguments()); + $this->assertEquals([['setSensitiveClass', [new Reference('foo')]]], $definition->getMethodCalls()); } public function testUnusedBinding() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('Unused binding "$quz" in service "Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\NamedArgumentsDummy".'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $definition = $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy::class); + $container = new ContainerBuilder(); + $definition = $container->register(NamedArgumentsDummy::class, NamedArgumentsDummy::class); $definition->setBindings(['$quz' => '123']); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveBindingsPass(); + $pass = new ResolveBindingsPass(); $pass->process($container); } public function testMissingParent() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessageRegExp('/Unused binding "\\$quz" in service [\\s\\S]+/'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $definition = $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\ParentNotExists::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\ParentNotExists::class); + $container = new ContainerBuilder(); + $definition = $container->register(ParentNotExists::class, ParentNotExists::class); $definition->setBindings(['$quz' => '123']); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveBindingsPass(); + $pass = new ResolveBindingsPass(); $pass->process($container); } public function testTypedReferenceSupport() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $bindings = [\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass::class => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\BoundArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo'))]; + $container = new ContainerBuilder(); + $bindings = [CaseSensitiveClass::class => new BoundArgument(new Reference('foo'))]; // Explicit service id - $definition1 = $container->register('def1', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy::class); - $definition1->addArgument($typedRef = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference('bar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass::class)); + $definition1 = $container->register('def1', NamedArgumentsDummy::class); + $definition1->addArgument($typedRef = new TypedReference('bar', CaseSensitiveClass::class)); $definition1->setBindings($bindings); - $definition2 = $container->register('def2', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy::class); - $definition2->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass::class)); + $definition2 = $container->register('def2', NamedArgumentsDummy::class); + $definition2->addArgument(new TypedReference(CaseSensitiveClass::class, CaseSensitiveClass::class)); $definition2->setBindings($bindings); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveBindingsPass(); + $pass = new ResolveBindingsPass(); $pass->process($container); $this->assertEquals([$typedRef], $container->getDefinition('def1')->getArguments()); - $this->assertEquals([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo')], $container->getDefinition('def2')->getArguments()); + $this->assertEquals([new Reference('foo')], $container->getDefinition('def2')->getArguments()); } public function testScalarSetter() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $definition = $container->autowire('foo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\ScalarSetter::class); + $container = new ContainerBuilder(); + $definition = $container->autowire('foo', ScalarSetter::class); $definition->setBindings(['$defaultLocale' => 'fr']); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveBindingsPass())->process($container); + (new AutowireRequiredMethodsPass())->process($container); + (new ResolveBindingsPass())->process($container); $this->assertEquals([['setDefaultLocale', ['fr']]], $definition->getMethodCalls()); } public function testWithNonExistingSetterAndBinding() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); $this->expectExceptionMessage('Invalid service "Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\NamedArgumentsDummy": method "setLogger()" does not exist.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $bindings = ['$c' => (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('logger'))->setFactory('logger')]; - $definition = $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy::class); + $container = new ContainerBuilder(); + $bindings = ['$c' => (new Definition('logger'))->setFactory('logger')]; + $definition = $container->register(NamedArgumentsDummy::class, NamedArgumentsDummy::class); $definition->addMethodCall('setLogger'); $definition->setBindings($bindings); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveBindingsPass(); + $pass = new ResolveBindingsPass(); $pass->process($container); } public function testSyntheticServiceWithBind() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $argument = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\BoundArgument('bar'); - $container->register('foo', 'stdClass')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('synthetic.service')); - $container->register('synthetic.service')->setSynthetic(\true)->setBindings(['$apiKey' => $argument]); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy::class)->setBindings(['$apiKey' => $argument]); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveBindingsPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\DefinitionErrorExceptionPass())->process($container); - $this->assertSame([1 => 'bar'], $container->getDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy::class)->getArguments()); + $container = new ContainerBuilder(); + $argument = new BoundArgument('bar'); + $container->register('foo', 'stdClass')->addArgument(new Reference('synthetic.service')); + $container->register('synthetic.service')->setSynthetic(true)->setBindings(['$apiKey' => $argument]); + $container->register(NamedArgumentsDummy::class, NamedArgumentsDummy::class)->setBindings(['$apiKey' => $argument]); + (new ResolveBindingsPass())->process($container); + (new DefinitionErrorExceptionPass())->process($container); + $this->assertSame([1 => 'bar'], $container->getDefinition(NamedArgumentsDummy::class)->getArguments()); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveChildDefinitionsPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveChildDefinitionsPassTest.php index b1cf53cc2..2da99135f 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveChildDefinitionsPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveChildDefinitionsPassTest.php @@ -15,80 +15,82 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveDefinitionTemplatesPass; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; -class ResolveChildDefinitionsPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use function get_class; + +class ResolveChildDefinitionsPassTest extends TestCase { public function testProcess() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent', 'foo')->setArguments(['moo', 'b'])->setProperty('foo', 'moo'); - $container->setDefinition('child', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'))->replaceArgument(0, 'a')->setProperty('foo', 'bar')->setClass('bar'); + $container->setDefinition('child', new ChildDefinition('parent'))->replaceArgument(0, 'a')->setProperty('foo', 'bar')->setClass('bar'); $this->process($container); $def = $container->getDefinition('child'); - $this->assertNotInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition::class, $def); + $this->assertNotInstanceOf(ChildDefinition::class, $def); $this->assertEquals('bar', $def->getClass()); $this->assertEquals(['a', 'b'], $def->getArguments()); $this->assertEquals(['foo' => 'bar'], $def->getProperties()); } public function testProcessAppendsMethodCallsAlways() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent')->addMethodCall('foo', ['bar']); - $container->setDefinition('child', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'))->addMethodCall('bar', ['foo']); + $container->setDefinition('child', new ChildDefinition('parent'))->addMethodCall('bar', ['foo']); $this->process($container); $def = $container->getDefinition('child'); $this->assertEquals([['foo', ['bar']], ['bar', ['foo']]], $def->getMethodCalls()); } public function testProcessDoesNotCopyAbstract() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('parent')->setAbstract(\true); - $container->setDefinition('child', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent')); + $container = new ContainerBuilder(); + $container->register('parent')->setAbstract(true); + $container->setDefinition('child', new ChildDefinition('parent')); $this->process($container); $def = $container->getDefinition('child'); $this->assertFalse($def->isAbstract()); } public function testProcessDoesNotCopyShared() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('parent')->setShared(\false); - $container->setDefinition('child', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent')); + $container = new ContainerBuilder(); + $container->register('parent')->setShared(false); + $container->setDefinition('child', new ChildDefinition('parent')); $this->process($container); $def = $container->getDefinition('child'); $this->assertTrue($def->isShared()); } public function testProcessDoesNotCopyTags() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent')->addTag('foo'); - $container->setDefinition('child', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent')); + $container->setDefinition('child', new ChildDefinition('parent')); $this->process($container); $def = $container->getDefinition('child'); $this->assertEquals([], $def->getTags()); } public function testProcessDoesNotCopyDecoratedService() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent')->setDecoratedService('foo'); - $container->setDefinition('child', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent')); + $container->setDefinition('child', new ChildDefinition('parent')); $this->process($container); $def = $container->getDefinition('child'); $this->assertNull($def->getDecoratedService()); } public function testProcessDoesNotDropShared() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent'); - $container->setDefinition('child', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'))->setShared(\false); + $container->setDefinition('child', new ChildDefinition('parent'))->setShared(false); $this->process($container); $def = $container->getDefinition('child'); $this->assertFalse($def->isShared()); } public function testProcessHandlesMultipleInheritance() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent', 'foo')->setArguments(['foo', 'bar', 'c']); - $container->setDefinition('child2', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('child1'))->replaceArgument(1, 'b'); - $container->setDefinition('child1', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'))->replaceArgument(0, 'a'); + $container->setDefinition('child2', new ChildDefinition('child1'))->replaceArgument(1, 'b'); + $container->setDefinition('child1', new ChildDefinition('parent'))->replaceArgument(0, 'a'); $this->process($container); $def = $container->getDefinition('child2'); $this->assertEquals(['a', 'b', 'c'], $def->getArguments()); @@ -96,79 +98,79 @@ public function testProcessHandlesMultipleInheritance() } public function testSetLazyOnServiceHasParent() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent', 'stdClass'); - $container->setDefinition('child1', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'))->setLazy(\true); + $container->setDefinition('child1', new ChildDefinition('parent'))->setLazy(true); $this->process($container); $this->assertTrue($container->getDefinition('child1')->isLazy()); } public function testSetLazyOnServiceIsParent() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('parent', 'stdClass')->setLazy(\true); - $container->setDefinition('child1', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent')); + $container = new ContainerBuilder(); + $container->register('parent', 'stdClass')->setLazy(true); + $container->setDefinition('child1', new ChildDefinition('parent')); $this->process($container); $this->assertTrue($container->getDefinition('child1')->isLazy()); } public function testSetAutowiredOnServiceHasParent() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('parent', 'stdClass')->setAutowired(\true); - $container->setDefinition('child1', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'))->setAutowired(\false); + $container = new ContainerBuilder(); + $container->register('parent', 'stdClass')->setAutowired(true); + $container->setDefinition('child1', new ChildDefinition('parent'))->setAutowired(false); $this->process($container); $this->assertFalse($container->getDefinition('child1')->isAutowired()); } public function testSetAutowiredOnServiceIsParent() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('parent', 'stdClass')->setAutowired(\true); - $container->setDefinition('child1', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent')); + $container = new ContainerBuilder(); + $container->register('parent', 'stdClass')->setAutowired(true); + $container->setDefinition('child1', new ChildDefinition('parent')); $this->process($container); $this->assertTrue($container->getDefinition('child1')->isAutowired()); } public function testDeepDefinitionsResolving() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent', 'parentClass'); - $container->register('sibling', 'siblingClass')->setConfigurator(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'), 'foo')->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'), 'foo'])->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'))->setProperty('prop', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'))->addMethodCall('meth', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent')]); + $container->register('sibling', 'siblingClass')->setConfigurator(new ChildDefinition('parent'), 'foo')->setFactory([new ChildDefinition('parent'), 'foo'])->addArgument(new ChildDefinition('parent'))->setProperty('prop', new ChildDefinition('parent'))->addMethodCall('meth', [new ChildDefinition('parent')]); $this->process($container); $configurator = $container->getDefinition('sibling')->getConfigurator(); - $this->assertSame('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Definition', \get_class($configurator)); + $this->assertSame('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Definition', get_class($configurator)); $this->assertSame('parentClass', $configurator->getClass()); $factory = $container->getDefinition('sibling')->getFactory(); - $this->assertSame('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Definition', \get_class($factory[0])); + $this->assertSame('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Definition', get_class($factory[0])); $this->assertSame('parentClass', $factory[0]->getClass()); $argument = $container->getDefinition('sibling')->getArgument(0); - $this->assertSame('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Definition', \get_class($argument)); + $this->assertSame('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Definition', get_class($argument)); $this->assertSame('parentClass', $argument->getClass()); $properties = $container->getDefinition('sibling')->getProperties(); - $this->assertSame('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Definition', \get_class($properties['prop'])); + $this->assertSame('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Definition', get_class($properties['prop'])); $this->assertSame('parentClass', $properties['prop']->getClass()); $methodCalls = $container->getDefinition('sibling')->getMethodCalls(); - $this->assertSame('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Definition', \get_class($methodCalls[0][1][0])); + $this->assertSame('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Definition', get_class($methodCalls[0][1][0])); $this->assertSame('parentClass', $methodCalls[0][1][0]->getClass()); } public function testSetDecoratedServiceOnServiceHasParent() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent', 'stdClass'); - $container->setDefinition('child1', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'))->setDecoratedService('foo', 'foo_inner', 5); + $container->setDefinition('child1', new ChildDefinition('parent'))->setDecoratedService('foo', 'foo_inner', 5); $this->process($container); $this->assertEquals(['foo', 'foo_inner', 5], $container->getDefinition('child1')->getDecoratedService()); } public function testDecoratedServiceCopiesDeprecatedStatusFromParent() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('deprecated_parent')->setDeprecated(\true); - $container->setDefinition('decorated_deprecated_parent', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('deprecated_parent')); + $container = new ContainerBuilder(); + $container->register('deprecated_parent')->setDeprecated(true); + $container->setDefinition('decorated_deprecated_parent', new ChildDefinition('deprecated_parent')); $this->process($container); $this->assertTrue($container->getDefinition('decorated_deprecated_parent')->isDeprecated()); } public function testDecoratedServiceCanOverwriteDeprecatedParentStatus() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('deprecated_parent')->setDeprecated(\true); - $container->setDefinition('decorated_deprecated_parent', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('deprecated_parent'))->setDeprecated(\false); + $container = new ContainerBuilder(); + $container->register('deprecated_parent')->setDeprecated(true); + $container->setDefinition('decorated_deprecated_parent', new ChildDefinition('deprecated_parent'))->setDeprecated(false); $this->process($container); $this->assertFalse($container->getDefinition('decorated_deprecated_parent')->isDeprecated()); } @@ -177,9 +179,9 @@ public function testDecoratedServiceCanOverwriteDeprecatedParentStatus() */ public function testProcessMergeAutowiringTypes() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent')->addAutowiringType('Foo'); - $container->setDefinition('child', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'))->addAutowiringType('Bar'); + $container->setDefinition('child', new ChildDefinition('parent'))->addAutowiringType('Bar'); $this->process($container); $childDef = $container->getDefinition('child'); $this->assertEquals(['Foo', 'Bar'], $childDef->getAutowiringTypes()); @@ -188,28 +190,28 @@ public function testProcessMergeAutowiringTypes() } public function testProcessResolvesAliases() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent', 'ParentClass'); $container->setAlias('parent_alias', 'parent'); - $container->setDefinition('child', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent_alias')); + $container->setDefinition('child', new ChildDefinition('parent_alias')); $this->process($container); $def = $container->getDefinition('child'); $this->assertSame('ParentClass', $def->getClass()); } public function testProcessSetsArguments() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent', 'ParentClass')->setArguments([0]); - $container->setDefinition('child', (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'))->setArguments([1, 'index_0' => 2, 'foo' => 3])); + $container->setDefinition('child', (new ChildDefinition('parent'))->setArguments([1, 'index_0' => 2, 'foo' => 3])); $this->process($container); $def = $container->getDefinition('child'); $this->assertSame([2, 1, 'foo' => 3], $def->getArguments()); } public function testBindings() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent', 'stdClass')->setBindings(['a' => '1', 'b' => '2']); - $container->setDefinition('child', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'))->setBindings(['b' => 'B', 'c' => 'C']); + $container->setDefinition('child', new ChildDefinition('parent'))->setBindings(['b' => 'B', 'c' => 'C']); $this->process($container); $bindings = []; foreach ($container->getDefinition('child')->getBindings() as $k => $v) { @@ -219,9 +221,9 @@ public function testBindings() } public function testSetAutoconfiguredOnServiceIsParent() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('parent', 'stdClass')->setAutoconfigured(\true); - $container->setDefinition('child1', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent')); + $container = new ContainerBuilder(); + $container->register('parent', 'stdClass')->setAutoconfigured(true); + $container->setDefinition('child1', new ChildDefinition('parent')); $this->process($container); $this->assertFalse($container->getDefinition('child1')->isAutoconfigured()); } @@ -230,22 +232,22 @@ public function testSetAutoconfiguredOnServiceIsParent() */ public function testAliasExistsForBackwardsCompatibility() { - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass::class, new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveDefinitionTemplatesPass()); + $this->assertInstanceOf(ResolveChildDefinitionsPass::class, new ResolveDefinitionTemplatesPass()); } - protected function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + protected function process(ContainerBuilder $container) { - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass(); + $pass = new ResolveChildDefinitionsPass(); $pass->process($container); } public function testProcessDetectsChildDefinitionIndirectCircularReference() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\ServiceCircularReferenceException'); $this->expectExceptionMessageRegExp('/^Circular reference detected for service "c", path: "c -> b -> a -> c"./'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('a'); - $container->setDefinition('b', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('a')); - $container->setDefinition('c', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('b')); - $container->setDefinition('a', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('c')); + $container->setDefinition('b', new ChildDefinition('a')); + $container->setDefinition('c', new ChildDefinition('b')); + $container->setDefinition('a', new ChildDefinition('c')); $this->process($container); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveClassPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveClassPassTest.php index 9105bfd54..fee262207 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveClassPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveClassPassTest.php @@ -15,54 +15,56 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass; -class ResolveClassPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use stdClass; + +class ResolveClassPassTest extends TestCase { /** * @dataProvider provideValidClassId */ public function testResolveClassFromId($serviceId) { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $def = $container->register($serviceId); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); + (new ResolveClassPass())->process($container); $this->assertSame($serviceId, $def->getClass()); } public function provideValidClassId() { (yield ['_PhpScoper5ea00cc67502b\\Acme\\UnknownClass']); - (yield [\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass::class]); + (yield [CaseSensitiveClass::class]); } /** * @dataProvider provideInvalidClassId */ public function testWontResolveClassFromId($serviceId) { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $def = $container->register($serviceId); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); + (new ResolveClassPass())->process($container); $this->assertNull($def->getClass()); } public function provideInvalidClassId() { - (yield [\stdClass::class]); + (yield [stdClass::class]); (yield ['bar']); (yield ['\\DateTime']); } public function testNonFqcnChildDefinition() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $parent = $container->register('_PhpScoper5ea00cc67502b\\App\\Foo', null); - $child = $container->setDefinition('App\\Foo.child', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('_PhpScoper5ea00cc67502b\\App\\Foo')); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); + $child = $container->setDefinition('App\\Foo.child', new ChildDefinition('_PhpScoper5ea00cc67502b\\App\\Foo')); + (new ResolveClassPass())->process($container); $this->assertSame('_PhpScoper5ea00cc67502b\\App\\Foo', $parent->getClass()); $this->assertNull($child->getClass()); } public function testClassFoundChildDefinition() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $parent = $container->register('_PhpScoper5ea00cc67502b\\App\\Foo', null); - $child = $container->setDefinition(self::class, new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('_PhpScoper5ea00cc67502b\\App\\Foo')); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); + $child = $container->setDefinition(self::class, new ChildDefinition('_PhpScoper5ea00cc67502b\\App\\Foo')); + (new ResolveClassPass())->process($container); $this->assertSame('_PhpScoper5ea00cc67502b\\App\\Foo', $parent->getClass()); $this->assertSame(self::class, $child->getClass()); } @@ -70,9 +72,9 @@ public function testAmbiguousChildDefinition() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('Service definition "App\\Foo\\Child" has a parent but no class, and its name looks like a FQCN. Either the class is missing or you want to inherit it from the parent service. To resolve this ambiguity, please rename this service to a non-FQCN (e.g. using dots), or create the missing class.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('_PhpScoper5ea00cc67502b\\App\\Foo', null); - $container->setDefinition('_PhpScoper5ea00cc67502b\\App\\Foo\\Child', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('_PhpScoper5ea00cc67502b\\App\\Foo')); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveClassPass())->process($container); + $container->setDefinition('_PhpScoper5ea00cc67502b\\App\\Foo\\Child', new ChildDefinition('_PhpScoper5ea00cc67502b\\App\\Foo')); + (new ResolveClassPass())->process($container); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php index f97e8b110..2f1824984 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php @@ -17,80 +17,80 @@ /** * @group legacy */ -class ResolveDefinitionTemplatesPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class ResolveDefinitionTemplatesPassTest extends TestCase { public function testProcess() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent', 'foo')->setArguments(['moo', 'b'])->setProperty('foo', 'moo'); - $container->setDefinition('child', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'))->replaceArgument(0, 'a')->setProperty('foo', 'bar')->setClass('bar'); + $container->setDefinition('child', new ChildDefinition('parent'))->replaceArgument(0, 'a')->setProperty('foo', 'bar')->setClass('bar'); $this->process($container); $def = $container->getDefinition('child'); - $this->assertNotInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition::class, $def); + $this->assertNotInstanceOf(ChildDefinition::class, $def); $this->assertEquals('bar', $def->getClass()); $this->assertEquals(['a', 'b'], $def->getArguments()); $this->assertEquals(['foo' => 'bar'], $def->getProperties()); } public function testProcessAppendsMethodCallsAlways() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent')->addMethodCall('foo', ['bar']); - $container->setDefinition('child', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'))->addMethodCall('bar', ['foo']); + $container->setDefinition('child', new ChildDefinition('parent'))->addMethodCall('bar', ['foo']); $this->process($container); $def = $container->getDefinition('child'); $this->assertEquals([['foo', ['bar']], ['bar', ['foo']]], $def->getMethodCalls()); } public function testProcessDoesNotCopyAbstract() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('parent')->setAbstract(\true); - $container->setDefinition('child', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent')); + $container = new ContainerBuilder(); + $container->register('parent')->setAbstract(true); + $container->setDefinition('child', new ChildDefinition('parent')); $this->process($container); $def = $container->getDefinition('child'); $this->assertFalse($def->isAbstract()); } public function testProcessDoesNotCopyShared() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('parent')->setShared(\false); - $container->setDefinition('child', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent')); + $container = new ContainerBuilder(); + $container->register('parent')->setShared(false); + $container->setDefinition('child', new ChildDefinition('parent')); $this->process($container); $def = $container->getDefinition('child'); $this->assertTrue($def->isShared()); } public function testProcessDoesNotCopyTags() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent')->addTag('foo'); - $container->setDefinition('child', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent')); + $container->setDefinition('child', new ChildDefinition('parent')); $this->process($container); $def = $container->getDefinition('child'); $this->assertEquals([], $def->getTags()); } public function testProcessDoesNotCopyDecoratedService() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent')->setDecoratedService('foo'); - $container->setDefinition('child', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent')); + $container->setDefinition('child', new ChildDefinition('parent')); $this->process($container); $def = $container->getDefinition('child'); $this->assertNull($def->getDecoratedService()); } public function testProcessDoesNotDropShared() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent'); - $container->setDefinition('child', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'))->setShared(\false); + $container->setDefinition('child', new ChildDefinition('parent'))->setShared(false); $this->process($container); $def = $container->getDefinition('child'); $this->assertFalse($def->isShared()); } public function testProcessHandlesMultipleInheritance() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent', 'foo')->setArguments(['foo', 'bar', 'c']); - $container->setDefinition('child2', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('child1'))->replaceArgument(1, 'b'); - $container->setDefinition('child1', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'))->replaceArgument(0, 'a'); + $container->setDefinition('child2', new ChildDefinition('child1'))->replaceArgument(1, 'b'); + $container->setDefinition('child1', new ChildDefinition('parent'))->replaceArgument(0, 'a'); $this->process($container); $def = $container->getDefinition('child2'); $this->assertEquals(['a', 'b', 'c'], $def->getArguments()); @@ -98,41 +98,41 @@ public function testProcessHandlesMultipleInheritance() } public function testSetLazyOnServiceHasParent() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent', 'stdClass'); - $container->setDefinition('child1', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'))->setLazy(\true); + $container->setDefinition('child1', new ChildDefinition('parent'))->setLazy(true); $this->process($container); $this->assertTrue($container->getDefinition('child1')->isLazy()); } public function testSetLazyOnServiceIsParent() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('parent', 'stdClass')->setLazy(\true); - $container->setDefinition('child1', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent')); + $container = new ContainerBuilder(); + $container->register('parent', 'stdClass')->setLazy(true); + $container->setDefinition('child1', new ChildDefinition('parent')); $this->process($container); $this->assertTrue($container->getDefinition('child1')->isLazy()); } public function testSetAutowiredOnServiceHasParent() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('parent', 'stdClass')->setAutowired(\true); - $container->setDefinition('child1', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'))->setAutowired(\false); + $container = new ContainerBuilder(); + $container->register('parent', 'stdClass')->setAutowired(true); + $container->setDefinition('child1', new ChildDefinition('parent'))->setAutowired(false); $this->process($container); $this->assertFalse($container->getDefinition('child1')->isAutowired()); } public function testSetAutowiredOnServiceIsParent() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('parent', 'stdClass')->setAutowired(\true); - $container->setDefinition('child1', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent')); + $container = new ContainerBuilder(); + $container->register('parent', 'stdClass')->setAutowired(true); + $container->setDefinition('child1', new ChildDefinition('parent')); $this->process($container); $this->assertTrue($container->getDefinition('child1')->isAutowired()); } public function testDeepDefinitionsResolving() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent', 'parentClass'); - $container->register('sibling', 'siblingClass')->setConfigurator(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'), 'foo')->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'), 'foo'])->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'))->setProperty('prop', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'))->addMethodCall('meth', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent')]); + $container->register('sibling', 'siblingClass')->setConfigurator(new ChildDefinition('parent'), 'foo')->setFactory([new ChildDefinition('parent'), 'foo'])->addArgument(new ChildDefinition('parent'))->setProperty('prop', new ChildDefinition('parent'))->addMethodCall('meth', [new ChildDefinition('parent')]); $this->process($container); $configurator = $container->getDefinition('sibling')->getConfigurator(); $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Definition', $configurator); @@ -152,25 +152,25 @@ public function testDeepDefinitionsResolving() } public function testSetDecoratedServiceOnServiceHasParent() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent', 'stdClass'); - $container->setDefinition('child1', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'))->setDecoratedService('foo', 'foo_inner', 5); + $container->setDefinition('child1', new ChildDefinition('parent'))->setDecoratedService('foo', 'foo_inner', 5); $this->process($container); $this->assertEquals(['foo', 'foo_inner', 5], $container->getDefinition('child1')->getDecoratedService()); } public function testDecoratedServiceCopiesDeprecatedStatusFromParent() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('deprecated_parent')->setDeprecated(\true); - $container->setDefinition('decorated_deprecated_parent', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('deprecated_parent')); + $container = new ContainerBuilder(); + $container->register('deprecated_parent')->setDeprecated(true); + $container->setDefinition('decorated_deprecated_parent', new ChildDefinition('deprecated_parent')); $this->process($container); $this->assertTrue($container->getDefinition('decorated_deprecated_parent')->isDeprecated()); } public function testDecoratedServiceCanOverwriteDeprecatedParentStatus() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('deprecated_parent')->setDeprecated(\true); - $container->setDefinition('decorated_deprecated_parent', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('deprecated_parent'))->setDeprecated(\false); + $container = new ContainerBuilder(); + $container->register('deprecated_parent')->setDeprecated(true); + $container->setDefinition('decorated_deprecated_parent', new ChildDefinition('deprecated_parent'))->setDeprecated(false); $this->process($container); $this->assertFalse($container->getDefinition('decorated_deprecated_parent')->isDeprecated()); } @@ -179,9 +179,9 @@ public function testDecoratedServiceCanOverwriteDeprecatedParentStatus() */ public function testProcessMergeAutowiringTypes() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent')->addAutowiringType('Foo'); - $container->setDefinition('child', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'))->addAutowiringType('Bar'); + $container->setDefinition('child', new ChildDefinition('parent'))->addAutowiringType('Bar'); $this->process($container); $childDef = $container->getDefinition('child'); $this->assertEquals(['Foo', 'Bar'], $childDef->getAutowiringTypes()); @@ -190,34 +190,34 @@ public function testProcessMergeAutowiringTypes() } public function testProcessResolvesAliases() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent', 'ParentClass'); $container->setAlias('parent_alias', 'parent'); - $container->setDefinition('child', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent_alias')); + $container->setDefinition('child', new ChildDefinition('parent_alias')); $this->process($container); $def = $container->getDefinition('child'); $this->assertSame('ParentClass', $def->getClass()); } public function testProcessSetsArguments() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('parent', 'ParentClass')->setArguments([0]); - $container->setDefinition('child', (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'))->setArguments([1, 'index_0' => 2, 'foo' => 3])); + $container->setDefinition('child', (new ChildDefinition('parent'))->setArguments([1, 'index_0' => 2, 'foo' => 3])); $this->process($container); $def = $container->getDefinition('child'); $this->assertSame([2, 1, 'foo' => 3], $def->getArguments()); } public function testSetAutoconfiguredOnServiceIsParent() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('parent', 'stdClass')->setAutoconfigured(\true); - $container->setDefinition('child1', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent')); + $container = new ContainerBuilder(); + $container->register('parent', 'stdClass')->setAutoconfigured(true); + $container->setDefinition('child1', new ChildDefinition('parent')); $this->process($container); $this->assertFalse($container->getDefinition('child1')->isAutoconfigured()); } - protected function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + protected function process(ContainerBuilder $container) { - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveDefinitionTemplatesPass(); + $pass = new ResolveDefinitionTemplatesPass(); $pass->process($container); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveFactoryClassPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveFactoryClassPassTest.php index c6f211f9f..18caaa942 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveFactoryClassPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveFactoryClassPassTest.php @@ -15,40 +15,40 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; -class ResolveFactoryClassPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class ResolveFactoryClassPassTest extends TestCase { public function testProcess() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $factory = $container->register('factory', '_PhpScoper5ea00cc67502b\\Foo\\Bar'); $factory->setFactory([null, 'create']); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveFactoryClassPass(); + $pass = new ResolveFactoryClassPass(); $pass->process($container); $this->assertSame(['_PhpScoper5ea00cc67502b\\Foo\\Bar', 'create'], $factory->getFactory()); } public function testInlinedDefinitionFactoryIsProcessed() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $factory = $container->register('factory'); - $factory->setFactory([(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('_PhpScoper5ea00cc67502b\\Baz\\Qux'))->setFactory([null, 'getInstance']), 'create']); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveFactoryClassPass(); + $factory->setFactory([(new Definition('_PhpScoper5ea00cc67502b\\Baz\\Qux'))->setFactory([null, 'getInstance']), 'create']); + $pass = new ResolveFactoryClassPass(); $pass->process($container); $this->assertSame(['_PhpScoper5ea00cc67502b\\Baz\\Qux', 'getInstance'], $factory->getFactory()[0]->getFactory()); } public function provideFulfilledFactories() { - return [[['_PhpScoper5ea00cc67502b\\Foo\\Bar', 'create']], [[new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo'), 'create']], [[new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('Baz'), 'create']]]; + return [[['_PhpScoper5ea00cc67502b\\Foo\\Bar', 'create']], [[new Reference('foo'), 'create']], [[new Definition('Baz'), 'create']]]; } /** * @dataProvider provideFulfilledFactories */ public function testIgnoresFulfilledFactories($factory) { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $definition = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(); + $container = new ContainerBuilder(); + $definition = new Definition(); $definition->setFactory($factory); $container->setDefinition('factory', $definition); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveFactoryClassPass(); + $pass = new ResolveFactoryClassPass(); $pass->process($container); $this->assertSame($factory, $container->getDefinition('factory')->getFactory()); } @@ -56,10 +56,10 @@ public function testNotAnyClassThrowsException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); $this->expectExceptionMessage('The "factory" service is defined to be created by a factory, but is missing the factory class. Did you forget to define the factory or service class?'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $factory = $container->register('factory'); $factory->setFactory([null, 'create']); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveFactoryClassPass(); + $pass = new ResolveFactoryClassPass(); $pass->process($container); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveHotPathPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveHotPathPassTest.php index 5571728ca..22dfa46f3 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveHotPathPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveHotPathPassTest.php @@ -16,19 +16,19 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; -class ResolveHotPathPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class ResolveHotPathPassTest extends TestCase { public function testProcess() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo')->addTag('container.hot_path')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('lazy')]))->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('service_container'))->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar')]))->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder::IGNORE_ON_UNINITIALIZED_REFERENCE))->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('missing')); + $container = new ContainerBuilder(); + $container->register('foo')->addTag('container.hot_path')->addArgument(new IteratorArgument([new Reference('lazy')]))->addArgument(new Reference('service_container'))->addArgument(new Definition('', [new Reference('bar')]))->addArgument(new Reference('baz', ContainerBuilder::IGNORE_ON_UNINITIALIZED_REFERENCE))->addArgument(new Reference('missing')); $container->register('lazy'); - $container->register('bar')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('buz'))->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('deprec_ref_notag')); - $container->register('baz')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('lazy'))->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('lazy')); + $container->register('bar')->addArgument(new Reference('buz'))->addArgument(new Reference('deprec_ref_notag')); + $container->register('baz')->addArgument(new Reference('lazy'))->addArgument(new Reference('lazy')); $container->register('buz'); $container->register('deprec_with_tag')->setDeprecated()->addTag('container.hot_path'); $container->register('deprec_ref_notag')->setDeprecated(); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveHotPathPass())->process($container); + (new ResolveHotPathPass())->process($container); $this->assertFalse($container->getDefinition('lazy')->hasTag('container.hot_path')); $this->assertTrue($container->getDefinition('bar')->hasTag('container.hot_path')); $this->assertTrue($container->getDefinition('buz')->hasTag('container.hot_path')); diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php index 20e0631d7..3134aa791 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php @@ -16,18 +16,20 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveInstanceofConditionalsPass; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; -class ResolveInstanceofConditionalsPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use function array_keys; + +class ResolveInstanceofConditionalsPassTest extends TestCase { public function testProcess() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $def = $container->register('foo', self::class)->addTag('tag')->setAutowired(\true)->setChanges([]); - $def->setInstanceofConditionals([parent::class => (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition(''))->setProperty('foo', 'bar')->addTag('baz', ['attr' => 123])]); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveInstanceofConditionalsPass())->process($container); + $container = new ContainerBuilder(); + $def = $container->register('foo', self::class)->addTag('tag')->setAutowired(true)->setChanges([]); + $def->setInstanceofConditionals([parent::class => (new ChildDefinition(''))->setProperty('foo', 'bar')->addTag('baz', ['attr' => 123])]); + (new ResolveInstanceofConditionalsPass())->process($container); $parent = 'instanceof.' . parent::class . '.0.foo'; $def = $container->getDefinition('foo'); $this->assertEmpty($def->getInstanceofConditionals()); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition::class, $def); + $this->assertInstanceOf(ChildDefinition::class, $def); $this->assertTrue($def->isAutowired()); $this->assertSame($parent, $def->getParent()); $this->assertSame(['tag' => [[]], 'baz' => [['attr' => 123]]], $def->getTags()); @@ -37,33 +39,33 @@ public function testProcess() } public function testProcessInheritance() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $def = $container->register('parent', parent::class)->addMethodCall('foo', ['foo']); - $def->setInstanceofConditionals([parent::class => (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition(''))->addMethodCall('foo', ['bar'])]); - $def = (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent'))->setClass(self::class); + $def->setInstanceofConditionals([parent::class => (new ChildDefinition(''))->addMethodCall('foo', ['bar'])]); + $def = (new ChildDefinition('parent'))->setClass(self::class); $container->setDefinition('child', $def); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveInstanceofConditionalsPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass())->process($container); + (new ResolveInstanceofConditionalsPass())->process($container); + (new ResolveChildDefinitionsPass())->process($container); $expected = [['foo', ['bar']], ['foo', ['foo']]]; $this->assertSame($expected, $container->getDefinition('parent')->getMethodCalls()); $this->assertSame($expected, $container->getDefinition('child')->getMethodCalls()); } public function testProcessDoesReplaceShared() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $def = $container->register('foo', 'stdClass'); - $def->setInstanceofConditionals(['stdClass' => (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition(''))->setShared(\false)]); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveInstanceofConditionalsPass())->process($container); + $def->setInstanceofConditionals(['stdClass' => (new ChildDefinition(''))->setShared(false)]); + (new ResolveInstanceofConditionalsPass())->process($container); $def = $container->getDefinition('foo'); $this->assertFalse($def->isShared()); } public function testProcessHandlesMultipleInheritance() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $def = $container->register('foo', self::class)->setShared(\true); - $def->setInstanceofConditionals([parent::class => (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition(''))->setLazy(\true)->setShared(\false), self::class => (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition(''))->setAutowired(\true)]); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveInstanceofConditionalsPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass())->process($container); + $container = new ContainerBuilder(); + $def = $container->register('foo', self::class)->setShared(true); + $def->setInstanceofConditionals([parent::class => (new ChildDefinition(''))->setLazy(true)->setShared(false), self::class => (new ChildDefinition(''))->setAutowired(true)]); + (new ResolveInstanceofConditionalsPass())->process($container); + (new ResolveChildDefinitionsPass())->process($container); $def = $container->getDefinition('foo'); $this->assertTrue($def->isAutowired()); $this->assertTrue($def->isLazy()); @@ -71,13 +73,13 @@ public function testProcessHandlesMultipleInheritance() } public function testProcessUsesAutoconfiguredInstanceof() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $def = $container->register('normal_service', self::class); - $def->setInstanceofConditionals([parent::class => (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition(''))->addTag('local_instanceof_tag')->setFactory('locally_set_factory')]); - $def->setAutoconfigured(\true); - $container->registerForAutoconfiguration(parent::class)->addTag('autoconfigured_tag')->setAutowired(\true)->setFactory('autoconfigured_factory'); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveInstanceofConditionalsPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass())->process($container); + $def->setInstanceofConditionals([parent::class => (new ChildDefinition(''))->addTag('local_instanceof_tag')->setFactory('locally_set_factory')]); + $def->setAutoconfigured(true); + $container->registerForAutoconfiguration(parent::class)->addTag('autoconfigured_tag')->setAutowired(true)->setFactory('autoconfigured_factory'); + (new ResolveInstanceofConditionalsPass())->process($container); + (new ResolveChildDefinitionsPass())->process($container); $def = $container->getDefinition('normal_service'); // autowired thanks to the autoconfigured instanceof $this->assertTrue($def->isAutowired()); @@ -88,25 +90,25 @@ public function testProcessUsesAutoconfiguredInstanceof() } public function testAutoconfigureInstanceofDoesNotDuplicateTags() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $def = $container->register('normal_service', self::class); $def->addTag('duplicated_tag')->addTag('duplicated_tag', ['and_attributes' => 1]); - $def->setInstanceofConditionals([parent::class => (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition(''))->addTag('duplicated_tag')]); - $def->setAutoconfigured(\true); + $def->setInstanceofConditionals([parent::class => (new ChildDefinition(''))->addTag('duplicated_tag')]); + $def->setAutoconfigured(true); $container->registerForAutoconfiguration(parent::class)->addTag('duplicated_tag', ['and_attributes' => 1]); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveInstanceofConditionalsPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass())->process($container); + (new ResolveInstanceofConditionalsPass())->process($container); + (new ResolveChildDefinitionsPass())->process($container); $def = $container->getDefinition('normal_service'); $this->assertSame(['duplicated_tag' => [[], ['and_attributes' => 1]]], $def->getTags()); } public function testProcessDoesNotUseAutoconfiguredInstanceofIfNotEnabled() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $def = $container->register('normal_service', self::class); - $def->setInstanceofConditionals([parent::class => (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition(''))->addTag('foo_tag')]); - $container->registerForAutoconfiguration(parent::class)->setAutowired(\true); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveInstanceofConditionalsPass())->process($container); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass())->process($container); + $def->setInstanceofConditionals([parent::class => (new ChildDefinition(''))->addTag('foo_tag')]); + $container->registerForAutoconfiguration(parent::class)->setAutowired(true); + (new ResolveInstanceofConditionalsPass())->process($container); + (new ResolveChildDefinitionsPass())->process($container); $def = $container->getDefinition('normal_service'); $this->assertFalse($def->isAutowired()); } @@ -114,40 +116,40 @@ public function testBadInterfaceThrowsException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); $this->expectExceptionMessage('"App\\FakeInterface" is set as an "instanceof" conditional, but it does not exist.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $def = $container->register('normal_service', self::class); - $def->setInstanceofConditionals(['_PhpScoper5ea00cc67502b\\App\\FakeInterface' => (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition(''))->addTag('foo_tag')]); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveInstanceofConditionalsPass())->process($container); + $def->setInstanceofConditionals(['_PhpScoper5ea00cc67502b\\App\\FakeInterface' => (new ChildDefinition(''))->addTag('foo_tag')]); + (new ResolveInstanceofConditionalsPass())->process($container); } public function testBadInterfaceForAutomaticInstanceofIsOk() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('normal_service', self::class)->setAutoconfigured(\true); - $container->registerForAutoconfiguration('_PhpScoper5ea00cc67502b\\App\\FakeInterface')->setAutowired(\true); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveInstanceofConditionalsPass())->process($container); + $container = new ContainerBuilder(); + $container->register('normal_service', self::class)->setAutoconfigured(true); + $container->registerForAutoconfiguration('_PhpScoper5ea00cc67502b\\App\\FakeInterface')->setAutowired(true); + (new ResolveInstanceofConditionalsPass())->process($container); $this->assertTrue($container->hasDefinition('normal_service')); } public function testProcessThrowsExceptionForAutoconfiguredCalls() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessageRegExp('/Autoconfigured instanceof for type "PHPUnit[\\\\_]Framework[\\\\_]TestCase" defines method calls but these are not supported and should be removed\\./'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->registerForAutoconfiguration(parent::class)->addMethodCall('setFoo'); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveInstanceofConditionalsPass())->process($container); + (new ResolveInstanceofConditionalsPass())->process($container); } public function testProcessThrowsExceptionForArguments() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessageRegExp('/Autoconfigured instanceof for type "PHPUnit[\\\\_]Framework[\\\\_]TestCase" defines arguments but these are not supported and should be removed\\./'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->registerForAutoconfiguration(parent::class)->addArgument('bar'); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveInstanceofConditionalsPass())->process($container); + (new ResolveInstanceofConditionalsPass())->process($container); } public function testMergeReset() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('bar', self::class)->addArgument('a')->addMethodCall('setB')->setDecoratedService('foo')->addTag('t')->setInstanceofConditionals([parent::class => (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition(''))->addTag('bar')]); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveInstanceofConditionalsPass())->process($container); + $container = new ContainerBuilder(); + $container->register('bar', self::class)->addArgument('a')->addMethodCall('setB')->setDecoratedService('foo')->addTag('t')->setInstanceofConditionals([parent::class => (new ChildDefinition(''))->addTag('bar')]); + (new ResolveInstanceofConditionalsPass())->process($container); $abstract = $container->getDefinition('abstract.instanceof.bar'); $this->assertEmpty($abstract->getArguments()); $this->assertEmpty($abstract->getMethodCalls()); @@ -157,13 +159,13 @@ public function testMergeReset() } public function testBindings() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $def = $container->register('foo', self::class)->setBindings(['$toto' => 123]); - $def->setInstanceofConditionals([parent::class => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('')]); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveInstanceofConditionalsPass())->process($container); + $def->setInstanceofConditionals([parent::class => new ChildDefinition('')]); + (new ResolveInstanceofConditionalsPass())->process($container); $bindings = $container->getDefinition('foo')->getBindings(); - $this->assertSame(['$toto'], \array_keys($bindings)); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\BoundArgument::class, $bindings['$toto']); + $this->assertSame(['$toto'], array_keys($bindings)); + $this->assertInstanceOf(BoundArgument::class, $bindings['$toto']); $this->assertSame(123, $bindings['$toto']->getValues()[0]); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveInvalidReferencesPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveInvalidReferencesPassTest.php index f93f4cf72..6dad8ef65 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveInvalidReferencesPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveInvalidReferencesPassTest.php @@ -16,12 +16,12 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; -class ResolveInvalidReferencesPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class ResolveInvalidReferencesPassTest extends TestCase { public function testProcess() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $def = $container->register('foo')->setArguments([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::NULL_ON_INVALID_REFERENCE), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE)])->addMethodCall('foo', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('moo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]); + $container = new ContainerBuilder(); + $def = $container->register('foo')->setArguments([new Reference('bar', ContainerInterface::NULL_ON_INVALID_REFERENCE), new Reference('baz', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)])->addMethodCall('foo', [new Reference('moo', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]); $this->process($container); $arguments = $def->getArguments(); $this->assertSame([null, null], $arguments); @@ -29,18 +29,18 @@ public function testProcess() } public function testProcessIgnoreInvalidArgumentInCollectionArgument() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('baz'); - $def = $container->register('foo')->setArguments([[new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE), $baz = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('moo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::NULL_ON_INVALID_REFERENCE)]]); + $def = $container->register('foo')->setArguments([[new Reference('bar', ContainerInterface::IGNORE_ON_INVALID_REFERENCE), $baz = new Reference('baz', ContainerInterface::IGNORE_ON_INVALID_REFERENCE), new Reference('moo', ContainerInterface::NULL_ON_INVALID_REFERENCE)]]); $this->process($container); $arguments = $def->getArguments(); $this->assertSame([$baz, null], $arguments[0]); } public function testProcessKeepMethodCallOnInvalidArgumentInCollectionArgument() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('baz'); - $def = $container->register('foo')->addMethodCall('foo', [[new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE), $baz = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('moo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::NULL_ON_INVALID_REFERENCE)]]); + $def = $container->register('foo')->addMethodCall('foo', [[new Reference('bar', ContainerInterface::IGNORE_ON_INVALID_REFERENCE), $baz = new Reference('baz', ContainerInterface::IGNORE_ON_INVALID_REFERENCE), new Reference('moo', ContainerInterface::NULL_ON_INVALID_REFERENCE)]]); $this->process($container); $calls = $def->getMethodCalls(); $this->assertCount(1, $def->getMethodCalls()); @@ -48,29 +48,29 @@ public function testProcessKeepMethodCallOnInvalidArgumentInCollectionArgument() } public function testProcessIgnoreNonExistentServices() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $def = $container->register('foo')->setArguments([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar')]); + $container = new ContainerBuilder(); + $def = $container->register('foo')->setArguments([new Reference('bar')]); $this->process($container); $arguments = $def->getArguments(); $this->assertEquals('bar', (string) $arguments[0]); } public function testProcessRemovesPropertiesOnInvalid() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $def = $container->register('foo')->setProperty('foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE)); + $container = new ContainerBuilder(); + $def = $container->register('foo')->setProperty('foo', new Reference('bar', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)); $this->process($container); $this->assertEquals([], $def->getProperties()); } public function testProcessRemovesArgumentsOnInvalid() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $def = $container->register('foo')->addArgument([[new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE))]]); + $container = new ContainerBuilder(); + $def = $container->register('foo')->addArgument([[new Reference('bar', ContainerInterface::IGNORE_ON_INVALID_REFERENCE), new ServiceClosureArgument(new Reference('baz', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))]]); $this->process($container); $this->assertSame([[[]]], $def->getArguments()); } - protected function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + protected function process(ContainerBuilder $container) { - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveInvalidReferencesPass(); + $pass = new ResolveInvalidReferencesPass(); $pass->process($container); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveNamedArgumentsPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveNamedArgumentsPassTest.php index f74700a3e..01b95de8f 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveNamedArgumentsPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveNamedArgumentsPassTest.php @@ -22,103 +22,103 @@ /** * @author Kévin Dunglas */ -class ResolveNamedArgumentsPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class ResolveNamedArgumentsPassTest extends TestCase { public function testProcess() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $definition = $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy::class); - $definition->setArguments([2 => 'http://api.example.com', '$apiKey' => '123', 0 => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo')]); + $container = new ContainerBuilder(); + $definition = $container->register(NamedArgumentsDummy::class, NamedArgumentsDummy::class); + $definition->setArguments([2 => 'http://api.example.com', '$apiKey' => '123', 0 => new Reference('foo')]); $definition->addMethodCall('setApiKey', ['$apiKey' => '123']); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveNamedArgumentsPass(); + $pass = new ResolveNamedArgumentsPass(); $pass->process($container); - $this->assertEquals([0 => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo'), 1 => '123', 2 => 'http://api.example.com'], $definition->getArguments()); + $this->assertEquals([0 => new Reference('foo'), 1 => '123', 2 => 'http://api.example.com'], $definition->getArguments()); $this->assertEquals([['setApiKey', ['123']]], $definition->getMethodCalls()); } public function testWithFactory() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('factory', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\NoConstructor::class); - $definition = $container->register('foo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\NoConstructor::class)->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('factory'), 'create'])->setArguments(['$apiKey' => '123']); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveNamedArgumentsPass(); + $container = new ContainerBuilder(); + $container->register('factory', NoConstructor::class); + $definition = $container->register('foo', NoConstructor::class)->setFactory([new Reference('factory'), 'create'])->setArguments(['$apiKey' => '123']); + $pass = new ResolveNamedArgumentsPass(); $pass->process($container); $this->assertSame([0 => '123'], $definition->getArguments()); } public function testClassNull() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $definition = $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy::class); + $container = new ContainerBuilder(); + $definition = $container->register(NamedArgumentsDummy::class); $definition->setArguments(['$apiKey' => '123']); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveNamedArgumentsPass(); + $pass = new ResolveNamedArgumentsPass(); $pass->process($container); } public function testClassNotExist() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $definition = $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\NotExist::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\NotExist::class); + $container = new ContainerBuilder(); + $definition = $container->register(NotExist::class, NotExist::class); $definition->setArguments(['$apiKey' => '123']); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveNamedArgumentsPass(); + $pass = new ResolveNamedArgumentsPass(); $pass->process($container); } public function testClassNoConstructor() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $definition = $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\NoConstructor::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\NoConstructor::class); + $container = new ContainerBuilder(); + $definition = $container->register(NoConstructor::class, NoConstructor::class); $definition->setArguments(['$apiKey' => '123']); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveNamedArgumentsPass(); + $pass = new ResolveNamedArgumentsPass(); $pass->process($container); } public function testArgumentNotFound() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('Invalid service "Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\NamedArgumentsDummy": method "__construct()" has no argument named "$notFound". Check your service definition.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $definition = $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy::class); + $container = new ContainerBuilder(); + $definition = $container->register(NamedArgumentsDummy::class, NamedArgumentsDummy::class); $definition->setArguments(['$notFound' => '123']); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveNamedArgumentsPass(); + $pass = new ResolveNamedArgumentsPass(); $pass->process($container); } public function testCorrectMethodReportedInException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('Invalid service "Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestDefinition1": method "Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\FactoryDummyWithoutReturnTypes::createTestDefinition1()" has no argument named "$notFound". Check your service definition.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummyWithoutReturnTypes::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummyWithoutReturnTypes::class); - $definition = $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition1::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition1::class); - $definition->setFactory([\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummyWithoutReturnTypes::class, 'createTestDefinition1']); + $container = new ContainerBuilder(); + $container->register(FactoryDummyWithoutReturnTypes::class, FactoryDummyWithoutReturnTypes::class); + $definition = $container->register(TestDefinition1::class, TestDefinition1::class); + $definition->setFactory([FactoryDummyWithoutReturnTypes::class, 'createTestDefinition1']); $definition->setArguments(['$notFound' => '123']); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveNamedArgumentsPass(); + $pass = new ResolveNamedArgumentsPass(); $pass->process($container); } public function testTypedArgument() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $definition = $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy::class); - $definition->setArguments(['$apiKey' => '123', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass::class => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo')]); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveNamedArgumentsPass(); + $container = new ContainerBuilder(); + $definition = $container->register(NamedArgumentsDummy::class, NamedArgumentsDummy::class); + $definition->setArguments(['$apiKey' => '123', CaseSensitiveClass::class => new Reference('foo')]); + $pass = new ResolveNamedArgumentsPass(); $pass->process($container); - $this->assertEquals([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo'), '123'], $definition->getArguments()); + $this->assertEquals([new Reference('foo'), '123'], $definition->getArguments()); } public function testResolvesMultipleArgumentsOfTheSameType() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $definition = $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\SimilarArgumentsDummy::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\SimilarArgumentsDummy::class); - $definition->setArguments([\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass::class => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo'), '$token' => 'qwerty']); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveNamedArgumentsPass(); + $container = new ContainerBuilder(); + $definition = $container->register(SimilarArgumentsDummy::class, SimilarArgumentsDummy::class); + $definition->setArguments([CaseSensitiveClass::class => new Reference('foo'), '$token' => 'qwerty']); + $pass = new ResolveNamedArgumentsPass(); $pass->process($container); - $this->assertEquals([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo'), 'qwerty', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo')], $definition->getArguments()); + $this->assertEquals([new Reference('foo'), 'qwerty', new Reference('foo')], $definition->getArguments()); } public function testResolvePrioritizeNamedOverType() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $definition = $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\SimilarArgumentsDummy::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\SimilarArgumentsDummy::class); - $definition->setArguments([\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass::class => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo'), '$token' => 'qwerty', '$class1' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar')]); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveNamedArgumentsPass(); + $container = new ContainerBuilder(); + $definition = $container->register(SimilarArgumentsDummy::class, SimilarArgumentsDummy::class); + $definition->setArguments([CaseSensitiveClass::class => new Reference('foo'), '$token' => 'qwerty', '$class1' => new Reference('bar')]); + $pass = new ResolveNamedArgumentsPass(); $pass->process($container); - $this->assertEquals([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar'), 'qwerty', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo')], $definition->getArguments()); + $this->assertEquals([new Reference('bar'), 'qwerty', new Reference('foo')], $definition->getArguments()); } } class NoConstructor diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveParameterPlaceHoldersPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveParameterPlaceHoldersPassTest.php index 7b5b1908a..3cb5877d4 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveParameterPlaceHoldersPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveParameterPlaceHoldersPassTest.php @@ -14,14 +14,14 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; -class ResolveParameterPlaceHoldersPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class ResolveParameterPlaceHoldersPassTest extends TestCase { private $compilerPass; private $container; private $fooDefinition; protected function setUp() { - $this->compilerPass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass(); + $this->compilerPass = new ResolveParameterPlaceHoldersPass(); $this->container = $this->createContainerBuilder(); $this->compilerPass->process($this->container); $this->fooDefinition = $this->container->getDefinition('foo'); @@ -56,31 +56,31 @@ public function testAliasParametersShouldBeResolved() } public function testBindingsShouldBeResolved() { - list($boundValue) = $this->container->getDefinition('foo')->getBindings()['$baz']->getValues(); + [$boundValue] = $this->container->getDefinition('foo')->getBindings()['$baz']->getValues(); $this->assertSame($this->container->getParameterBag()->resolveValue('%env(BAZ)%'), $boundValue); } public function testParameterNotFoundExceptionsIsThrown() { - $this->expectException(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException::class); + $this->expectException(ParameterNotFoundException::class); $this->expectExceptionMessage('The service "baz_service_id" has a dependency on a non-existent parameter "non_existent_param".'); - $containerBuilder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $containerBuilder = new ContainerBuilder(); $definition = $containerBuilder->register('baz_service_id'); $definition->setArgument(0, '%non_existent_param%'); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass(); + $pass = new ResolveParameterPlaceHoldersPass(); $pass->process($containerBuilder); } public function testParameterNotFoundExceptionsIsNotThrown() { - $containerBuilder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $containerBuilder = new ContainerBuilder(); $definition = $containerBuilder->register('baz_service_id'); $definition->setArgument(0, '%non_existent_param%'); - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass(\true, \false); + $pass = new ResolveParameterPlaceHoldersPass(true, false); $pass->process($containerBuilder); $this->assertCount(1, $definition->getErrors()); } private function createContainerBuilder() { - $containerBuilder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $containerBuilder = new ContainerBuilder(); $containerBuilder->setParameter('foo.class', 'Foo'); $containerBuilder->setParameter('foo.factory.class', 'FooFactory'); $containerBuilder->setParameter('foo.arg1', 'bar'); diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolvePrivatesPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolvePrivatesPassTest.php index 4cf292128..460198e96 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolvePrivatesPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolvePrivatesPassTest.php @@ -13,14 +13,14 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolvePrivatesPass; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; -class ResolvePrivatesPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class ResolvePrivatesPassTest extends TestCase { public function testPrivateHasHigherPrecedenceThanPublic() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', 'stdClass')->setPublic(\true)->setPrivate(\true); - $container->setAlias('bar', 'foo')->setPublic(\false)->setPrivate(\false); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolvePrivatesPass())->process($container); + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass')->setPublic(true)->setPrivate(true); + $container->setAlias('bar', 'foo')->setPublic(false)->setPrivate(false); + (new ResolvePrivatesPass())->process($container); $this->assertFalse($container->getDefinition('foo')->isPublic()); $this->assertFalse($container->getAlias('bar')->isPublic()); } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php index c12bcbf90..5d5588a7e 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php @@ -16,23 +16,23 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; -class ResolveReferencesToAliasesPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class ResolveReferencesToAliasesPassTest extends TestCase { public function testProcess() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->setAlias('bar', 'foo'); - $def = $container->register('moo')->setArguments([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar')]); + $def = $container->register('moo')->setArguments([new Reference('bar')]); $this->process($container); $arguments = $def->getArguments(); $this->assertEquals('foo', (string) $arguments[0]); } public function testProcessRecursively() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->setAlias('bar', 'foo'); $container->setAlias('moo', 'bar'); - $def = $container->register('foobar')->setArguments([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('moo')]); + $def = $container->register('foobar')->setArguments([new Reference('moo')]); $this->process($container); $arguments = $def->getArguments(); $this->assertEquals('foo', (string) $arguments[0]); @@ -40,20 +40,20 @@ public function testProcessRecursively() public function testAliasCircularReference() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\ServiceCircularReferenceException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->setAlias('bar', 'foo'); $container->setAlias('foo', 'bar'); $this->process($container); } public function testResolveFactory() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('factory', 'Factory'); - $container->setAlias('factory_alias', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Alias('factory')); - $foo = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(); - $foo->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('factory_alias'), 'createFoo']); + $container->setAlias('factory_alias', new Alias('factory')); + $foo = new Definition(); + $foo->setFactory([new Reference('factory_alias'), 'createFoo']); $container->setDefinition('foo', $foo); - $bar = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(); + $bar = new Definition(); $bar->setFactory(['Factory', 'createFoo']); $container->setDefinition('bar', $bar); $this->process($container); @@ -62,9 +62,9 @@ public function testResolveFactory() $this->assertSame('factory', (string) $resolvedFooFactory[0]); $this->assertSame('Factory', (string) $resolvedBarFactory[0]); } - protected function process(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + protected function process(ContainerBuilder $container) { - $pass = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveReferencesToAliasesPass(); + $pass = new ResolveReferencesToAliasesPass(); $pass->process($container); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveTaggedIteratorArgumentPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveTaggedIteratorArgumentPassTest.php index fe05cc653..29c24f9fc 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveTaggedIteratorArgumentPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveTaggedIteratorArgumentPassTest.php @@ -18,19 +18,19 @@ /** * @author Roland Franssen */ -class ResolveTaggedIteratorArgumentPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class ResolveTaggedIteratorArgumentPassTest extends TestCase { public function testProcess() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('a', 'stdClass')->addTag('foo'); $container->register('b', 'stdClass')->addTag('foo', ['priority' => 20]); $container->register('c', 'stdClass')->addTag('foo', ['priority' => 10]); - $container->register('d', 'stdClass')->setProperty('foos', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument('foo')); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveTaggedIteratorArgumentPass())->process($container); + $container->register('d', 'stdClass')->setProperty('foos', new TaggedIteratorArgument('foo')); + (new ResolveTaggedIteratorArgumentPass())->process($container); $properties = $container->getDefinition('d')->getProperties(); - $expected = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument('foo'); - $expected->setValues([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('b'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('c'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('a')]); + $expected = new TaggedIteratorArgument('foo'); + $expected->setValues([new Reference('b'), new Reference('c'), new Reference('a')]); $this->assertEquals($expected, $properties['foos']); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ServiceLocatorTagPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ServiceLocatorTagPassTest.php index f33154e13..cea69ca2c 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ServiceLocatorTagPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ServiceLocatorTagPassTest.php @@ -19,69 +19,72 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition1; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition2; +use function array_keys; +use function get_class; + require_once __DIR__ . '/../Fixtures/includes/classes.php'; -class ServiceLocatorTagPassTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class ServiceLocatorTagPassTest extends TestCase { public function testNoServices() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('Invalid definition for service "foo": an array of references is expected as first argument when the "container.service_locator" tag is set.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator::class)->addTag('container.service_locator'); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass())->process($container); + $container = new ContainerBuilder(); + $container->register('foo', ServiceLocator::class)->addTag('container.service_locator'); + (new ServiceLocatorTagPass())->process($container); } public function testInvalidServices() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('Invalid definition for service "foo": an array of references is expected as first argument when the "container.service_locator" tag is set, "string" found for key "0".'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator::class)->setArguments([['dummy']])->addTag('container.service_locator'); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass())->process($container); + $container = new ContainerBuilder(); + $container->register('foo', ServiceLocator::class)->setArguments([['dummy']])->addTag('container.service_locator'); + (new ServiceLocatorTagPass())->process($container); } public function testProcessValue() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('bar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition::class); - $container->register('baz', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition::class); - $container->register('foo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator::class)->setArguments([[new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz'), 'some.service' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar')]])->addTag('container.service_locator'); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass())->process($container); + $container = new ContainerBuilder(); + $container->register('bar', CustomDefinition::class); + $container->register('baz', CustomDefinition::class); + $container->register('foo', ServiceLocator::class)->setArguments([[new Reference('bar'), new Reference('baz'), 'some.service' => new Reference('bar')]])->addTag('container.service_locator'); + (new ServiceLocatorTagPass())->process($container); /** @var ServiceLocator $locator */ $locator = $container->get('foo'); - $this->assertSame(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition::class, \get_class($locator('bar'))); - $this->assertSame(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition::class, \get_class($locator('baz'))); - $this->assertSame(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition::class, \get_class($locator('some.service'))); + $this->assertSame(CustomDefinition::class, get_class($locator('bar'))); + $this->assertSame(CustomDefinition::class, get_class($locator('baz'))); + $this->assertSame(CustomDefinition::class, get_class($locator('some.service'))); } public function testServiceWithKeyOverwritesPreviousInheritedKey() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('bar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition1::class); - $container->register('baz', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition2::class); - $container->register('foo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator::class)->setArguments([[new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar'), 'bar' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz')]])->addTag('container.service_locator'); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass())->process($container); + $container = new ContainerBuilder(); + $container->register('bar', TestDefinition1::class); + $container->register('baz', TestDefinition2::class); + $container->register('foo', ServiceLocator::class)->setArguments([[new Reference('bar'), 'bar' => new Reference('baz')]])->addTag('container.service_locator'); + (new ServiceLocatorTagPass())->process($container); /** @var ServiceLocator $locator */ $locator = $container->get('foo'); - $this->assertSame(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition2::class, \get_class($locator('bar'))); + $this->assertSame(TestDefinition2::class, get_class($locator('bar'))); } public function testInheritedKeyOverwritesPreviousServiceWithKey() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('bar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition1::class); - $container->register('baz', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition2::class); - $container->register('foo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator::class)->setArguments([['bar' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar'), 16 => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz')]])->addTag('container.service_locator'); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass())->process($container); + $container = new ContainerBuilder(); + $container->register('bar', TestDefinition1::class); + $container->register('baz', TestDefinition2::class); + $container->register('foo', ServiceLocator::class)->setArguments([['bar' => new Reference('baz'), new Reference('bar'), 16 => new Reference('baz')]])->addTag('container.service_locator'); + (new ServiceLocatorTagPass())->process($container); /** @var ServiceLocator $locator */ $locator = $container->get('foo'); - $this->assertSame(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition1::class, \get_class($locator('bar'))); - $this->assertSame(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition2::class, \get_class($locator(16))); + $this->assertSame(TestDefinition1::class, get_class($locator('bar'))); + $this->assertSame(TestDefinition2::class, get_class($locator(16))); } public function testBindingsAreCopied() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('foo')->setBindings(['foo' => 'foo']); - $locator = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass::register($container, ['foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo')], 'foo'); + $locator = ServiceLocatorTagPass::register($container, ['foo' => new Reference('foo')], 'foo'); $locator = $container->getDefinition($locator); $locator = $container->getDefinition($locator->getFactory()[0]); - $this->assertSame(['foo'], \array_keys($locator->getBindings())); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\BoundArgument::class, $locator->getBindings()['foo']); + $this->assertSame(['foo'], array_keys($locator->getBindings())); + $this->assertInstanceOf(BoundArgument::class, $locator->getBindings()['foo']); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/index.php b/vendor/symfony/dependency-injection/Tests/Compiler/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Compiler/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Config/AutowireServiceResourceTest.php b/vendor/symfony/dependency-injection/Tests/Config/AutowireServiceResourceTest.php index b6bce722b..4ae2ad0dd 100644 --- a/vendor/symfony/dependency-injection/Tests/Config/AutowireServiceResourceTest.php +++ b/vendor/symfony/dependency-injection/Tests/Config/AutowireServiceResourceTest.php @@ -13,10 +13,20 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Config\AutowireServiceResource; +use ReflectionClass; +use function file_exists; +use function realpath; +use function serialize; +use function sys_get_temp_dir; +use function time; +use function touch; +use function unlink; +use function unserialize; + /** * @group legacy */ -class AutowireServiceResourceTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class AutowireServiceResourceTest extends TestCase { /** * @var AutowireServiceResource @@ -27,11 +37,11 @@ class AutowireServiceResourceTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Frame private $time; protected function setUp() { - $this->file = \realpath(\sys_get_temp_dir()) . '/tmp.php'; - $this->time = \time(); - \touch($this->file, $this->time); - $this->class = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Config\Foo::class; - $this->resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Config\AutowireServiceResource($this->class, $this->file, []); + $this->file = realpath(sys_get_temp_dir()) . '/tmp.php'; + $this->time = time(); + touch($this->file, $this->time); + $this->class = Foo::class; + $this->resource = new AutowireServiceResource($this->class, $this->file, []); } public function testToString() { @@ -39,7 +49,7 @@ public function testToString() } public function testSerializeUnserialize() { - $unserialized = \unserialize(\serialize($this->resource)); + $unserialized = unserialize(serialize($this->resource)); $this->assertEquals($this->resource, $unserialized); } public function testIsFresh() @@ -50,32 +60,32 @@ public function testIsFresh() } public function testIsFreshForDeletedResources() { - \unlink($this->file); + unlink($this->file); $this->assertFalse($this->resource->isFresh($this->getStaleFileTime()), '->isFresh() returns false if the resource does not exist'); } public function testIsNotFreshChangedResource() { - $oldResource = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Config\AutowireServiceResource($this->class, $this->file, ['will_be_different']); + $oldResource = new AutowireServiceResource($this->class, $this->file, ['will_be_different']); // test with a stale file *and* a resource that *will* be different than the actual $this->assertFalse($oldResource->isFresh($this->getStaleFileTime()), '->isFresh() returns false if the constructor arguments have changed'); } public function testIsFreshSameConstructorArgs() { - $oldResource = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\AutowirePass::createResourceForClass(new \ReflectionClass(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Config\Foo::class)); + $oldResource = AutowirePass::createResourceForClass(new ReflectionClass(Foo::class)); // test with a stale file *but* the resource will not be changed $this->assertTrue($oldResource->isFresh($this->getStaleFileTime()), '->isFresh() returns false if the constructor arguments have changed'); } public function testNotFreshIfClassNotFound() { - $resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Config\AutowireServiceResource('_PhpScoper5ea00cc67502b\\Some\\Non\\Existent\\Class', $this->file, []); + $resource = new AutowireServiceResource('_PhpScoper5ea00cc67502b\\Some\\Non\\Existent\\Class', $this->file, []); $this->assertFalse($resource->isFresh($this->getStaleFileTime()), '->isFresh() returns false if the class no longer exists'); } protected function tearDown() { - if (!\file_exists($this->file)) { + if (!file_exists($this->file)) { return; } - \unlink($this->file); + unlink($this->file); } private function getStaleFileTime() { diff --git a/vendor/symfony/dependency-injection/Tests/Config/ContainerParametersResourceCheckerTest.php b/vendor/symfony/dependency-injection/Tests/Config/ContainerParametersResourceCheckerTest.php index 9059d401f..bbdce1144 100644 --- a/vendor/symfony/dependency-injection/Tests/Config/ContainerParametersResourceCheckerTest.php +++ b/vendor/symfony/dependency-injection/Tests/Config/ContainerParametersResourceCheckerTest.php @@ -16,7 +16,9 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Config\ContainerParametersResource; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Config\ContainerParametersResourceChecker; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface; -class ContainerParametersResourceCheckerTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use function time; + +class ContainerParametersResourceCheckerTest extends TestCase { /** @var ContainerParametersResource */ private $resource; @@ -26,9 +28,9 @@ class ContainerParametersResourceCheckerTest extends \_PhpScoper5ea00cc67502b\PH private $container; protected function setUp() { - $this->resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Config\ContainerParametersResource(['locales' => ['fr', 'en'], 'default_locale' => 'fr']); - $this->container = $this->getMockBuilder(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::class)->getMock(); - $this->resourceChecker = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Config\ContainerParametersResourceChecker($this->container); + $this->resource = new ContainerParametersResource(['locales' => ['fr', 'en'], 'default_locale' => 'fr']); + $this->container = $this->getMockBuilder(ContainerInterface::class)->getMock(); + $this->resourceChecker = new ContainerParametersResourceChecker($this->container); } public function testSupports() { @@ -40,19 +42,19 @@ public function testSupports() public function testIsFresh(callable $mockContainer, $expected) { $mockContainer($this->container); - $this->assertSame($expected, $this->resourceChecker->isFresh($this->resource, \time())); + $this->assertSame($expected, $this->resourceChecker->isFresh($this->resource, time())); } public function isFreshProvider() { - (yield 'not fresh on missing parameter' => [function (\_PhpScoper5ea00cc67502b\PHPUnit\Framework\MockObject\MockObject $container) { - $container->method('hasParameter')->with('locales')->willReturn(\false); - }, \false]); - (yield 'not fresh on different value' => [function (\_PhpScoper5ea00cc67502b\PHPUnit\Framework\MockObject\MockObject $container) { + (yield 'not fresh on missing parameter' => [function (MockObject $container) { + $container->method('hasParameter')->with('locales')->willReturn(false); + }, false]); + (yield 'not fresh on different value' => [function (MockObject $container) { $container->method('getParameter')->with('locales')->willReturn(['nl', 'es']); - }, \false]); - (yield 'fresh on every identical parameters' => [function (\_PhpScoper5ea00cc67502b\PHPUnit\Framework\MockObject\MockObject $container) { - $container->expects($this->exactly(2))->method('hasParameter')->willReturn(\true); + }, false]); + (yield 'fresh on every identical parameters' => [function (MockObject $container) { + $container->expects($this->exactly(2))->method('hasParameter')->willReturn(true); $container->expects($this->exactly(2))->method('getParameter')->withConsecutive([$this->equalTo('locales')], [$this->equalTo('default_locale')])->willReturnMap([['locales', ['fr', 'en']], ['default_locale', 'fr']]); - }, \true]); + }, true]); } } diff --git a/vendor/symfony/dependency-injection/Tests/Config/ContainerParametersResourceTest.php b/vendor/symfony/dependency-injection/Tests/Config/ContainerParametersResourceTest.php index a9dfa24aa..3a10e978a 100644 --- a/vendor/symfony/dependency-injection/Tests/Config/ContainerParametersResourceTest.php +++ b/vendor/symfony/dependency-injection/Tests/Config/ContainerParametersResourceTest.php @@ -12,13 +12,16 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Config\ContainerParametersResource; -class ContainerParametersResourceTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use function serialize; +use function unserialize; + +class ContainerParametersResourceTest extends TestCase { /** @var ContainerParametersResource */ private $resource; protected function setUp() { - $this->resource = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Config\ContainerParametersResource(['locales' => ['fr', 'en'], 'default_locale' => 'fr']); + $this->resource = new ContainerParametersResource(['locales' => ['fr', 'en'], 'default_locale' => 'fr']); } public function testToString() { @@ -26,7 +29,7 @@ public function testToString() } public function testSerializeUnserialize() { - $unserialized = \unserialize(\serialize($this->resource)); + $unserialized = unserialize(serialize($this->resource)); $this->assertEquals($this->resource, $unserialized); } public function testGetParameters() diff --git a/vendor/symfony/dependency-injection/Tests/Config/index.php b/vendor/symfony/dependency-injection/Tests/Config/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Config/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/ContainerBuilderTest.php b/vendor/symfony/dependency-injection/Tests/ContainerBuilderTest.php index 0ae4b8c1f..6d620ae6b 100644 --- a/vendor/symfony/dependency-injection/Tests/ContainerBuilderTest.php +++ b/vendor/symfony/dependency-injection/Tests/ContainerBuilderTest.php @@ -12,7 +12,11 @@ require_once __DIR__ . '/Fixtures/includes/classes.php'; require_once __DIR__ . '/Fixtures/includes/ProjectExtension.php'; + +use _PhpScoper5ea00cc67502b\BarClass; +use _PhpScoper5ea00cc67502b\BazClass; use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; +use _PhpScoper5ea00cc67502b\ProjectExtension; use _PhpScoper5ea00cc67502b\Psr\Container\ContainerInterface as PsrContainerInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ComposerResource; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\DirectoryResource; @@ -40,37 +44,55 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\SimilarArgumentsDummy; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression; -class ContainerBuilderTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use DateTime; +use InvalidArgumentException; +use ReflectionClass; +use ReflectionProperty; +use stdClass; +use function array_filter; +use function array_keys; +use function array_merge; +use function array_search; +use function count; +use function dirname; +use function end; +use function get_class; +use function iterator_to_array; +use function putenv; +use function realpath; +use function strpos; + +class ContainerBuilderTest extends TestCase { public function testDefaultRegisteredDefinitions() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $this->assertCount(1, $builder->getDefinitions()); $this->assertTrue($builder->hasDefinition('service_container')); $definition = $builder->getDefinition('service_container'); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition::class, $definition); + $this->assertInstanceOf(Definition::class, $definition); $this->assertTrue($definition->isSynthetic()); - $this->assertSame(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::class, $definition->getClass()); - $this->assertTrue($builder->hasAlias(\_PhpScoper5ea00cc67502b\Psr\Container\ContainerInterface::class)); - $this->assertTrue($builder->hasAlias(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::class)); + $this->assertSame(ContainerInterface::class, $definition->getClass()); + $this->assertTrue($builder->hasAlias(PsrContainerInterface::class)); + $this->assertTrue($builder->hasAlias(ContainerInterface::class)); } public function testDefinitions() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $definitions = ['foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('_PhpScoper5ea00cc67502b\\Bar\\FooClass'), 'bar' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('BarClass')]; + $builder = new ContainerBuilder(); + $definitions = ['foo' => new Definition('_PhpScoper5ea00cc67502b\\Bar\\FooClass'), 'bar' => new Definition('BarClass')]; $builder->setDefinitions($definitions); $this->assertEquals($definitions, $builder->getDefinitions(), '->setDefinitions() sets the service definitions'); $this->assertTrue($builder->hasDefinition('foo'), '->hasDefinition() returns true if a service definition exists'); $this->assertFalse($builder->hasDefinition('foobar'), '->hasDefinition() returns false if a service definition does not exist'); - $builder->setDefinition('foobar', $foo = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('FooBarClass')); + $builder->setDefinition('foobar', $foo = new Definition('FooBarClass')); $this->assertEquals($foo, $builder->getDefinition('foobar'), '->getDefinition() returns a service definition if defined'); - $this->assertSame($builder->setDefinition('foobar', $foo = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('FooBarClass')), $foo, '->setDefinition() implements a fluid interface by returning the service reference'); - $builder->addDefinitions($defs = ['foobar' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('FooBarClass')]); - $this->assertEquals(\array_merge($definitions, $defs), $builder->getDefinitions(), '->addDefinitions() adds the service definitions'); + $this->assertSame($builder->setDefinition('foobar', $foo = new Definition('FooBarClass')), $foo, '->setDefinition() implements a fluid interface by returning the service reference'); + $builder->addDefinitions($defs = ['foobar' => new Definition('FooBarClass')]); + $this->assertEquals(array_merge($definitions, $defs), $builder->getDefinitions(), '->addDefinitions() adds the service definitions'); try { $builder->getDefinition('baz'); $this->fail('->getDefinition() throws a ServiceNotFoundException if the service definition does not exist'); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException $e) { + } catch (ServiceNotFoundException $e) { $this->assertEquals('You have requested a non-existent service "baz".', $e->getMessage(), '->getDefinition() throws a ServiceNotFoundException if the service definition does not exist'); } } @@ -80,83 +102,83 @@ public function testDefinitions() */ public function testCreateDeprecatedService() { - $definition = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); - $definition->setDeprecated(\true); - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $definition = new Definition('stdClass'); + $definition->setDeprecated(true); + $builder = new ContainerBuilder(); $builder->setDefinition('deprecated_foo', $definition); $builder->get('deprecated_foo'); } public function testRegister() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->register('foo', '_PhpScoper5ea00cc67502b\\Bar\\FooClass'); $this->assertTrue($builder->hasDefinition('foo'), '->register() registers a new service definition'); $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Definition', $builder->getDefinition('foo'), '->register() returns the newly created Definition instance'); } public function testAutowire() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->autowire('foo', '_PhpScoper5ea00cc67502b\\Bar\\FooClass'); $this->assertTrue($builder->hasDefinition('foo'), '->autowire() registers a new service definition'); $this->assertTrue($builder->getDefinition('foo')->isAutowired(), '->autowire() creates autowired definitions'); } public function testHas() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $this->assertFalse($builder->has('foo'), '->has() returns false if the service does not exist'); $builder->register('foo', '_PhpScoper5ea00cc67502b\\Bar\\FooClass'); $this->assertTrue($builder->has('foo'), '->has() returns true if a service definition exists'); - $builder->set('bar', new \stdClass()); + $builder->set('bar', new stdClass()); $this->assertTrue($builder->has('bar'), '->has() returns true if a service exists'); } public function testGetThrowsExceptionIfServiceDoesNotExist() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException'); $this->expectExceptionMessage('You have requested a non-existent service "foo".'); - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->get('foo'); } public function testGetReturnsNullIfServiceDoesNotExistAndInvalidReferenceIsUsed() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $this->assertNull($builder->get('foo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::NULL_ON_INVALID_REFERENCE), '->get() returns null if the service does not exist and NULL_ON_INVALID_REFERENCE is passed as a second argument'); + $builder = new ContainerBuilder(); + $this->assertNull($builder->get('foo', ContainerInterface::NULL_ON_INVALID_REFERENCE), '->get() returns null if the service does not exist and NULL_ON_INVALID_REFERENCE is passed as a second argument'); } public function testGetThrowsCircularReferenceExceptionIfServiceHasReferenceToItself() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\ServiceCircularReferenceException'); - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $builder->register('baz', 'stdClass')->setArguments([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz')]); + $builder = new ContainerBuilder(); + $builder->register('baz', 'stdClass')->setArguments([new Reference('baz')]); $builder->get('baz'); } public function testGetReturnsSameInstanceWhenServiceIsShared() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->register('bar', 'stdClass'); $this->assertTrue($builder->get('bar') === $builder->get('bar'), '->get() always returns the same instance if the service is shared'); } public function testGetCreatesServiceBasedOnDefinition() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->register('foo', 'stdClass'); $this->assertIsObject($builder->get('foo'), '->get() returns the service definition associated with the id'); } public function testGetReturnsRegisteredService() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $builder->set('bar', $bar = new \stdClass()); + $builder = new ContainerBuilder(); + $builder->set('bar', $bar = new stdClass()); $this->assertSame($bar, $builder->get('bar'), '->get() returns the service associated with the id'); } public function testRegisterDoesNotOverrideExistingService() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $builder->set('bar', $bar = new \stdClass()); + $builder = new ContainerBuilder(); + $builder->set('bar', $bar = new stdClass()); $builder->register('bar', 'stdClass'); $this->assertSame($bar, $builder->get('bar'), '->get() returns the service associated with the id even if a definition has been defined'); } public function testNonSharedServicesReturnsDifferentInstances() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $builder->register('bar', 'stdClass')->setShared(\false); + $builder = new ContainerBuilder(); + $builder->register('bar', 'stdClass')->setShared(false); $this->assertNotSame($builder->get('bar'), $builder->get('bar')); } /** @@ -165,7 +187,7 @@ public function testNonSharedServicesReturnsDifferentInstances() public function testBadAliasId($id) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->setAlias($id, 'foo'); } /** @@ -174,8 +196,8 @@ public function testBadAliasId($id) public function testBadDefinitionId($id) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $builder->setDefinition($id, new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('Foo')); + $builder = new ContainerBuilder(); + $builder->setDefinition($id, new Definition('Foo')); } public function provideBadId() { @@ -185,27 +207,27 @@ public function testGetUnsetLoadingServiceWhenCreateServiceThrowsAnException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); $this->expectExceptionMessage('You have requested a synthetic service ("foo"). The DIC does not know how to construct this service.'); - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $builder->register('foo', 'stdClass')->setSynthetic(\true); + $builder = new ContainerBuilder(); + $builder->register('foo', 'stdClass')->setSynthetic(true); // we expect a RuntimeException here as foo is synthetic try { $builder->get('foo'); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException $e) { + } catch (RuntimeException $e) { } // we must also have the same RuntimeException here $builder->get('foo'); } public function testGetServiceIds() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->register('foo', 'stdClass'); - $builder->bar = $bar = new \stdClass(); + $builder->bar = $bar = new stdClass(); $builder->register('bar', 'stdClass'); $this->assertEquals(['service_container', 'foo', 'bar', '_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface', '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface'], $builder->getServiceIds(), '->getServiceIds() returns all defined service ids'); } public function testAliases() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->register('foo', 'stdClass'); $builder->setAlias('bar', 'foo'); $this->assertTrue($builder->hasAlias('bar'), '->hasAlias() returns true if the alias exists'); @@ -216,22 +238,22 @@ public function testAliases() try { $builder->setAlias('foobar', 'foobar'); $this->fail('->setAlias() throws an InvalidArgumentException if the alias references itself'); - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $this->assertEquals('An alias can not reference itself, got a circular reference on "foobar".', $e->getMessage(), '->setAlias() throws an InvalidArgumentException if the alias references itself'); } try { $builder->getAlias('foobar'); $this->fail('->getAlias() throws an InvalidArgumentException if the alias does not exist'); - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $this->assertEquals('The service alias "foobar" does not exist.', $e->getMessage(), '->getAlias() throws an InvalidArgumentException if the alias does not exist'); } } public function testGetAliases() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->setAlias('bar', 'foo'); $builder->setAlias('foobar', 'foo'); - $builder->setAlias('moo', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Alias('foo', \false)); + $builder->setAlias('moo', new Alias('foo', false)); $aliases = $builder->getAliases(); $this->assertEquals('foo', (string) $aliases['bar']); $this->assertTrue($aliases['bar']->isPublic()); @@ -246,7 +268,7 @@ public function testGetAliases() } public function testSetAliases() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->setAliases(['bar' => 'foo', 'foobar' => 'foo']); $aliases = $builder->getAliases(); $this->assertArrayHasKey('bar', $aliases); @@ -254,7 +276,7 @@ public function testSetAliases() } public function testAddAliases() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->setAliases(['bar' => 'foo']); $builder->addAliases(['foobar' => 'foo']); $aliases = $builder->getAliases(); @@ -263,36 +285,36 @@ public function testAddAliases() } public function testSetReplacesAlias() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->setAlias('alias', 'aliased'); - $builder->set('aliased', new \stdClass()); - $builder->set('alias', $foo = new \stdClass()); + $builder->set('aliased', new stdClass()); + $builder->set('alias', $foo = new stdClass()); $this->assertSame($foo, $builder->get('alias'), '->set() replaces an existing alias'); } public function testAliasesKeepInvalidBehavior() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $aliased = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); - $aliased->addMethodCall('setBar', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]); + $builder = new ContainerBuilder(); + $aliased = new Definition('stdClass'); + $aliased->addMethodCall('setBar', [new Reference('bar', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]); $builder->setDefinition('aliased', $aliased); $builder->setAlias('alias', 'aliased'); - $this->assertEquals(new \stdClass(), $builder->get('alias')); + $this->assertEquals(new stdClass(), $builder->get('alias')); } public function testAddGetCompilerPass() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $builder->setResourceTracking(\false); + $builder = new ContainerBuilder(); + $builder->setResourceTracking(false); $defaultPasses = $builder->getCompiler()->getPassConfig()->getPasses(); - $builder->addCompilerPass($pass1 = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface')->getMock(), \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, -5); - $builder->addCompilerPass($pass2 = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface')->getMock(), \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 10); + $builder->addCompilerPass($pass1 = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface')->getMock(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -5); + $builder->addCompilerPass($pass2 = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface')->getMock(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 10); $passes = $builder->getCompiler()->getPassConfig()->getPasses(); - $this->assertCount(\count($passes) - 2, $defaultPasses); + $this->assertCount(count($passes) - 2, $defaultPasses); // Pass 1 is executed later - $this->assertTrue(\array_search($pass1, $passes, \true) > \array_search($pass2, $passes, \true)); + $this->assertTrue(array_search($pass1, $passes, true) > array_search($pass2, $passes, true)); } public function testCreateService() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->register('foo1', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->setFile(__DIR__ . '/Fixtures/includes/foo.php'); $builder->register('foo2', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->setFile(__DIR__ . '/Fixtures/includes/%file%.php'); $builder->setParameter('file', 'foo'); @@ -301,35 +323,35 @@ public function testCreateService() } public function testCreateProxyWithRealServiceInstantiator() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->register('foo1', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->setFile(__DIR__ . '/Fixtures/includes/foo.php'); - $builder->getDefinition('foo1')->setLazy(\true); + $builder->getDefinition('foo1')->setLazy(true); $foo1 = $builder->get('foo1'); $this->assertSame($foo1, $builder->get('foo1'), 'The same proxy is retrieved on multiple subsequent calls'); - $this->assertSame('_PhpScoper5ea00cc67502b\\Bar\\FooClass', \get_class($foo1)); + $this->assertSame('_PhpScoper5ea00cc67502b\\Bar\\FooClass', get_class($foo1)); } public function testCreateServiceClass() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->register('foo1', '%class%'); $builder->setParameter('class', 'stdClass'); $this->assertInstanceOf('\\stdClass', $builder->get('foo1'), '->createService() replaces parameters in the class provided by the service definition'); } public function testCreateServiceArguments() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->register('bar', 'stdClass'); - $builder->register('foo1', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->addArgument(['foo' => '%value%', '%value%' => 'foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar'), '%%unescape_it%%']); + $builder->register('foo1', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->addArgument(['foo' => '%value%', '%value%' => 'foo', new Reference('bar'), '%%unescape_it%%']); $builder->setParameter('value', 'bar'); $this->assertEquals(['foo' => 'bar', 'bar' => 'foo', $builder->get('bar'), '%unescape_it%'], $builder->get('foo1')->arguments, '->createService() replaces parameters and service references in the arguments provided by the service definition'); } public function testCreateServiceFactory() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->register('foo', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->setFactory('Bar\\FooClass::getInstance'); $builder->register('qux', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->setFactory(['_PhpScoper5ea00cc67502b\\Bar\\FooClass', 'getInstance']); - $builder->register('bar', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('_PhpScoper5ea00cc67502b\\Bar\\FooClass'), 'getInstance']); - $builder->register('baz', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar'), 'getInstance']); + $builder->register('bar', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->setFactory([new Definition('_PhpScoper5ea00cc67502b\\Bar\\FooClass'), 'getInstance']); + $builder->register('baz', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->setFactory([new Reference('bar'), 'getInstance']); $this->assertTrue($builder->get('foo')->called, '->createService() calls the factory method to create the service instance'); $this->assertTrue($builder->get('qux')->called, '->createService() calls the factory method to create the service instance'); $this->assertTrue($builder->get('bar')->called, '->createService() uses anonymous service as factory'); @@ -337,15 +359,15 @@ public function testCreateServiceFactory() } public function testCreateServiceMethodCalls() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->register('bar', 'stdClass'); - $builder->register('foo1', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->addMethodCall('setBar', [['%value%', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar')]]); + $builder->register('foo1', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->addMethodCall('setBar', [['%value%', new Reference('bar')]]); $builder->setParameter('value', 'bar'); $this->assertEquals(['bar', $builder->get('bar')], $builder->get('foo1')->bar, '->createService() replaces the values in the method calls arguments'); } public function testCreateServiceMethodCallsWithEscapedParam() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->register('bar', 'stdClass'); $builder->register('foo1', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->addMethodCall('setBar', [['%%unescape_it%%']]); $builder->setParameter('value', 'bar'); @@ -353,20 +375,20 @@ public function testCreateServiceMethodCallsWithEscapedParam() } public function testCreateServiceProperties() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->register('bar', 'stdClass'); - $builder->register('foo1', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->setProperty('bar', ['%value%', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar'), '%%unescape_it%%']); + $builder->register('foo1', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->setProperty('bar', ['%value%', new Reference('bar'), '%%unescape_it%%']); $builder->setParameter('value', 'bar'); $this->assertEquals(['bar', $builder->get('bar'), '%unescape_it%'], $builder->get('foo1')->bar, '->createService() replaces the values in the properties'); } public function testCreateServiceConfigurator() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->register('foo1', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->setConfigurator('sc_configure'); $builder->register('foo2', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->setConfigurator(['%class%', 'configureStatic']); $builder->setParameter('class', 'BazClass'); $builder->register('baz', 'BazClass'); - $builder->register('foo3', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->setConfigurator([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz'), 'configure']); + $builder->register('foo3', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->setConfigurator([new Reference('baz'), 'configure']); $builder->register('foo4', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->setConfigurator([$builder->getDefinition('baz'), 'configure']); $builder->register('foo5', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->setConfigurator('foo'); $this->assertTrue($builder->get('foo1')->configured, '->createService() calls the configurator'); @@ -376,18 +398,18 @@ public function testCreateServiceConfigurator() try { $builder->get('foo5'); $this->fail('->createService() throws an InvalidArgumentException if the configure callable is not a valid callable'); - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $this->assertEquals('The configure callable for class "Bar\\FooClass" is not a callable.', $e->getMessage(), '->createService() throws an InvalidArgumentException if the configure callable is not a valid callable'); } } public function testCreateServiceWithIteratorArgument() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->register('bar', 'stdClass'); - $builder->register('lazy_context', 'LazyContext')->setArguments([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument(['k1' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('invalid', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument([])]); + $builder->register('lazy_context', 'LazyContext')->setArguments([new IteratorArgument(['k1' => new Reference('bar'), new Reference('invalid', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]), new IteratorArgument([])]); $lazyContext = $builder->get('lazy_context'); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator::class, $lazyContext->lazyValues); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator::class, $lazyContext->lazyEmptyValues); + $this->assertInstanceOf(RewindableGenerator::class, $lazyContext->lazyValues); + $this->assertInstanceOf(RewindableGenerator::class, $lazyContext->lazyEmptyValues); $this->assertCount(1, $lazyContext->lazyValues); $this->assertCount(0, $lazyContext->lazyEmptyValues); $i = 0; @@ -407,88 +429,88 @@ public function testCreateServiceWithIteratorArgument() public function testCreateSyntheticService() { $this->expectException('RuntimeException'); - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $builder->register('foo', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->setSynthetic(\true); + $builder = new ContainerBuilder(); + $builder->register('foo', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->setSynthetic(true); $builder->get('foo'); } public function testCreateServiceWithExpression() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->setParameter('bar', 'bar'); $builder->register('bar', 'BarClass'); - $builder->register('foo', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->addArgument(['foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression('service("bar").foo ~ parameter("bar")')]); + $builder->register('foo', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->addArgument(['foo' => new Expression('service("bar").foo ~ parameter("bar")')]); $this->assertEquals('foobar', $builder->get('foo')->arguments['foo']); } public function testResolveServices() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->register('foo', '_PhpScoper5ea00cc67502b\\Bar\\FooClass'); - $this->assertEquals($builder->get('foo'), $builder->resolveServices(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo')), '->resolveServices() resolves service references to service instances'); - $this->assertEquals(['foo' => ['foo', $builder->get('foo')]], $builder->resolveServices(['foo' => ['foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo')]]), '->resolveServices() resolves service references to service instances in nested arrays'); - $this->assertEquals($builder->get('foo'), $builder->resolveServices(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression('service("foo")')), '->resolveServices() resolves expressions'); + $this->assertEquals($builder->get('foo'), $builder->resolveServices(new Reference('foo')), '->resolveServices() resolves service references to service instances'); + $this->assertEquals(['foo' => ['foo', $builder->get('foo')]], $builder->resolveServices(['foo' => ['foo', new Reference('foo')]]), '->resolveServices() resolves service references to service instances in nested arrays'); + $this->assertEquals($builder->get('foo'), $builder->resolveServices(new Expression('service("foo")')), '->resolveServices() resolves expressions'); } public function testResolveServicesWithDecoratedDefinition() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); $this->expectExceptionMessage('Constructing service "foo" from a parent definition is not supported at build time.'); - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $builder->setDefinition('grandpa', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass')); - $builder->setDefinition('parent', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('grandpa')); - $builder->setDefinition('foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('parent')); + $builder = new ContainerBuilder(); + $builder->setDefinition('grandpa', new Definition('stdClass')); + $builder->setDefinition('parent', new ChildDefinition('grandpa')); + $builder->setDefinition('foo', new ChildDefinition('parent')); $builder->get('foo'); } public function testResolveServicesWithCustomDefinitionClass() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $builder->setDefinition('foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition('stdClass')); + $builder = new ContainerBuilder(); + $builder->setDefinition('foo', new CustomDefinition('stdClass')); $this->assertInstanceOf('stdClass', $builder->get('foo')); } public function testMerge() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['bar' => 'foo'])); - $container->setResourceTracking(\false); - $config = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => 'bar'])); + $container = new ContainerBuilder(new ParameterBag(['bar' => 'foo'])); + $container->setResourceTracking(false); + $config = new ContainerBuilder(new ParameterBag(['foo' => 'bar'])); $container->merge($config); $this->assertEquals(['bar' => 'foo', 'foo' => 'bar'], $container->getParameterBag()->all(), '->merge() merges current parameters with the loaded ones'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['bar' => 'foo'])); - $container->setResourceTracking(\false); - $config = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => '%bar%'])); + $container = new ContainerBuilder(new ParameterBag(['bar' => 'foo'])); + $container->setResourceTracking(false); + $config = new ContainerBuilder(new ParameterBag(['foo' => '%bar%'])); $container->merge($config); $container->compile(); $this->assertEquals(['bar' => 'foo', 'foo' => 'foo'], $container->getParameterBag()->all(), '->merge() evaluates the values of the parameters towards already defined ones'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['bar' => 'foo'])); - $container->setResourceTracking(\false); - $config = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => '%bar%', 'baz' => '%foo%'])); + $container = new ContainerBuilder(new ParameterBag(['bar' => 'foo'])); + $container->setResourceTracking(false); + $config = new ContainerBuilder(new ParameterBag(['foo' => '%bar%', 'baz' => '%foo%'])); $container->merge($config); $container->compile(); $this->assertEquals(['bar' => 'foo', 'foo' => 'foo', 'baz' => 'foo'], $container->getParameterBag()->all(), '->merge() evaluates the values of the parameters towards already defined ones'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->setResourceTracking(\false); + $container = new ContainerBuilder(); + $container->setResourceTracking(false); $container->register('foo', '_PhpScoper5ea00cc67502b\\Bar\\FooClass'); $container->register('bar', 'BarClass'); - $config = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $config->setDefinition('baz', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('BazClass')); + $config = new ContainerBuilder(); + $config->setDefinition('baz', new Definition('BazClass')); $config->setAlias('alias_for_foo', 'foo'); $container->merge($config); - $this->assertEquals(['service_container', 'foo', 'bar', 'baz'], \array_keys($container->getDefinitions()), '->merge() merges definitions already defined ones'); + $this->assertEquals(['service_container', 'foo', 'bar', 'baz'], array_keys($container->getDefinitions()), '->merge() merges definitions already defined ones'); $aliases = $container->getAliases(); $this->assertArrayHasKey('alias_for_foo', $aliases); $this->assertEquals('foo', (string) $aliases['alias_for_foo']); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->setResourceTracking(\false); + $container = new ContainerBuilder(); + $container->setResourceTracking(false); $container->register('foo', '_PhpScoper5ea00cc67502b\\Bar\\FooClass'); - $config->setDefinition('foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('BazClass')); + $config->setDefinition('foo', new Definition('BazClass')); $container->merge($config); $this->assertEquals('BazClass', $container->getDefinition('foo')->getClass(), '->merge() overrides already defined services'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag(); + $container = new ContainerBuilder(); + $bag = new EnvPlaceholderParameterBag(); $bag->get('env(Foo)'); - $config = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder($bag); + $config = new ContainerBuilder($bag); $this->assertSame(['%env(Bar)%'], $config->resolveEnvPlaceholders([$bag->get('env(Bar)')])); $container->merge($config); $this->assertEquals(['Foo' => 0, 'Bar' => 1], $container->getEnvCounters()); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $config = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); + $config = new ContainerBuilder(); $childDefA = $container->registerForAutoconfiguration('AInterface'); $childDefB = $config->registerForAutoconfiguration('BInterface'); $container->merge($config); @@ -498,8 +520,8 @@ public function testMergeThrowsExceptionForDuplicateAutomaticInstanceofDefinitio { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('"AInterface" has already been autoconfigured and merge() does not support merging autoconfiguration for the same class/interface.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $config = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); + $config = new ContainerBuilder(); $container->registerForAutoconfiguration('AInterface'); $config->registerForAutoconfiguration('AInterface'); $container->merge($config); @@ -509,210 +531,210 @@ public function testResolveEnvValues() $_ENV['DUMMY_ENV_VAR'] = 'du%%y'; $_SERVER['DUMMY_SERVER_VAR'] = 'ABC'; $_SERVER['HTTP_DUMMY_VAR'] = 'DEF'; - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->setParameter('bar', '%% %env(DUMMY_ENV_VAR)% %env(DUMMY_SERVER_VAR)% %env(HTTP_DUMMY_VAR)%'); $container->setParameter('env(HTTP_DUMMY_VAR)', '123'); - $this->assertSame('%% du%%%%y ABC 123', $container->resolveEnvPlaceholders('%bar%', \true)); + $this->assertSame('%% du%%%%y ABC 123', $container->resolveEnvPlaceholders('%bar%', true)); unset($_ENV['DUMMY_ENV_VAR'], $_SERVER['DUMMY_SERVER_VAR'], $_SERVER['HTTP_DUMMY_VAR']); } public function testResolveEnvValuesWithArray() { $_ENV['ANOTHER_DUMMY_ENV_VAR'] = 'dummy'; $dummyArray = ['1' => 'one', '2' => 'two']; - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->setParameter('dummy', '%env(ANOTHER_DUMMY_ENV_VAR)%'); $container->setParameter('dummy2', $dummyArray); - $container->resolveEnvPlaceholders('%dummy%', \true); - $container->resolveEnvPlaceholders('%dummy2%', \true); - $this->assertIsArray($container->resolveEnvPlaceholders('%dummy2%', \true)); + $container->resolveEnvPlaceholders('%dummy%', true); + $container->resolveEnvPlaceholders('%dummy2%', true); + $this->assertIsArray($container->resolveEnvPlaceholders('%dummy2%', true)); foreach ($dummyArray as $key => $value) { - $this->assertArrayHasKey($key, $container->resolveEnvPlaceholders('%dummy2%', \true)); + $this->assertArrayHasKey($key, $container->resolveEnvPlaceholders('%dummy2%', true)); } unset($_ENV['ANOTHER_DUMMY_ENV_VAR']); } public function testCompileWithResolveEnv() { - \putenv('DUMMY_ENV_VAR=du%%y'); + putenv('DUMMY_ENV_VAR=du%%y'); $_SERVER['DUMMY_SERVER_VAR'] = 'ABC'; $_SERVER['HTTP_DUMMY_VAR'] = 'DEF'; - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->setParameter('env(FOO)', 'Foo'); $container->setParameter('env(DUMMY_ENV_VAR)', 'GHI'); $container->setParameter('bar', '%% %env(DUMMY_ENV_VAR)% %env(DUMMY_SERVER_VAR)% %env(HTTP_DUMMY_VAR)%'); $container->setParameter('foo', '%env(FOO)%'); $container->setParameter('baz', '%foo%'); $container->setParameter('env(HTTP_DUMMY_VAR)', '123'); - $container->register('teatime', 'stdClass')->setProperty('foo', '%env(DUMMY_ENV_VAR)%')->setPublic(\true); - $container->compile(\true); + $container->register('teatime', 'stdClass')->setProperty('foo', '%env(DUMMY_ENV_VAR)%')->setPublic(true); + $container->compile(true); $this->assertSame('% du%%y ABC 123', $container->getParameter('bar')); $this->assertSame('Foo', $container->getParameter('baz')); $this->assertSame('du%%y', $container->get('teatime')->foo); unset($_SERVER['DUMMY_SERVER_VAR'], $_SERVER['HTTP_DUMMY_VAR']); - \putenv('DUMMY_ENV_VAR'); + putenv('DUMMY_ENV_VAR'); } public function testCompileWithArrayResolveEnv() { - \putenv('ARRAY={"foo":"bar"}'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + putenv('ARRAY={"foo":"bar"}'); + $container = new ContainerBuilder(); $container->setParameter('foo', '%env(json:ARRAY)%'); - $container->compile(\true); + $container->compile(true); $this->assertSame(['foo' => 'bar'], $container->getParameter('foo')); - \putenv('ARRAY'); + putenv('ARRAY'); } public function testCompileWithArrayAndAnotherResolveEnv() { - \putenv('DUMMY_ENV_VAR=abc'); - \putenv('ARRAY={"foo":"bar"}'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + putenv('DUMMY_ENV_VAR=abc'); + putenv('ARRAY={"foo":"bar"}'); + $container = new ContainerBuilder(); $container->setParameter('foo', '%env(json:ARRAY)%'); $container->setParameter('bar', '%env(DUMMY_ENV_VAR)%'); - $container->compile(\true); + $container->compile(true); $this->assertSame(['foo' => 'bar'], $container->getParameter('foo')); $this->assertSame('abc', $container->getParameter('bar')); - \putenv('DUMMY_ENV_VAR'); - \putenv('ARRAY'); + putenv('DUMMY_ENV_VAR'); + putenv('ARRAY'); } public function testCompileWithArrayInStringResolveEnv() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); $this->expectExceptionMessage('A string value must be composed of strings and/or numbers, but found parameter "env(json:ARRAY)" of type "array" inside string value "ABC %env(json:ARRAY)%".'); - \putenv('ARRAY={"foo":"bar"}'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + putenv('ARRAY={"foo":"bar"}'); + $container = new ContainerBuilder(); $container->setParameter('foo', 'ABC %env(json:ARRAY)%'); - $container->compile(\true); - \putenv('ARRAY'); + $container->compile(true); + putenv('ARRAY'); } public function testCompileWithResolveMissingEnv() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\EnvNotFoundException'); $this->expectExceptionMessage('Environment variable not found: "FOO".'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->setParameter('foo', '%env(FOO)%'); - $container->compile(\true); + $container->compile(true); } public function testDynamicEnv() { - \putenv('DUMMY_FOO=some%foo%'); - \putenv('DUMMY_BAR=%bar%'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + putenv('DUMMY_FOO=some%foo%'); + putenv('DUMMY_BAR=%bar%'); + $container = new ContainerBuilder(); $container->setParameter('foo', 'Foo%env(resolve:DUMMY_BAR)%'); $container->setParameter('bar', 'Bar'); $container->setParameter('baz', '%env(resolve:DUMMY_FOO)%'); - $container->compile(\true); - \putenv('DUMMY_FOO'); - \putenv('DUMMY_BAR'); + $container->compile(true); + putenv('DUMMY_FOO'); + putenv('DUMMY_BAR'); $this->assertSame('someFooBar', $container->getParameter('baz')); } public function testCastEnv() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->setParameter('env(FAKE)', '123'); - $container->register('foo', 'stdClass')->setPublic(\true)->setProperties(['fake' => '%env(int:FAKE)%']); - $container->compile(\true); + $container->register('foo', 'stdClass')->setPublic(true)->setProperties(['fake' => '%env(int:FAKE)%']); + $container->compile(true); $this->assertSame(123, $container->get('foo')->fake); } public function testEnvAreNullable() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->setParameter('env(FAKE)', null); - $container->register('foo', 'stdClass')->setPublic(\true)->setProperties(['fake' => '%env(int:FAKE)%']); - $container->compile(\true); + $container->register('foo', 'stdClass')->setPublic(true)->setProperties(['fake' => '%env(int:FAKE)%']); + $container->compile(true); $this->assertNull($container->get('foo')->fake); } public function testEnvInId() { $container = (include __DIR__ . '/Fixtures/containers/container_env_in_id.php'); - $container->compile(\true); + $container->compile(true); $expected = ['service_container', 'foo', 'bar', 'bar_%env(BAR)%']; - $this->assertSame($expected, \array_keys($container->getDefinitions())); - $expected = [\_PhpScoper5ea00cc67502b\Psr\Container\ContainerInterface::class => \true, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::class => \true, 'baz_%env(BAR)%' => \true, 'bar_%env(BAR)%' => \true]; + $this->assertSame($expected, array_keys($container->getDefinitions())); + $expected = [PsrContainerInterface::class => true, ContainerInterface::class => true, 'baz_%env(BAR)%' => true, 'bar_%env(BAR)%' => true]; $this->assertSame($expected, $container->getRemovedIds()); - $this->assertSame(['baz_bar'], \array_keys($container->getDefinition('foo')->getArgument(1))); + $this->assertSame(['baz_bar'], array_keys($container->getDefinition('foo')->getArgument(1))); } public function testCircularDynamicEnv() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\ParameterCircularReferenceException'); $this->expectExceptionMessage('Circular reference detected for parameter "env(resolve:DUMMY_ENV_VAR)" ("env(resolve:DUMMY_ENV_VAR)" > "env(resolve:DUMMY_ENV_VAR)").'); - \putenv('DUMMY_ENV_VAR=some%foo%'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + putenv('DUMMY_ENV_VAR=some%foo%'); + $container = new ContainerBuilder(); $container->setParameter('foo', '%bar%'); $container->setParameter('bar', '%env(resolve:DUMMY_ENV_VAR)%'); try { - $container->compile(\true); + $container->compile(true); } finally { - \putenv('DUMMY_ENV_VAR'); + putenv('DUMMY_ENV_VAR'); } } public function testMergeLogicException() { $this->expectException('LogicException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->setResourceTracking(\false); + $container = new ContainerBuilder(); + $container->setResourceTracking(false); $container->compile(); - $container->merge(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder()); + $container->merge(new ContainerBuilder()); } public function testfindTaggedServiceIds() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->register('foo', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->addTag('foo', ['foo' => 'foo'])->addTag('bar', ['bar' => 'bar'])->addTag('foo', ['foofoo' => 'foofoo']); $this->assertEquals($builder->findTaggedServiceIds('foo'), ['foo' => [['foo' => 'foo'], ['foofoo' => 'foofoo']]], '->findTaggedServiceIds() returns an array of service ids and its tag attributes'); $this->assertEquals([], $builder->findTaggedServiceIds('foobar'), '->findTaggedServiceIds() returns an empty array if there is annotated services'); } public function testFindUnusedTags() { - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $builder = new ContainerBuilder(); $builder->register('foo', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->addTag('kernel.event_listener', ['foo' => 'foo'])->addTag('kenrel.event_listener', ['bar' => 'bar']); $builder->findTaggedServiceIds('kernel.event_listener'); $this->assertEquals(['kenrel.event_listener'], $builder->findUnusedTags(), '->findUnusedTags() returns an array with unused tags'); } public function testFindDefinition() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->setDefinition('foo', $definition = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('_PhpScoper5ea00cc67502b\\Bar\\FooClass')); + $container = new ContainerBuilder(); + $container->setDefinition('foo', $definition = new Definition('_PhpScoper5ea00cc67502b\\Bar\\FooClass')); $container->setAlias('bar', 'foo'); $container->setAlias('foobar', 'bar'); $this->assertEquals($definition, $container->findDefinition('foobar'), '->findDefinition() returns a Definition'); } public function testAddObjectResource() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->setResourceTracking(\false); - $container->addObjectResource(new \_PhpScoper5ea00cc67502b\BarClass()); + $container = new ContainerBuilder(); + $container->setResourceTracking(false); + $container->addObjectResource(new BarClass()); $this->assertEmpty($container->getResources(), 'No resources get registered without resource tracking'); - $container->setResourceTracking(\true); - $container->addObjectResource(new \_PhpScoper5ea00cc67502b\BarClass()); + $container->setResourceTracking(true); + $container->addObjectResource(new BarClass()); $resources = $container->getResources(); $this->assertCount(2, $resources, '2 resources were registered'); /* @var $resource \Symfony\Component\Config\Resource\FileResource */ - $resource = \end($resources); + $resource = end($resources); $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Resource\\FileResource', $resource); - $this->assertSame(\realpath(__DIR__ . '/Fixtures/includes/classes.php'), \realpath($resource->getResource())); + $this->assertSame(realpath(__DIR__ . '/Fixtures/includes/classes.php'), realpath($resource->getResource())); } /** * @group legacy */ public function testAddClassResource() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->setResourceTracking(\false); - $container->addClassResource(new \ReflectionClass('BarClass')); + $container = new ContainerBuilder(); + $container->setResourceTracking(false); + $container->addClassResource(new ReflectionClass('BarClass')); $this->assertEmpty($container->getResources(), 'No resources get registered without resource tracking'); - $container->setResourceTracking(\true); - $container->addClassResource(new \ReflectionClass('BarClass')); + $container->setResourceTracking(true); + $container->addClassResource(new ReflectionClass('BarClass')); $resources = $container->getResources(); $this->assertCount(2, $resources, '2 resources were registered'); /* @var $resource \Symfony\Component\Config\Resource\FileResource */ - $resource = \end($resources); + $resource = end($resources); $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Config\\Resource\\FileResource', $resource); - $this->assertSame(\realpath(__DIR__ . '/Fixtures/includes/classes.php'), \realpath($resource->getResource())); + $this->assertSame(realpath(__DIR__ . '/Fixtures/includes/classes.php'), realpath($resource->getResource())); } public function testGetReflectionClass() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->setResourceTracking(\false); + $container = new ContainerBuilder(); + $container->setResourceTracking(false); $r1 = $container->getReflectionClass('BarClass'); $this->assertEmpty($container->getResources(), 'No resources get registered without resource tracking'); - $container->setResourceTracking(\true); + $container->setResourceTracking(true); $r2 = $container->getReflectionClass('BarClass'); $r3 = $container->getReflectionClass('BarClass'); $this->assertNull($container->getReflectionClass('BarMissingClass')); @@ -721,11 +743,11 @@ public function testGetReflectionClass() $resources = $container->getResources(); $this->assertCount(3, $resources, '3 resources were registered'); $this->assertSame('reflection.BarClass', (string) $resources[1]); - $this->assertSame('BarMissingClass', (string) \end($resources)); + $this->assertSame('BarMissingClass', (string) end($resources)); } public function testGetReflectionClassOnInternalTypes() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $this->assertNull($container->getReflectionClass('int')); $this->assertNull($container->getReflectionClass('float')); $this->assertNull($container->getReflectionClass('string')); @@ -740,24 +762,24 @@ public function testGetReflectionClassOnInternalTypes() } public function testCompilesClassDefinitionsOfLazyServices() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $this->assertEmpty($container->getResources(), 'No resources get registered without resource tracking'); - $container->register('foo', 'BarClass')->setPublic(\true); - $container->getDefinition('foo')->setLazy(\true); + $container->register('foo', 'BarClass')->setPublic(true); + $container->getDefinition('foo')->setLazy(true); $container->compile(); - $matchingResources = \array_filter($container->getResources(), function (\_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ResourceInterface $resource) { + $matchingResources = array_filter($container->getResources(), function (ResourceInterface $resource) { return 'reflection.BarClass' === (string) $resource; }); $this->assertNotEmpty($matchingResources); } public function testResources() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->addResource($a = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\FileResource(__DIR__ . '/Fixtures/xml/services1.xml')); - $container->addResource($b = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\FileResource(__DIR__ . '/Fixtures/xml/services2.xml')); + $container = new ContainerBuilder(); + $container->addResource($a = new FileResource(__DIR__ . '/Fixtures/xml/services1.xml')); + $container->addResource($b = new FileResource(__DIR__ . '/Fixtures/xml/services2.xml')); $resources = []; foreach ($container->getResources() as $resource) { - if (\false === \strpos($resource, '.php')) { + if (false === strpos($resource, '.php')) { $resources[] = $resource; } } @@ -767,15 +789,15 @@ public function testResources() } public function testFileExists() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $A = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\ComposerResource(); - $a = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\FileResource(__DIR__ . '/Fixtures/xml/services1.xml'); - $b = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\FileResource(__DIR__ . '/Fixtures/xml/services2.xml'); - $c = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\DirectoryResource($dir = \dirname($b)); + $container = new ContainerBuilder(); + $A = new ComposerResource(); + $a = new FileResource(__DIR__ . '/Fixtures/xml/services1.xml'); + $b = new FileResource(__DIR__ . '/Fixtures/xml/services2.xml'); + $c = new DirectoryResource($dir = dirname($b)); $this->assertTrue($container->fileExists((string) $a) && $container->fileExists((string) $b) && $container->fileExists($dir)); $resources = []; foreach ($container->getResources() as $resource) { - if (\false === \strpos($resource, '.php')) { + if (false === strpos($resource, '.php')) { $resources[] = $resource; } } @@ -783,9 +805,9 @@ public function testFileExists() } public function testExtension() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->setResourceTracking(\false); - $container->registerExtension($extension = new \_PhpScoper5ea00cc67502b\ProjectExtension()); + $container = new ContainerBuilder(); + $container->setResourceTracking(false); + $container->registerExtension($extension = new ProjectExtension()); $this->assertSame($container->getExtension('project'), $extension, '->registerExtension() registers an extension'); $this->expectException('LogicException'); $container->getExtension('no_registered'); @@ -795,8 +817,8 @@ public function testRegisteredButNotLoadedExtension() $extension = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface')->getMock(); $extension->expects($this->once())->method('getAlias')->willReturn('project'); $extension->expects($this->never())->method('load'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->setResourceTracking(\false); + $container = new ContainerBuilder(); + $container->setResourceTracking(false); $container->registerExtension($extension); $container->compile(); } @@ -805,60 +827,60 @@ public function testRegisteredAndLoadedExtension() $extension = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface')->getMock(); $extension->expects($this->exactly(2))->method('getAlias')->willReturn('project'); $extension->expects($this->once())->method('load')->with([['foo' => 'bar']]); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->setResourceTracking(\false); + $container = new ContainerBuilder(); + $container->setResourceTracking(false); $container->registerExtension($extension); $container->loadFromExtension('project', ['foo' => 'bar']); $container->compile(); } public function testPrivateServiceUser() { - $fooDefinition = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('BarClass'); - $fooUserDefinition = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('BarUserClass', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar')]); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->setResourceTracking(\false); - $fooDefinition->setPublic(\false); - $container->addDefinitions(['bar' => $fooDefinition, 'bar_user' => $fooUserDefinition->setPublic(\true)]); + $fooDefinition = new Definition('BarClass'); + $fooUserDefinition = new Definition('BarUserClass', [new Reference('bar')]); + $container = new ContainerBuilder(); + $container->setResourceTracking(false); + $fooDefinition->setPublic(false); + $container->addDefinitions(['bar' => $fooDefinition, 'bar_user' => $fooUserDefinition->setPublic(true)]); $container->compile(); $this->assertInstanceOf('BarClass', $container->get('bar_user')->bar); } public function testThrowsExceptionWhenSetServiceOnACompiledContainer() { $this->expectException('BadMethodCallException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->setResourceTracking(\false); - $container->register('a', 'stdClass')->setPublic(\true); + $container = new ContainerBuilder(); + $container->setResourceTracking(false); + $container->register('a', 'stdClass')->setPublic(true); $container->compile(); - $container->set('a', new \stdClass()); + $container->set('a', new stdClass()); } public function testNoExceptionWhenAddServiceOnACompiledContainer() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->compile(); - $container->set('a', $foo = new \stdClass()); + $container->set('a', $foo = new stdClass()); $this->assertSame($foo, $container->get('a')); } public function testNoExceptionWhenSetSyntheticServiceOnACompiledContainer() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); - $def->setSynthetic(\true)->setPublic(\true); + $container = new ContainerBuilder(); + $def = new Definition('stdClass'); + $def->setSynthetic(true)->setPublic(true); $container->setDefinition('a', $def); $container->compile(); - $container->set('a', $a = new \stdClass()); + $container->set('a', $a = new stdClass()); $this->assertEquals($a, $container->get('a')); } public function testThrowsExceptionWhenSetDefinitionOnACompiledContainer() { $this->expectException('BadMethodCallException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->setResourceTracking(\false); + $container = new ContainerBuilder(); + $container->setResourceTracking(false); $container->compile(); - $container->setDefinition('a', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition()); + $container->setDefinition('a', new Definition()); } public function testExtensionConfig() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $configs = $container->getExtensionConfig('foo'); $this->assertEmpty($configs); $first = ['foo' => 'bar']; @@ -872,33 +894,33 @@ public function testExtensionConfig() } public function testAbstractAlias() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $abstract = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('AbstractClass'); - $abstract->setAbstract(\true)->setPublic(\true); + $container = new ContainerBuilder(); + $abstract = new Definition('AbstractClass'); + $abstract->setAbstract(true)->setPublic(true); $container->setDefinition('abstract_service', $abstract); - $container->setAlias('abstract_alias', 'abstract_service')->setPublic(\true); + $container->setAlias('abstract_alias', 'abstract_service')->setPublic(true); $container->compile(); $this->assertSame('abstract_service', (string) $container->getAlias('abstract_alias')); } public function testLazyLoadedService() { - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\ClosureLoader($container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder()); - $loader->load(function (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) { - $container->set('a', new \_PhpScoper5ea00cc67502b\BazClass()); - $definition = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('BazClass'); - $definition->setLazy(\true); - $definition->setPublic(\true); + $loader = new ClosureLoader($container = new ContainerBuilder()); + $loader->load(function (ContainerBuilder $container) { + $container->set('a', new BazClass()); + $definition = new Definition('BazClass'); + $definition->setLazy(true); + $definition->setPublic(true); $container->setDefinition('a', $definition); }); - $container->setResourceTracking(\true); + $container->setResourceTracking(true); $container->compile(); - $r = new \ReflectionProperty($container, 'resources'); - $r->setAccessible(\true); + $r = new ReflectionProperty($container, 'resources'); + $r->setAccessible(true); $resources = $r->getValue($container); - $classInList = \false; + $classInList = false; foreach ($resources as $resource) { if ('reflection.BazClass' === (string) $resource) { - $classInList = \true; + $classInList = true; break; } } @@ -906,8 +928,8 @@ public function testLazyLoadedService() } public function testInlinedDefinitions() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $definition = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('BarClass'); + $container = new ContainerBuilder(); + $definition = new Definition('BarClass'); $container->register('bar_user', 'BarUserClass')->addArgument($definition)->setProperty('foo', $definition); $container->register('bar', 'BarClass')->setProperty('foo', $definition)->addMethodCall('setBaz', [$definition]); $barUser = $container->get('bar_user'); @@ -920,66 +942,66 @@ public function testThrowsCircularExceptionForCircularAliases() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\ServiceCircularReferenceException'); $this->expectExceptionMessage('Circular reference detected for service "app.test_class", path: "app.test_class -> App\\TestClass -> app.test_class".'); - $builder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $builder->setAliases(['foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Alias('app.test_class'), 'app.test_class' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Alias('_PhpScoper5ea00cc67502b\\App\\TestClass'), '_PhpScoper5ea00cc67502b\\App\\TestClass' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Alias('app.test_class')]); + $builder = new ContainerBuilder(); + $builder->setAliases(['foo' => new Alias('app.test_class'), 'app.test_class' => new Alias('_PhpScoper5ea00cc67502b\\App\\TestClass'), '_PhpScoper5ea00cc67502b\\App\\TestClass' => new Alias('app.test_class')]); $builder->findDefinition('foo'); } public function testInitializePropertiesBeforeMethodCalls() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('foo', 'stdClass'); - $container->register('bar', 'MethodCallClass')->setPublic(\true)->setProperty('simple', 'bar')->setProperty('complex', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo'))->addMethodCall('callMe'); + $container->register('bar', 'MethodCallClass')->setPublic(true)->setProperty('simple', 'bar')->setProperty('complex', new Reference('foo'))->addMethodCall('callMe'); $container->compile(); $this->assertTrue($container->get('bar')->callPassed(), '->compile() initializes properties before method calls'); } public function testAutowiring() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\A::class)->setPublic(\true); - $bDefinition = $container->register('b', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\B::class); - $bDefinition->setAutowired(\true); - $bDefinition->setPublic(\true); + $container = new ContainerBuilder(); + $container->register(A::class)->setPublic(true); + $bDefinition = $container->register('b', B::class); + $bDefinition->setAutowired(true); + $bDefinition->setPublic(true); $container->compile(); - $this->assertEquals(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\A::class, (string) $container->getDefinition('b')->getArgument(0)); + $this->assertEquals(A::class, (string) $container->getDefinition('b')->getArgument(0)); } public function testClassFromId() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $unknown = $container->register('_PhpScoper5ea00cc67502b\\Acme\\UnknownClass'); - $autoloadClass = $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass::class); + $autoloadClass = $container->register(CaseSensitiveClass::class); $container->compile(); $this->assertSame('_PhpScoper5ea00cc67502b\\Acme\\UnknownClass', $unknown->getClass()); - $this->assertEquals(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass::class, $autoloadClass->getClass()); + $this->assertEquals(CaseSensitiveClass::class, $autoloadClass->getClass()); } public function testNoClassFromGlobalNamespaceClassId() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); $this->expectExceptionMessage('The definition for "DateTime" has no class attribute, and appears to reference a class or interface in the global namespace.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register(\DateTime::class); + $container = new ContainerBuilder(); + $container->register(DateTime::class); $container->compile(); } public function testNoClassFromGlobalNamespaceClassIdWithLeadingSlash() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); $this->expectExceptionMessage('The definition for "\\DateTime" has no class attribute, and appears to reference a class or interface in the global namespace.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('\\' . \DateTime::class); + $container = new ContainerBuilder(); + $container->register('\\' . DateTime::class); $container->compile(); } public function testNoClassFromNamespaceClassIdWithLeadingSlash() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); $this->expectExceptionMessage('The definition for "\\Symfony\\Component\\DependencyInjection\\Tests\\FooClass" has no class attribute, and appears to reference a class or interface. Please specify the class attribute explicitly or remove the leading backslash by renaming the service to "Symfony\\Component\\DependencyInjection\\Tests\\FooClass" to get rid of this error.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('\\' . \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\FooClass::class); + $container = new ContainerBuilder(); + $container->register('\\' . FooClass::class); $container->compile(); } public function testNoClassFromNonClassId() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); $this->expectExceptionMessage('The definition for "123_abc" has no class.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('123_abc'); $container->compile(); } @@ -987,18 +1009,18 @@ public function testNoClassFromNsSeparatorId() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); $this->expectExceptionMessage('The definition for "\\foo" has no class.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->register('\\foo'); $container->compile(); } public function testServiceLocator() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo_service', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator::class)->setPublic(\true)->addArgument(['bar' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar_service')), 'baz' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference('baz_service', 'stdClass'))]); - $container->register('bar_service', 'stdClass')->setArguments([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz_service')])->setPublic(\true); - $container->register('baz_service', 'stdClass')->setPublic(\false); + $container = new ContainerBuilder(); + $container->register('foo_service', ServiceLocator::class)->setPublic(true)->addArgument(['bar' => new ServiceClosureArgument(new Reference('bar_service')), 'baz' => new ServiceClosureArgument(new TypedReference('baz_service', 'stdClass'))]); + $container->register('bar_service', 'stdClass')->setArguments([new Reference('baz_service')])->setPublic(true); + $container->register('baz_service', 'stdClass')->setPublic(false); $container->compile(); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator::class, $foo = $container->get('foo_service')); + $this->assertInstanceOf(ServiceLocator::class, $foo = $container->get('foo_service')); $this->assertSame($container->get('bar_service'), $foo->get('bar')); } public function testUninitializedReference() @@ -1012,19 +1034,19 @@ public function testUninitializedReference() $this->assertNull($bar->closures[0]()); $this->assertNull($bar->closures[1]()); $this->assertNull($bar->closures[2]()); - $this->assertSame([], \iterator_to_array($bar->iter)); + $this->assertSame([], iterator_to_array($bar->iter)); $container = (include __DIR__ . '/Fixtures/containers/container_uninitialized_ref.php'); $container->compile(); $container->get('foo1'); $container->get('baz'); $bar = $container->get('bar'); - $this->assertEquals(new \stdClass(), $bar->foo1); + $this->assertEquals(new stdClass(), $bar->foo1); $this->assertNull($bar->foo2); - $this->assertEquals(new \stdClass(), $bar->foo3); - $this->assertEquals(new \stdClass(), $bar->closures[0]()); + $this->assertEquals(new stdClass(), $bar->foo3); + $this->assertEquals(new stdClass(), $bar->closures[0]()); $this->assertNull($bar->closures[1]()); - $this->assertEquals(new \stdClass(), $bar->closures[2]()); - $this->assertEquals(['foo1' => new \stdClass(), 'foo3' => new \stdClass()], \iterator_to_array($bar->iter)); + $this->assertEquals(new stdClass(), $bar->closures[2]()); + $this->assertEquals(['foo1' => new stdClass(), 'foo3' => new stdClass()], iterator_to_array($bar->iter)); } /** * @dataProvider provideAlmostCircular @@ -1040,12 +1062,12 @@ public function testAlmostCircular($visibility) $foo5 = $container->get('foo5'); $this->assertSame($foo5, $foo5->bar->foo); $manager = $container->get('manager'); - $this->assertEquals(new \stdClass(), $manager); + $this->assertEquals(new stdClass(), $manager); $manager = $container->get('manager2'); - $this->assertEquals(new \stdClass(), $manager); + $this->assertEquals(new stdClass(), $manager); $foo6 = $container->get('foo6'); $this->assertEquals((object) ['bar6' => (object) []], $foo6); - $this->assertInstanceOf(\stdClass::class, $container->get('root')); + $this->assertInstanceOf(stdClass::class, $container->get('root')); $manager3 = $container->get('manager3'); $listener3 = $container->get('listener3'); $this->assertSame($manager3, $listener3->manager, 'Both should identically be the manager3 service'); @@ -1059,7 +1081,7 @@ public function provideAlmostCircular() } public function testRegisterForAutoconfiguration() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $childDefA = $container->registerForAutoconfiguration('AInterface'); $childDefB = $container->registerForAutoconfiguration('BInterface'); $this->assertSame(['AInterface' => $childDefA, 'BInterface' => $childDefB], $container->getAutoconfiguredInstanceof()); @@ -1074,9 +1096,9 @@ public function testRegisterForAutoconfiguration() */ public function testPrivateServiceTriggersDeprecation() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', 'stdClass')->setPublic(\false)->setDeprecated(\true); - $container->register('bar', 'stdClass')->setPublic(\true)->setProperty('foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo')); + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass')->setPublic(false)->setDeprecated(true); + $container->register('bar', 'stdClass')->setPublic(true)->setProperty('foo', new Reference('foo')); $container->compile(); $container->get('bar'); } @@ -1086,17 +1108,17 @@ public function testPrivateServiceTriggersDeprecation() */ public function testParameterWithMixedCase() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => 'bar'])); - $container->register('foo', 'stdClass')->setPublic(\true)->setProperty('foo', '%FOO%'); + $container = new ContainerBuilder(new ParameterBag(['foo' => 'bar'])); + $container->register('foo', 'stdClass')->setPublic(true)->setProperty('foo', '%FOO%'); $container->compile(); $this->assertSame('bar', $container->get('foo')->foo); } public function testArgumentsHaveHigherPriorityThanBindings() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('class.via.bindings', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass::class)->setArguments(['via-bindings']); - $container->register('class.via.argument', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass::class)->setArguments(['via-argument']); - $container->register('foo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\SimilarArgumentsDummy::class)->setPublic(\true)->setBindings([\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass::class => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('class.via.bindings'), '$token' => '1234'])->setArguments(['$class1' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('class.via.argument')]); + $container = new ContainerBuilder(); + $container->register('class.via.bindings', CaseSensitiveClass::class)->setArguments(['via-bindings']); + $container->register('class.via.argument', CaseSensitiveClass::class)->setArguments(['via-argument']); + $container->register('foo', SimilarArgumentsDummy::class)->setPublic(true)->setBindings([CaseSensitiveClass::class => new Reference('class.via.bindings'), '$token' => '1234'])->setArguments(['$class1' => new Reference('class.via.argument')]); $this->assertSame(['service_container', 'class.via.bindings', 'class.via.argument', 'foo', '_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface', '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface'], $container->getServiceIds()); $container->compile(); $this->assertSame('via-argument', $container->get('foo')->class1->identifier); @@ -1104,9 +1126,9 @@ public function testArgumentsHaveHigherPriorityThanBindings() } public function testUninitializedSyntheticReference() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', 'stdClass')->setPublic(\true)->setSynthetic(\true); - $container->register('bar', 'stdClass')->setPublic(\true)->setShared(\false)->setProperty('foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE)); + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass')->setPublic(true)->setSynthetic(true); + $container->register('bar', 'stdClass')->setPublic(true)->setShared(false)->setProperty('foo', new Reference('foo', ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE)); $container->compile(); $this->assertEquals((object) ['foo' => null], $container->get('bar')); $container->set('foo', (object) [123]); @@ -1114,16 +1136,16 @@ public function testUninitializedSyntheticReference() } public function testDecoratedSelfReferenceInvolvingPrivateServices() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', 'stdClass')->setPublic(\false)->setProperty('bar', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo')); - $container->register('baz', 'stdClass')->setPublic(\false)->setProperty('inner', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz.inner'))->setDecoratedService('foo'); + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass')->setPublic(false)->setProperty('bar', new Reference('foo')); + $container->register('baz', 'stdClass')->setPublic(false)->setProperty('inner', new Reference('baz.inner'))->setDecoratedService('foo'); $container->compile(); - $this->assertSame(['service_container'], \array_keys($container->getDefinitions())); + $this->assertSame(['service_container'], array_keys($container->getDefinitions())); } public function testScalarService() { - $c = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $c->register('foo', 'string')->setPublic(\true)->setFactory([\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\ScalarFactory::class, 'getSomeValue']); + $c = new ContainerBuilder(); + $c->register('foo', 'string')->setPublic(true)->setFactory([ScalarFactory::class, 'getSomeValue']); $c->compile(); $this->assertTrue($c->has('foo')); $this->assertSame('some value', $c->get('foo')); @@ -1137,7 +1159,7 @@ class A } class B { - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\A $a) + public function __construct(A $a) { } } diff --git a/vendor/symfony/dependency-injection/Tests/ContainerTest.php b/vendor/symfony/dependency-injection/Tests/ContainerTest.php index b0a551e2b..1296b4cdb 100644 --- a/vendor/symfony/dependency-injection/Tests/ContainerTest.php +++ b/vendor/symfony/dependency-injection/Tests/ContainerTest.php @@ -15,13 +15,19 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; -class ContainerTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use Exception; +use ReflectionClass; +use ReflectionProperty; +use stdClass; +use function sprintf; + +class ContainerTest extends TestCase { public function testConstructor() { - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container(); + $sc = new Container(); $this->assertSame($sc, $sc->get('service_container'), '__construct() automatically registers itself as a service'); - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => 'bar'])); + $sc = new Container(new ParameterBag(['foo' => 'bar'])); $this->assertEquals(['foo' => 'bar'], $sc->getParameterBag()->all(), '__construct() takes an array of parameters as its first argument'); } /** @@ -29,7 +35,7 @@ public function testConstructor() */ public function testCamelize($id, $expected) { - $this->assertEquals($expected, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container::camelize($id), \sprintf('Container::camelize("%s")', $id)); + $this->assertEquals($expected, Container::camelize($id), sprintf('Container::camelize("%s")', $id)); } public function dataForTestCamelize() { @@ -40,7 +46,7 @@ public function dataForTestCamelize() */ public function testUnderscore($id, $expected) { - $this->assertEquals($expected, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container::underscore($id), \sprintf('Container::underscore("%s")', $id)); + $this->assertEquals($expected, Container::underscore($id), sprintf('Container::underscore("%s")', $id)); } public function dataForTestUnderscore() { @@ -48,7 +54,7 @@ public function dataForTestUnderscore() } public function testCompile() { - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => 'bar'])); + $sc = new Container(new ParameterBag(['foo' => 'bar'])); $this->assertFalse($sc->getParameterBag()->isResolved(), '->compile() resolves the parameter bag'); $sc->compile(); $this->assertTrue($sc->getParameterBag()->isResolved(), '->compile() resolves the parameter bag'); @@ -62,31 +68,31 @@ public function testCompile() */ public function testIsFrozen() { - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => 'bar'])); + $sc = new Container(new ParameterBag(['foo' => 'bar'])); $this->assertFalse($sc->isFrozen(), '->isFrozen() returns false if the parameters are not frozen'); $sc->compile(); $this->assertTrue($sc->isFrozen(), '->isFrozen() returns true if the parameters are frozen'); } public function testIsCompiled() { - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => 'bar'])); + $sc = new Container(new ParameterBag(['foo' => 'bar'])); $this->assertFalse($sc->isCompiled(), '->isCompiled() returns false if the container is not compiled'); $sc->compile(); $this->assertTrue($sc->isCompiled(), '->isCompiled() returns true if the container is compiled'); } public function testIsCompiledWithFrozenParameters() { - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag(['foo' => 'bar'])); + $sc = new Container(new FrozenParameterBag(['foo' => 'bar'])); $this->assertFalse($sc->isCompiled(), '->isCompiled() returns false if the container is not compiled but the parameter bag is already frozen'); } public function testGetParameterBag() { - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container(); + $sc = new Container(); $this->assertEquals([], $sc->getParameterBag()->all(), '->getParameterBag() returns an empty array if no parameter has been defined'); } public function testGetSetParameter() { - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => 'bar'])); + $sc = new Container(new ParameterBag(['foo' => 'bar'])); $sc->setParameter('bar', 'foo'); $this->assertEquals('foo', $sc->getParameter('bar'), '->setParameter() sets the value of a new parameter'); $sc->setParameter('foo', 'baz'); @@ -94,7 +100,7 @@ public function testGetSetParameter() try { $sc->getParameter('baba'); $this->fail('->getParameter() thrown an \\InvalidArgumentException if the key does not exist'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertInstanceOf('\\InvalidArgumentException', $e, '->getParameter() thrown an \\InvalidArgumentException if the key does not exist'); $this->assertEquals('You have requested a non-existent parameter "baba".', $e->getMessage(), '->getParameter() thrown an \\InvalidArgumentException if the key does not exist'); } @@ -106,19 +112,19 @@ public function testGetSetParameter() */ public function testGetSetParameterWithMixedCase() { - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => 'bar'])); + $sc = new Container(new ParameterBag(['foo' => 'bar'])); $sc->setParameter('Foo', 'baz1'); $this->assertEquals('baz1', $sc->getParameter('foo'), '->setParameter() converts the key to lowercase'); $this->assertEquals('baz1', $sc->getParameter('FOO'), '->getParameter() converts the key to lowercase'); } public function testGetServiceIds() { - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container(); - $sc->set('foo', $obj = new \stdClass()); - $sc->set('bar', $obj = new \stdClass()); + $sc = new Container(); + $sc->set('foo', $obj = new stdClass()); + $sc->set('bar', $obj = new stdClass()); $this->assertEquals(['service_container', 'foo', 'bar'], $sc->getServiceIds(), '->getServiceIds() returns all defined service ids'); - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\ProjectServiceContainer(); - $sc->set('foo', $obj = new \stdClass()); + $sc = new ProjectServiceContainer(); + $sc->set('foo', $obj = new stdClass()); $this->assertEquals(['service_container', 'internal', 'bar', 'foo_bar', 'foo.baz', 'circular', 'throw_exception', 'throws_exception_on_service_configuration', 'internal_dependency', 'alias', 'foo'], $sc->getServiceIds(), '->getServiceIds() returns defined service ids by factory methods in the method map, followed by service ids defined by set()'); } /** @@ -127,26 +133,26 @@ public function testGetServiceIds() */ public function testGetLegacyServiceIds() { - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\LegacyProjectServiceContainer(); - $sc->set('foo', $obj = new \stdClass()); + $sc = new LegacyProjectServiceContainer(); + $sc->set('foo', $obj = new stdClass()); $this->assertEquals(['internal', 'bar', 'foo_bar', 'foo.baz', 'circular', 'throw_exception', 'throws_exception_on_service_configuration', 'service_container', 'alias', 'foo'], $sc->getServiceIds(), '->getServiceIds() returns defined service ids by getXXXService() methods, followed by service ids defined by set()'); } public function testSet() { - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container(); - $sc->set('._. \\o/', $foo = new \stdClass()); + $sc = new Container(); + $sc->set('._. \\o/', $foo = new stdClass()); $this->assertSame($foo, $sc->get('._. \\o/'), '->set() sets a service'); } public function testSetWithNullResetTheService() { - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container(); + $sc = new Container(); $sc->set('foo', null); $this->assertFalse($sc->has('foo'), '->set() with null service resets the service'); } public function testSetReplacesAlias() { - $c = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\ProjectServiceContainer(); - $c->set('alias', $foo = new \stdClass()); + $c = new ProjectServiceContainer(); + $c->set('alias', $foo = new stdClass()); $this->assertSame($foo, $c->get('alias'), '->set() replaces an existing alias'); } /** @@ -155,30 +161,30 @@ public function testSetReplacesAlias() */ public function testSetWithNullOnInitializedPredefinedService() { - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container(); - $sc->set('foo', new \stdClass()); + $sc = new Container(); + $sc->set('foo', new stdClass()); $sc->set('foo', null); $this->assertFalse($sc->has('foo'), '->set() with null service resets the service'); - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\ProjectServiceContainer(); + $sc = new ProjectServiceContainer(); $sc->get('bar'); $sc->set('bar', null); $this->assertTrue($sc->has('bar'), '->set() with null service resets the pre-defined service'); } public function testSetWithNullOnUninitializedPredefinedService() { - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container(); - $sc->set('foo', new \stdClass()); + $sc = new Container(); + $sc->set('foo', new stdClass()); $sc->get('foo', null); $sc->set('foo', null); $this->assertFalse($sc->has('foo'), '->set() with null service resets the service'); - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\ProjectServiceContainer(); + $sc = new ProjectServiceContainer(); $sc->set('bar', null); $this->assertTrue($sc->has('bar'), '->set() with null service resets the pre-defined service'); } public function testGet() { - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\ProjectServiceContainer(); - $sc->set('foo', $foo = new \stdClass()); + $sc = new ProjectServiceContainer(); + $sc->set('foo', $foo = new stdClass()); $this->assertSame($foo, $sc->get('foo'), '->get() returns the service for the given id'); $this->assertSame($sc->__bar, $sc->get('bar'), '->get() returns the service for the given id'); $this->assertSame($sc->__foo_bar, $sc->get('foo_bar'), '->get() returns the service if a get*Method() is defined'); @@ -186,10 +192,10 @@ public function testGet() try { $sc->get(''); $this->fail('->get() throws a \\InvalidArgumentException exception if the service is empty'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException', $e, '->get() throws a ServiceNotFoundException exception if the service is empty'); } - $this->assertNull($sc->get('', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::NULL_ON_INVALID_REFERENCE), '->get() returns null if the service is empty'); + $this->assertNull($sc->get('', ContainerInterface::NULL_ON_INVALID_REFERENCE), '->get() returns null if the service is empty'); } /** * @group legacy @@ -197,8 +203,8 @@ public function testGet() */ public function testGetInsensitivity() { - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\ProjectServiceContainer(); - $sc->set('foo', $foo = new \stdClass()); + $sc = new ProjectServiceContainer(); + $sc->set('foo', $foo = new stdClass()); $this->assertSame($foo, $sc->get('Foo'), '->get() returns the service for the given id, and converts id to lowercase'); } /** @@ -207,8 +213,8 @@ public function testGetInsensitivity() */ public function testNormalizeIdKeepsCase() { - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\ProjectServiceContainer(); - $sc->normalizeId('Foo', \true); + $sc = new ProjectServiceContainer(); + $sc->normalizeId('Foo', true); $this->assertSame('Foo', $sc->normalizeId('foo')); } /** @@ -221,51 +227,51 @@ public function testNormalizeIdKeepsCase() */ public function testLegacyGet() { - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\LegacyProjectServiceContainer(); - $sc->set('foo', $foo = new \stdClass()); + $sc = new LegacyProjectServiceContainer(); + $sc->set('foo', $foo = new stdClass()); $this->assertSame($foo, $sc->get('foo'), '->get() returns the service for the given id'); $this->assertSame($foo, $sc->get('Foo'), '->get() returns the service for the given id, and converts id to lowercase'); $this->assertSame($sc->__bar, $sc->get('bar'), '->get() returns the service for the given id'); $this->assertSame($sc->__foo_bar, $sc->get('foo_bar'), '->get() returns the service if a get*Method() is defined'); $this->assertSame($sc->__foo_baz, $sc->get('foo.baz'), '->get() returns the service if a get*Method() is defined'); $this->assertSame($sc->__foo_baz, $sc->get('_PhpScoper5ea00cc67502b\\foo\\baz'), '->get() returns the service if a get*Method() is defined'); - $sc->set('bar', $bar = new \stdClass()); + $sc->set('bar', $bar = new stdClass()); $this->assertSame($bar, $sc->get('bar'), '->get() prefers to return a service defined with set() than one defined with a getXXXMethod()'); try { $sc->get(''); $this->fail('->get() throws a \\InvalidArgumentException exception if the service is empty'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException', $e, '->get() throws a ServiceNotFoundException exception if the service is empty'); } - $this->assertNull($sc->get('', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::NULL_ON_INVALID_REFERENCE), '->get() returns null if the service is empty'); + $this->assertNull($sc->get('', ContainerInterface::NULL_ON_INVALID_REFERENCE), '->get() returns null if the service is empty'); } public function testGetThrowServiceNotFoundException() { - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\ProjectServiceContainer(); - $sc->set('foo', $foo = new \stdClass()); - $sc->set('baz', $foo = new \stdClass()); + $sc = new ProjectServiceContainer(); + $sc->set('foo', $foo = new stdClass()); + $sc->set('baz', $foo = new stdClass()); try { $sc->get('foo1'); $this->fail('->get() throws an Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException if the key does not exist'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException', $e, '->get() throws an Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException if the key does not exist'); $this->assertEquals('You have requested a non-existent service "foo1". Did you mean this: "foo"?', $e->getMessage(), '->get() throws an Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException with some advices'); } try { $sc->get('bag'); $this->fail('->get() throws an Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException if the key does not exist'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException', $e, '->get() throws an Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException if the key does not exist'); $this->assertEquals('You have requested a non-existent service "bag". Did you mean one of these: "bar", "baz"?', $e->getMessage(), '->get() throws an Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException with some advices'); } } public function testGetCircularReference() { - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\ProjectServiceContainer(); + $sc = new ProjectServiceContainer(); try { $sc->get('circular'); $this->fail('->get() throws a ServiceCircularReferenceException if it contains circular reference'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\ServiceCircularReferenceException', $e, '->get() throws a ServiceCircularReferenceException if it contains circular reference'); $this->assertStringStartsWith('Circular reference detected for service "circular"', $e->getMessage(), '->get() throws a \\LogicException if it contains circular reference'); } @@ -288,8 +294,8 @@ public function testGetRemovedServiceThrows() } public function testHas() { - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\ProjectServiceContainer(); - $sc->set('foo', new \stdClass()); + $sc = new ProjectServiceContainer(); + $sc->set('foo', new stdClass()); $this->assertFalse($sc->has('foo1'), '->has() returns false if the service does not exist'); $this->assertTrue($sc->has('foo'), '->has() returns true if the service exists'); $this->assertTrue($sc->has('bar'), '->has() returns true if a get*Method() is defined'); @@ -305,8 +311,8 @@ public function testHas() */ public function testLegacyHas() { - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\LegacyProjectServiceContainer(); - $sc->set('foo', new \stdClass()); + $sc = new LegacyProjectServiceContainer(); + $sc->set('foo', new stdClass()); $this->assertFalse($sc->has('foo1'), '->has() returns false if the service does not exist'); $this->assertTrue($sc->has('foo'), '->has() returns true if the service exists'); $this->assertTrue($sc->has('bar'), '->has() returns true if a get*Method() is defined'); @@ -316,15 +322,15 @@ public function testLegacyHas() } public function testScalarService() { - $c = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container(); + $c = new Container(); $c->set('foo', 'some value'); $this->assertTrue($c->has('foo')); $this->assertSame('some value', $c->get('foo')); } public function testInitialized() { - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\ProjectServiceContainer(); - $sc->set('foo', new \stdClass()); + $sc = new ProjectServiceContainer(); + $sc->set('foo', new stdClass()); $this->assertTrue($sc->initialized('foo'), '->initialized() returns true if service is loaded'); $this->assertFalse($sc->initialized('foo1'), '->initialized() returns false if service is not loaded'); $this->assertFalse($sc->initialized('bar'), '->initialized() returns false if a service is defined, but not currently loaded'); @@ -338,25 +344,25 @@ public function testInitialized() */ public function testInitializedWithPrivateService() { - $sc = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\ProjectServiceContainer(); + $sc = new ProjectServiceContainer(); $sc->get('internal_dependency'); $this->assertTrue($sc->initialized('internal')); } public function testReset() { - $c = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container(); - $c->set('bar', new \stdClass()); + $c = new Container(); + $c->set('bar', new stdClass()); $c->reset(); - $this->assertNull($c->get('bar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::NULL_ON_INVALID_REFERENCE)); + $this->assertNull($c->get('bar', ContainerInterface::NULL_ON_INVALID_REFERENCE)); } public function testGetThrowsException() { $this->expectException('Exception'); $this->expectExceptionMessage('Something went terribly wrong!'); - $c = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\ProjectServiceContainer(); + $c = new ProjectServiceContainer(); try { $c->get('throw_exception'); - } catch (\Exception $e) { + } catch (Exception $e) { // Do nothing. } // Retry, to make sure that get*Service() will be called. @@ -364,36 +370,36 @@ public function testGetThrowsException() } public function testGetThrowsExceptionOnServiceConfiguration() { - $c = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\ProjectServiceContainer(); + $c = new ProjectServiceContainer(); try { $c->get('throws_exception_on_service_configuration'); - } catch (\Exception $e) { + } catch (Exception $e) { // Do nothing. } $this->assertFalse($c->initialized('throws_exception_on_service_configuration')); // Retry, to make sure that get*Service() will be called. try { $c->get('throws_exception_on_service_configuration'); - } catch (\Exception $e) { + } catch (Exception $e) { // Do nothing. } $this->assertFalse($c->initialized('throws_exception_on_service_configuration')); } protected function getField($obj, $field) { - $reflection = new \ReflectionProperty($obj, $field); - $reflection->setAccessible(\true); + $reflection = new ReflectionProperty($obj, $field); + $reflection->setAccessible(true); return $reflection->getValue($obj); } public function testAlias() { - $c = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\ProjectServiceContainer(); + $c = new ProjectServiceContainer(); $this->assertTrue($c->has('alias')); $this->assertSame($c->get('alias'), $c->get('bar')); } public function testThatCloningIsNotSupported() { - $class = new \ReflectionClass('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Container'); + $class = new ReflectionClass('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Container'); $clone = $class->getMethod('__clone'); $this->assertFalse($class->isCloneable()); $this->assertTrue($clone->isPrivate()); @@ -404,7 +410,7 @@ public function testThatCloningIsNotSupported() */ public function testUnsetInternalPrivateServiceIsDeprecated() { - $c = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\ProjectServiceContainer(); + $c = new ProjectServiceContainer(); $c->set('internal', null); } /** @@ -413,8 +419,8 @@ public function testUnsetInternalPrivateServiceIsDeprecated() */ public function testChangeInternalPrivateServiceIsDeprecated() { - $c = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\ProjectServiceContainer(); - $c->set('internal', $internal = new \stdClass()); + $c = new ProjectServiceContainer(); + $c->set('internal', $internal = new stdClass()); $this->assertSame($c->get('internal'), $internal); } /** @@ -423,7 +429,7 @@ public function testChangeInternalPrivateServiceIsDeprecated() */ public function testCheckExistenceOfAnInternalPrivateServiceIsDeprecated() { - $c = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\ProjectServiceContainer(); + $c = new ProjectServiceContainer(); $c->get('internal_dependency'); $this->assertTrue($c->has('internal')); } @@ -433,7 +439,7 @@ public function testCheckExistenceOfAnInternalPrivateServiceIsDeprecated() */ public function testRequestAnInternalSharedPrivateServiceIsDeprecated() { - $c = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\ProjectServiceContainer(); + $c = new ProjectServiceContainer(); $c->get('internal_dependency'); $c->get('internal'); } @@ -443,9 +449,9 @@ public function testRequestAnInternalSharedPrivateServiceIsDeprecated() */ public function testReplacingAPreDefinedServiceIsDeprecated() { - $c = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\ProjectServiceContainer(); - $c->set('bar', new \stdClass()); - $c->set('bar', $bar = new \stdClass()); + $c = new ProjectServiceContainer(); + $c->set('bar', new stdClass()); + $c->set('bar', $bar = new stdClass()); $this->assertSame($bar, $c->get('bar'), '->set() replaces a pre-defined service'); } /** @@ -454,11 +460,11 @@ public function testReplacingAPreDefinedServiceIsDeprecated() */ public function testSetWithPrivateSyntheticServiceThrowsDeprecation() { - $c = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\ProjectServiceContainer(); - $c->set('synthetic', new \stdClass()); + $c = new ProjectServiceContainer(); + $c->set('synthetic', new stdClass()); } } -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class ProjectServiceContainer extends Container { public $__bar; public $__foo_bar; @@ -469,13 +475,13 @@ class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component public function __construct() { parent::__construct(); - $this->__bar = new \stdClass(); - $this->__foo_bar = new \stdClass(); - $this->__foo_baz = new \stdClass(); - $this->__internal = new \stdClass(); - $this->privates = ['internal' => \true, 'synthetic' => \true]; + $this->__bar = new stdClass(); + $this->__foo_bar = new stdClass(); + $this->__foo_baz = new stdClass(); + $this->__internal = new stdClass(); + $this->privates = ['internal' => true, 'synthetic' => true]; $this->aliases = ['alias' => 'bar']; - $this->syntheticIds['synthetic'] = \true; + $this->syntheticIds['synthetic'] = true; } protected function getInternalService() { @@ -499,21 +505,21 @@ protected function getCircularService() } protected function getThrowExceptionService() { - throw new \Exception('Something went terribly wrong!'); + throw new Exception('Something went terribly wrong!'); } protected function getThrowsExceptionOnServiceConfigurationService() { - $this->services['throws_exception_on_service_configuration'] = $instance = new \stdClass(); - throw new \Exception('Something was terribly wrong while trying to configure the service!'); + $this->services['throws_exception_on_service_configuration'] = $instance = new stdClass(); + throw new Exception('Something was terribly wrong while trying to configure the service!'); } protected function getInternalDependencyService() { - $this->services['internal_dependency'] = $instance = new \stdClass(); + $this->services['internal_dependency'] = $instance = new stdClass(); $instance->internal = isset($this->services['internal']) ? $this->services['internal'] : $this->getInternalService(); return $instance; } } -class LegacyProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class LegacyProjectServiceContainer extends Container { public $__bar; public $__foo_bar; @@ -522,11 +528,11 @@ class LegacyProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Com public function __construct() { parent::__construct(); - $this->__bar = new \stdClass(); - $this->__foo_bar = new \stdClass(); - $this->__foo_baz = new \stdClass(); - $this->__internal = new \stdClass(); - $this->privates = ['internal' => \true]; + $this->__bar = new stdClass(); + $this->__foo_bar = new stdClass(); + $this->__foo_baz = new stdClass(); + $this->__internal = new stdClass(); + $this->privates = ['internal' => true]; $this->aliases = ['alias' => 'bar']; } protected function getInternalService() @@ -551,11 +557,11 @@ protected function getCircularService() } protected function getThrowExceptionService() { - throw new \Exception('Something went terribly wrong!'); + throw new Exception('Something went terribly wrong!'); } protected function getThrowsExceptionOnServiceConfigurationService() { - $this->services['throws_exception_on_service_configuration'] = $instance = new \stdClass(); - throw new \Exception('Something was terribly wrong while trying to configure the service!'); + $this->services['throws_exception_on_service_configuration'] = $instance = new stdClass(); + throw new Exception('Something was terribly wrong while trying to configure the service!'); } } diff --git a/vendor/symfony/dependency-injection/Tests/CrossCheckTest.php b/vendor/symfony/dependency-injection/Tests/CrossCheckTest.php index f8458911c..1286837cb 100644 --- a/vendor/symfony/dependency-injection/Tests/CrossCheckTest.php +++ b/vendor/symfony/dependency-injection/Tests/CrossCheckTest.php @@ -13,7 +13,16 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; -class CrossCheckTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use ReflectionProperty; +use function copy; +use function file_put_contents; +use function serialize; +use function sys_get_temp_dir; +use function tempnam; +use function ucfirst; +use function unlink; + +class CrossCheckTest extends TestCase { protected static $fixturesPath; public static function setUpBeforeClass() @@ -27,34 +36,34 @@ public static function setUpBeforeClass() */ public function testCrossCheck($fixture, $type) { - $loaderClass = 'Symfony\\Component\\DependencyInjection\\Loader\\' . \ucfirst($type) . 'FileLoader'; - $dumperClass = 'Symfony\\Component\\DependencyInjection\\Dumper\\' . \ucfirst($type) . 'Dumper'; - $tmp = \tempnam(\sys_get_temp_dir(), 'sf'); - \copy(self::$fixturesPath . '/' . $type . '/' . $fixture, $tmp); - $container1 = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader1 = new $loaderClass($container1, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator()); + $loaderClass = 'Symfony\\Component\\DependencyInjection\\Loader\\' . ucfirst($type) . 'FileLoader'; + $dumperClass = 'Symfony\\Component\\DependencyInjection\\Dumper\\' . ucfirst($type) . 'Dumper'; + $tmp = tempnam(sys_get_temp_dir(), 'sf'); + copy(self::$fixturesPath . '/' . $type . '/' . $fixture, $tmp); + $container1 = new ContainerBuilder(); + $loader1 = new $loaderClass($container1, new FileLocator()); $loader1->load($tmp); $dumper = new $dumperClass($container1); - \file_put_contents($tmp, $dumper->dump()); - $container2 = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader2 = new $loaderClass($container2, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator()); + file_put_contents($tmp, $dumper->dump()); + $container2 = new ContainerBuilder(); + $loader2 = new $loaderClass($container2, new FileLocator()); $loader2->load($tmp); - \unlink($tmp); + unlink($tmp); $this->assertEquals($container2->getAliases(), $container1->getAliases(), 'loading a dump from a previously loaded container returns the same container'); $this->assertEquals($container2->getDefinitions(), $container1->getDefinitions(), 'loading a dump from a previously loaded container returns the same container'); $this->assertEquals($container2->getParameterBag()->all(), $container1->getParameterBag()->all(), '->getParameterBag() returns the same value for both containers'); - $r = new \ReflectionProperty(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder::class, 'normalizedIds'); - $r->setAccessible(\true); + $r = new ReflectionProperty(ContainerBuilder::class, 'normalizedIds'); + $r->setAccessible(true); $r->setValue($container2, []); $r->setValue($container1, []); - $this->assertEquals(\serialize($container2), \serialize($container1), 'loading a dump from a previously loaded container returns the same container'); + $this->assertEquals(serialize($container2), serialize($container1), 'loading a dump from a previously loaded container returns the same container'); $services1 = []; foreach ($container1 as $id => $service) { - $services1[$id] = \serialize($service); + $services1[$id] = serialize($service); } $services2 = []; foreach ($container2 as $id => $service) { - $services2[$id] = \serialize($service); + $services2[$id] = serialize($service); } unset($services1['service_container'], $services2['service_container']); $this->assertEquals($services2, $services1, 'Iterator on the containers returns the same services'); diff --git a/vendor/symfony/dependency-injection/Tests/DefinitionDecoratorTest.php b/vendor/symfony/dependency-injection/Tests/DefinitionDecoratorTest.php index dd90b625e..45e44c803 100644 --- a/vendor/symfony/dependency-injection/Tests/DefinitionDecoratorTest.php +++ b/vendor/symfony/dependency-injection/Tests/DefinitionDecoratorTest.php @@ -12,14 +12,16 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\DefinitionDecorator; +use function ucfirst; + /** * @group legacy */ -class DefinitionDecoratorTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class DefinitionDecoratorTest extends TestCase { public function testConstructor() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\DefinitionDecorator('foo'); + $def = new DefinitionDecorator('foo'); $this->assertEquals('foo', $def->getParent()); $this->assertEquals([], $def->getChanges()); } @@ -28,13 +30,13 @@ public function testConstructor() */ public function testSetProperty($property, $changeKey) { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\DefinitionDecorator('foo'); - $getter = 'get' . \ucfirst($property); - $setter = 'set' . \ucfirst($property); + $def = new DefinitionDecorator('foo'); + $getter = 'get' . ucfirst($property); + $setter = 'set' . ucfirst($property); $this->assertNull($def->{$getter}()); $this->assertSame($def, $def->{$setter}('foo')); $this->assertEquals('foo', $def->{$getter}()); - $this->assertEquals([$changeKey => \true], $def->getChanges()); + $this->assertEquals([$changeKey => true], $def->getChanges()); } public function getPropertyTests() { @@ -42,31 +44,31 @@ public function getPropertyTests() } public function testSetPublic() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\DefinitionDecorator('foo'); + $def = new DefinitionDecorator('foo'); $this->assertTrue($def->isPublic()); - $this->assertSame($def, $def->setPublic(\false)); + $this->assertSame($def, $def->setPublic(false)); $this->assertFalse($def->isPublic()); - $this->assertEquals(['public' => \true], $def->getChanges()); + $this->assertEquals(['public' => true], $def->getChanges()); } public function testSetLazy() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\DefinitionDecorator('foo'); + $def = new DefinitionDecorator('foo'); $this->assertFalse($def->isLazy()); - $this->assertSame($def, $def->setLazy(\false)); + $this->assertSame($def, $def->setLazy(false)); $this->assertFalse($def->isLazy()); - $this->assertEquals(['lazy' => \true], $def->getChanges()); + $this->assertEquals(['lazy' => true], $def->getChanges()); } public function testSetAutowired() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\DefinitionDecorator('foo'); + $def = new DefinitionDecorator('foo'); $this->assertFalse($def->isAutowired()); - $this->assertSame($def, $def->setAutowired(\true)); + $this->assertSame($def, $def->setAutowired(true)); $this->assertTrue($def->isAutowired()); - $this->assertSame(['autowired' => \true], $def->getChanges()); + $this->assertSame(['autowired' => true], $def->getChanges()); } public function testSetArgument() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\DefinitionDecorator('foo'); + $def = new DefinitionDecorator('foo'); $this->assertEquals([], $def->getArguments()); $this->assertSame($def, $def->replaceArgument(0, 'foo')); $this->assertEquals(['index_0' => 'foo'], $def->getArguments()); @@ -74,12 +76,12 @@ public function testSetArgument() public function testReplaceArgumentShouldRequireIntegerIndex() { $this->expectException('InvalidArgumentException'); - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\DefinitionDecorator('foo'); + $def = new DefinitionDecorator('foo'); $def->replaceArgument('0', 'foo'); } public function testReplaceArgument() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\DefinitionDecorator('foo'); + $def = new DefinitionDecorator('foo'); $def->setArguments([0 => 'foo', 1 => 'bar']); $this->assertEquals('foo', $def->getArgument(0)); $this->assertEquals('bar', $def->getArgument(1)); @@ -91,7 +93,7 @@ public function testReplaceArgument() public function testGetArgumentShouldCheckBounds() { $this->expectException('OutOfBoundsException'); - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\DefinitionDecorator('foo'); + $def = new DefinitionDecorator('foo'); $def->setArguments([0 => 'foo']); $def->replaceArgument(0, 'foo'); $def->getArgument(1); diff --git a/vendor/symfony/dependency-injection/Tests/DefinitionTest.php b/vendor/symfony/dependency-injection/Tests/DefinitionTest.php index 49825bd66..8b40d48eb 100644 --- a/vendor/symfony/dependency-injection/Tests/DefinitionTest.php +++ b/vendor/symfony/dependency-injection/Tests/DefinitionTest.php @@ -12,58 +12,58 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; -class DefinitionTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class DefinitionTest extends TestCase { public function testConstructor() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $this->assertEquals('stdClass', $def->getClass(), '__construct() takes the class name as its first argument'); - $this->assertSame(['class' => \true], $def->getChanges()); - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass', ['foo']); + $this->assertSame(['class' => true], $def->getChanges()); + $def = new Definition('stdClass', ['foo']); $this->assertEquals(['foo'], $def->getArguments(), '__construct() takes an optional array of arguments as its second argument'); } public function testSetGetFactory() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(); + $def = new Definition(); $this->assertSame($def, $def->setFactory('foo'), '->setFactory() implements a fluent interface'); $this->assertEquals('foo', $def->getFactory(), '->getFactory() returns the factory'); $def->setFactory('Foo::bar'); $this->assertEquals(['Foo', 'bar'], $def->getFactory(), '->setFactory() converts string static method call to the array'); - $this->assertSame(['factory' => \true], $def->getChanges()); + $this->assertSame(['factory' => true], $def->getChanges()); } public function testSetGetClass() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $this->assertSame($def, $def->setClass('foo'), '->setClass() implements a fluent interface'); $this->assertEquals('foo', $def->getClass(), '->getClass() returns the class name'); } public function testSetGetDecoratedService() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $this->assertNull($def->getDecoratedService()); $def->setDecoratedService('foo', 'foo.renamed', 5); $this->assertEquals(['foo', 'foo.renamed', 5], $def->getDecoratedService()); $def->setDecoratedService(null); $this->assertNull($def->getDecoratedService()); - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $this->assertNull($def->getDecoratedService()); $def->setDecoratedService('foo', 'foo.renamed'); $this->assertEquals(['foo', 'foo.renamed', 0], $def->getDecoratedService()); $def->setDecoratedService(null); $this->assertNull($def->getDecoratedService()); - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $def->setDecoratedService('foo'); $this->assertEquals(['foo', null, 0], $def->getDecoratedService()); $def->setDecoratedService(null); $this->assertNull($def->getDecoratedService()); - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $this->expectException('InvalidArgumentException'); $this->expectExceptionMessage('The decorated service inner name for "foo" must be different than the service name itself.'); $def->setDecoratedService('foo', 'foo'); } public function testArguments() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $this->assertSame($def, $def->setArguments(['foo']), '->setArguments() implements a fluent interface'); $this->assertEquals(['foo'], $def->getArguments(), '->getArguments() returns the arguments'); $this->assertSame($def, $def->addArgument('bar'), '->addArgument() implements a fluent interface'); @@ -71,7 +71,7 @@ public function testArguments() } public function testMethodCalls() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $this->assertSame($def, $def->setMethodCalls([['foo', ['foo']]]), '->setMethodCalls() implements a fluent interface'); $this->assertEquals([['foo', ['foo']]], $def->getMethodCalls(), '->getMethodCalls() returns the methods to call'); $this->assertSame($def, $def->addMethodCall('bar', ['bar']), '->addMethodCall() implements a fluent interface'); @@ -85,55 +85,55 @@ public function testExceptionOnEmptyMethodCall() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('Method name cannot be empty.'); - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $def->addMethodCall(''); } public function testSetGetFile() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $this->assertSame($def, $def->setFile('foo'), '->setFile() implements a fluent interface'); $this->assertEquals('foo', $def->getFile(), '->getFile() returns the file to include'); } public function testSetIsShared() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $this->assertTrue($def->isShared(), '->isShared() returns true by default'); - $this->assertSame($def, $def->setShared(\false), '->setShared() implements a fluent interface'); + $this->assertSame($def, $def->setShared(false), '->setShared() implements a fluent interface'); $this->assertFalse($def->isShared(), '->isShared() returns false if the instance must not be shared'); } public function testSetIsPublic() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $this->assertTrue($def->isPublic(), '->isPublic() returns true by default'); - $this->assertSame($def, $def->setPublic(\false), '->setPublic() implements a fluent interface'); + $this->assertSame($def, $def->setPublic(false), '->setPublic() implements a fluent interface'); $this->assertFalse($def->isPublic(), '->isPublic() returns false if the instance must not be public.'); } public function testSetIsSynthetic() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $this->assertFalse($def->isSynthetic(), '->isSynthetic() returns false by default'); - $this->assertSame($def, $def->setSynthetic(\true), '->setSynthetic() implements a fluent interface'); + $this->assertSame($def, $def->setSynthetic(true), '->setSynthetic() implements a fluent interface'); $this->assertTrue($def->isSynthetic(), '->isSynthetic() returns true if the service is synthetic.'); } public function testSetIsLazy() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $this->assertFalse($def->isLazy(), '->isLazy() returns false by default'); - $this->assertSame($def, $def->setLazy(\true), '->setLazy() implements a fluent interface'); + $this->assertSame($def, $def->setLazy(true), '->setLazy() implements a fluent interface'); $this->assertTrue($def->isLazy(), '->isLazy() returns true if the service is lazy.'); } public function testSetIsAbstract() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $this->assertFalse($def->isAbstract(), '->isAbstract() returns false by default'); - $this->assertSame($def, $def->setAbstract(\true), '->setAbstract() implements a fluent interface'); + $this->assertSame($def, $def->setAbstract(true), '->setAbstract() implements a fluent interface'); $this->assertTrue($def->isAbstract(), '->isAbstract() returns true if the instance must not be public.'); } public function testSetIsDeprecated() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $this->assertFalse($def->isDeprecated(), '->isDeprecated() returns false by default'); - $this->assertSame($def, $def->setDeprecated(\true), '->setDeprecated() implements a fluent interface'); + $this->assertSame($def, $def->setDeprecated(true), '->setDeprecated() implements a fluent interface'); $this->assertTrue($def->isDeprecated(), '->isDeprecated() returns true if the instance should not be used anymore.'); $this->assertSame('The "deprecated_service" service is deprecated. You should stop using it, as it will soon be removed.', $def->getDeprecationMessage('deprecated_service'), '->getDeprecationMessage() should return a formatted message template'); } @@ -143,8 +143,8 @@ public function testSetIsDeprecated() public function testSetDeprecatedWithInvalidDeprecationTemplate($message) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); - $def->setDeprecated(\false, $message); + $def = new Definition('stdClass'); + $def->setDeprecated(false, $message); } public function invalidDeprecationMessageProvider() { @@ -152,13 +152,13 @@ public function invalidDeprecationMessageProvider() } public function testSetGetConfigurator() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $this->assertSame($def, $def->setConfigurator('foo'), '->setConfigurator() implements a fluent interface'); $this->assertEquals('foo', $def->getConfigurator(), '->getConfigurator() returns the configurator'); } public function testClearTags() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $this->assertSame($def, $def->clearTags(), '->clearTags() implements a fluent interface'); $def->addTag('foo', ['foo' => 'bar']); $def->clearTags(); @@ -166,7 +166,7 @@ public function testClearTags() } public function testClearTag() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $this->assertSame($def, $def->clearTags(), '->clearTags() implements a fluent interface'); $def->addTag('1foo1', ['foo1' => 'bar1']); $def->addTag('2foo2', ['foo2' => 'bar2']); @@ -181,7 +181,7 @@ public function testClearTag() } public function testTags() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $this->assertEquals([], $def->getTag('foo'), '->getTag() returns an empty array if the tag is not defined'); $this->assertFalse($def->hasTag('foo')); $this->assertSame($def, $def->addTag('foo'), '->addTag() implements a fluent interface'); @@ -194,7 +194,7 @@ public function testTags() } public function testSetArgument() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $def->addArgument('foo'); $this->assertSame(['foo'], $def->getArguments()); $this->assertSame($def, $def->replaceArgument(0, 'moo')); @@ -206,7 +206,7 @@ public function testSetArgument() public function testGetArgumentShouldCheckBounds() { $this->expectException('OutOfBoundsException'); - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $def->addArgument('foo'); $def->getArgument(1); } @@ -214,7 +214,7 @@ public function testReplaceArgumentShouldCheckBounds() { $this->expectException('OutOfBoundsException'); $this->expectExceptionMessage('The index "1" is not in the range [0, 0].'); - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $def->addArgument('foo'); $def->replaceArgument(1, 'bar'); } @@ -222,58 +222,58 @@ public function testReplaceArgumentWithoutExistingArgumentsShouldCheckBounds() { $this->expectException('OutOfBoundsException'); $this->expectExceptionMessage('Cannot replace arguments if none have been configured yet.'); - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $def->replaceArgument(0, 'bar'); } public function testSetGetProperties() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $this->assertEquals([], $def->getProperties()); $this->assertSame($def, $def->setProperties(['foo' => 'bar'])); $this->assertEquals(['foo' => 'bar'], $def->getProperties()); } public function testSetProperty() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $this->assertEquals([], $def->getProperties()); $this->assertSame($def, $def->setProperty('foo', 'bar')); $this->assertEquals(['foo' => 'bar'], $def->getProperties()); } public function testAutowired() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $this->assertFalse($def->isAutowired()); - $def->setAutowired(\true); + $def->setAutowired(true); $this->assertTrue($def->isAutowired()); - $def->setAutowired(\false); + $def->setAutowired(false); $this->assertFalse($def->isAutowired()); } public function testChangesNoChanges() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(); + $def = new Definition(); $this->assertSame([], $def->getChanges()); } public function testGetChangesWithChanges() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass', ['fooarg']); - $def->setAbstract(\true); - $def->setAutowired(\true); + $def = new Definition('stdClass', ['fooarg']); + $def->setAbstract(true); + $def->setAutowired(true); $def->setConfigurator('configuration_func'); $def->setDecoratedService(null); - $def->setDeprecated(\true); + $def->setDeprecated(true); $def->setFactory('factory_func'); $def->setFile('foo.php'); - $def->setLazy(\true); - $def->setPublic(\true); - $def->setShared(\true); - $def->setSynthetic(\true); + $def->setLazy(true); + $def->setPublic(true); + $def->setShared(true); + $def->setSynthetic(true); // changes aren't tracked for these, class or arguments $def->setInstanceofConditionals([]); $def->addTag('foo_tag'); $def->addMethodCall('methodCall'); - $def->setProperty('fooprop', \true); - $def->setAutoconfigured(\true); - $this->assertSame(['class' => \true, 'autowired' => \true, 'configurator' => \true, 'decorated_service' => \true, 'deprecated' => \true, 'factory' => \true, 'file' => \true, 'lazy' => \true, 'public' => \true, 'shared' => \true, 'autoconfigured' => \true], $def->getChanges()); + $def->setProperty('fooprop', true); + $def->setAutoconfigured(true); + $this->assertSame(['class' => true, 'autowired' => true, 'configurator' => true, 'decorated_service' => true, 'deprecated' => true, 'factory' => true, 'file' => true, 'lazy' => true, 'public' => true, 'shared' => true, 'autoconfigured' => true], $def->getChanges()); $def->setChanges([]); $this->assertSame([], $def->getChanges()); } @@ -282,7 +282,7 @@ public function testGetChangesWithChanges() */ public function testTypes() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $this->assertEquals([], $def->getAutowiringTypes()); $this->assertSame($def, $def->setAutowiringTypes(['Foo'])); $this->assertEquals(['Foo'], $def->getAutowiringTypes()); @@ -293,14 +293,14 @@ public function testTypes() } public function testShouldAutoconfigure() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $this->assertFalse($def->isAutoconfigured()); - $def->setAutoconfigured(\true); + $def->setAutoconfigured(true); $this->assertTrue($def->isAutoconfigured()); } public function testAddError() { - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $def = new Definition('stdClass'); $this->assertEmpty($def->getErrors()); $def->addError('First error'); $def->addError('Second error'); diff --git a/vendor/symfony/dependency-injection/Tests/Dumper/GraphvizDumperTest.php b/vendor/symfony/dependency-injection/Tests/Dumper/GraphvizDumperTest.php index f1191094d..7cb03656b 100644 --- a/vendor/symfony/dependency-injection/Tests/Dumper/GraphvizDumperTest.php +++ b/vendor/symfony/dependency-injection/Tests/Dumper/GraphvizDumperTest.php @@ -15,7 +15,9 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\GraphvizDumper; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; -class GraphvizDumperTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use function file_get_contents; + +class GraphvizDumperTest extends TestCase { protected static $fixturesPath; public static function setUpBeforeClass() @@ -24,42 +26,42 @@ public static function setUpBeforeClass() } public function testDump() { - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\GraphvizDumper($container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder()); + $dumper = new GraphvizDumper($container = new ContainerBuilder()); $this->assertStringEqualsFile(self::$fixturesPath . '/graphviz/services1.dot', $dumper->dump(), '->dump() dumps an empty container as an empty dot file'); $container = (include self::$fixturesPath . '/containers/container9.php'); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\GraphvizDumper($container); + $dumper = new GraphvizDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/graphviz/services9.dot', $dumper->dump(), '->dump() dumps services'); $container = (include self::$fixturesPath . '/containers/container10.php'); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\GraphvizDumper($container); + $dumper = new GraphvizDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/graphviz/services10.dot', $dumper->dump(), '->dump() dumps services'); $container = (include self::$fixturesPath . '/containers/container10.php'); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\GraphvizDumper($container); - $this->assertEquals($dumper->dump(['graph' => ['ratio' => 'normal'], 'node' => ['fontsize' => 13, 'fontname' => 'Verdana', 'shape' => 'square'], 'edge' => ['fontsize' => 12, 'fontname' => 'Verdana', 'color' => 'white', 'arrowhead' => 'closed', 'arrowsize' => 1], 'node.instance' => ['fillcolor' => 'green', 'style' => 'empty'], 'node.definition' => ['fillcolor' => 'grey'], 'node.missing' => ['fillcolor' => 'red', 'style' => 'empty']]), \file_get_contents(self::$fixturesPath . '/graphviz/services10-1.dot'), '->dump() dumps services'); + $dumper = new GraphvizDumper($container); + $this->assertEquals($dumper->dump(['graph' => ['ratio' => 'normal'], 'node' => ['fontsize' => 13, 'fontname' => 'Verdana', 'shape' => 'square'], 'edge' => ['fontsize' => 12, 'fontname' => 'Verdana', 'color' => 'white', 'arrowhead' => 'closed', 'arrowsize' => 1], 'node.instance' => ['fillcolor' => 'green', 'style' => 'empty'], 'node.definition' => ['fillcolor' => 'grey'], 'node.missing' => ['fillcolor' => 'red', 'style' => 'empty']]), file_get_contents(self::$fixturesPath . '/graphviz/services10-1.dot'), '->dump() dumps services'); } public function testDumpWithFrozenContainer() { $container = (include self::$fixturesPath . '/containers/container13.php'); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\GraphvizDumper($container); + $dumper = new GraphvizDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/graphviz/services13.dot', $dumper->dump(), '->dump() dumps services'); } public function testDumpWithFrozenCustomClassContainer() { $container = (include self::$fixturesPath . '/containers/container14.php'); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\GraphvizDumper($container); + $dumper = new GraphvizDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/graphviz/services14.dot', $dumper->dump(), '->dump() dumps services'); } public function testDumpWithUnresolvedParameter() { $container = (include self::$fixturesPath . '/containers/container17.php'); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\GraphvizDumper($container); + $dumper = new GraphvizDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/graphviz/services17.dot', $dumper->dump(), '->dump() dumps services'); } public function testDumpWithInlineDefinition() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', 'stdClass')->addArgument((new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'))->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar'))); + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass')->addArgument((new Definition('stdClass'))->addArgument(new Reference('bar'))); $container->register('bar', 'stdClass'); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\GraphvizDumper($container); + $dumper = new GraphvizDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/graphviz/services_inline.dot', $dumper->dump(), '->dump() dumps nested references'); } } diff --git a/vendor/symfony/dependency-injection/Tests/Dumper/PhpDumperTest.php b/vendor/symfony/dependency-injection/Tests/Dumper/PhpDumperTest.php index 8810a6dee..a13f32691 100644 --- a/vendor/symfony/dependency-injection/Tests/Dumper/PhpDumperTest.php +++ b/vendor/symfony/dependency-injection/Tests/Dumper/PhpDumperTest.php @@ -10,7 +10,9 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Dumper; +use _PhpScoper5ea00cc67502b\DummyProxyDumper; use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; +use _PhpScoper5ea00cc67502b\ProjectServiceContainer; use _PhpScoper5ea00cc67502b\Psr\Container\ContainerInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument; @@ -35,80 +37,116 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Variable; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression; +use _PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_AliasesCanBeFoundInTheDumpedContainer; +use _PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Aliases; +use _PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Base64Parameters; +use _PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Deep_Graph; +use _PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_EnvParameters; +use _PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Frozen_No_Aliases; +use _PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Lazy_Argument_Provide_Generator; +use _PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Legacy_Privates; +use _PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Literal_Class_With_Root_Namespace; +use _PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Object_Class_Name; +use _PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Parameter_With_Lower_Case; +use _PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Parameter_With_Mixed_Case; +use _PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Private_Service_Triggers_Deprecation; +use _PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Private_With_Ignore_On_Invalid_Reference; +use _PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Properties_Before_Method_Calls; +use _PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Reference_With_Lower_Case_Id; +use _PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Rot13Parameters; +use _PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Scalar_Service; +use _PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Uninitialized_Reference; +use _PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_UninitializedSyntheticReference; +use Closure; +use Exception; +use stdClass; +use function base64_encode; +use function dirname; +use function iterator_to_array; +use function method_exists; +use function mt_rand; +use function print_r; +use function putenv; +use function realpath; +use function str_replace; +use function str_rot13; +use function ucfirst; +use const DIRECTORY_SEPARATOR; + require_once __DIR__ . '/../Fixtures/includes/classes.php'; -class PhpDumperTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class PhpDumperTest extends TestCase { protected static $fixturesPath; public static function setUpBeforeClass() { - self::$fixturesPath = \realpath(__DIR__ . '/../Fixtures/'); + self::$fixturesPath = realpath(__DIR__ . '/../Fixtures/'); } public function testDump() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services1.php', $dumper->dump(), '->dump() dumps an empty container as an empty PHP class'); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services1-1.php', $dumper->dump(['class' => 'Container', 'base_class' => 'AbstractContainer', 'namespace' => '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Dump']), '->dump() takes a class and a base_class options'); } public function testDumpOptimizationString() { - $definition = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(); + $definition = new Definition(); $definition->setClass('stdClass'); $definition->addArgument(['only dot' => '.', 'concatenation as value' => '.\'\'.', 'concatenation from the start value' => '\'\'.', '.' => 'dot as a key', '.\'\'.' => 'concatenation as a key', '\'\'.' => 'concatenation from the start key', 'optimize concatenation' => 'string1%some_string%string2', 'optimize concatenation with empty string' => 'string1%empty_value%string2', 'optimize concatenation from the start' => '%empty_value%start', 'optimize concatenation at the end' => 'end%empty_value%', 'new line' => "string with \nnew line"]); - $definition->setPublic(\true); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->setResourceTracking(\false); + $definition->setPublic(true); + $container = new ContainerBuilder(); + $container->setResourceTracking(false); $container->setDefinition('test', $definition); $container->setParameter('empty_value', ''); $container->setParameter('some_string', '-'); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services10.php', $dumper->dump(), '->dump() dumps an empty container as an empty PHP class'); } public function testDumpRelativeDir() { - $definition = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(); + $definition = new Definition(); $definition->setClass('stdClass'); $definition->addArgument('%foo%'); $definition->addArgument(['%foo%' => '%buz%/']); - $definition->setPublic(\true); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $definition->setPublic(true); + $container = new ContainerBuilder(); $container->setDefinition('test', $definition); - $container->setParameter('foo', 'wiz' . \dirname(__DIR__)); + $container->setParameter('foo', 'wiz' . dirname(__DIR__)); $container->setParameter('bar', __DIR__); $container->setParameter('baz', '%bar%/PhpDumperTest.php'); - $container->setParameter('buz', \dirname(\dirname(__DIR__))); + $container->setParameter('buz', dirname(dirname(__DIR__))); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services12.php', $dumper->dump(['file' => __FILE__]), '->dump() dumps __DIR__ relative strings'); } public function testDumpCustomContainerClassWithoutConstructor() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/php/custom_container_class_without_constructor.php', $dumper->dump(['base_class' => 'NoConstructorContainer', 'namespace' => '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Container'])); } public function testDumpCustomContainerClassConstructorWithoutArguments() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/php/custom_container_class_constructor_without_arguments.php', $dumper->dump(['base_class' => 'ConstructorWithoutArgumentsContainer', 'namespace' => '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Container'])); } public function testDumpCustomContainerClassWithOptionalArgumentLessConstructor() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/php/custom_container_class_with_optional_constructor_arguments.php', $dumper->dump(['base_class' => 'ConstructorWithOptionalArgumentsContainer', 'namespace' => '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Container'])); } public function testDumpCustomContainerClassWithMandatoryArgumentLessConstructor() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/php/custom_container_class_with_mandatory_constructor_arguments.php', $dumper->dump(['base_class' => 'ConstructorWithMandatoryArgumentsContainer', 'namespace' => '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Container'])); } /** @@ -117,20 +155,20 @@ public function testDumpCustomContainerClassWithMandatoryArgumentLessConstructor public function testExportParameters($parameters) { $this->expectException('InvalidArgumentException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag($parameters)); + $container = new ContainerBuilder(new ParameterBag($parameters)); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $dumper->dump(); } public function provideInvalidParameters() { - return [[['foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass')]], [['foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')]], [['foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo')]], [['foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Variable('foo')]]]; + return [[['foo' => new Definition('stdClass')]], [['foo' => new Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')]], [['foo' => new Reference('foo')]], [['foo' => new Variable('foo')]]]; } public function testAddParameters() { $container = (include self::$fixturesPath . '/containers/container8.php'); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services8.php', $dumper->dump(), '->dump() dumps parameters'); } /** @@ -140,23 +178,23 @@ public function testAddParameters() public function testAddServiceWithoutCompilation() { $container = (include self::$fixturesPath . '/containers/container9.php'); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); - $this->assertStringEqualsFile(self::$fixturesPath . '/php/services9.php', \str_replace(\str_replace('\\', '\\\\', self::$fixturesPath . \DIRECTORY_SEPARATOR . 'includes' . \DIRECTORY_SEPARATOR), '%path%', $dumper->dump()), '->dump() dumps services'); + $dumper = new PhpDumper($container); + $this->assertStringEqualsFile(self::$fixturesPath . '/php/services9.php', str_replace(str_replace('\\', '\\\\', self::$fixturesPath . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR), '%path%', $dumper->dump()), '->dump() dumps services'); } public function testAddService() { $container = (include self::$fixturesPath . '/containers/container9.php'); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); - $this->assertStringEqualsFile(self::$fixturesPath . '/php/services9_compiled.php', \str_replace(\str_replace('\\', '\\\\', self::$fixturesPath . \DIRECTORY_SEPARATOR . 'includes' . \DIRECTORY_SEPARATOR), '%path%', $dumper->dump()), '->dump() dumps services'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', 'FooClass')->addArgument(new \stdClass())->setPublic(\true); + $dumper = new PhpDumper($container); + $this->assertStringEqualsFile(self::$fixturesPath . '/php/services9_compiled.php', str_replace(str_replace('\\', '\\\\', self::$fixturesPath . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR), '%path%', $dumper->dump()), '->dump() dumps services'); + $container = new ContainerBuilder(); + $container->register('foo', 'FooClass')->addArgument(new stdClass())->setPublic(true); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); try { $dumper->dump(); $this->fail('->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException', $e, '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); $this->assertEquals('Unable to dump a service container if a parameter is an object or a resource.', $e->getMessage(), '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); } @@ -166,10 +204,10 @@ public function testDumpAsFiles() $container = (include self::$fixturesPath . '/containers/container9.php'); $container->getDefinition('bar')->addTag('hot'); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); - $dump = \print_r($dumper->dump(['as_files' => \true, 'file' => __DIR__, 'hot_path_tag' => 'hot']), \true); - if ('\\' === \DIRECTORY_SEPARATOR) { - $dump = \str_replace('\\\\Fixtures\\\\includes\\\\foo.php', '/Fixtures/includes/foo.php', $dump); + $dumper = new PhpDumper($container); + $dump = print_r($dumper->dump(['as_files' => true, 'file' => __DIR__, 'hot_path_tag' => 'hot']), true); + if ('\\' === DIRECTORY_SEPARATOR) { + $dump = str_replace('\\\\Fixtures\\\\includes\\\\foo.php', '/Fixtures/includes/foo.php', $dump); } $this->assertStringMatchesFormatFile(self::$fixturesPath . '/php/services9_as_files.txt', $dump); } @@ -177,48 +215,48 @@ public function testServicesWithAnonymousFactories() { $container = (include self::$fixturesPath . '/containers/container19.php'); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services19.php', $dumper->dump(), '->dump() dumps services with anonymous factories'); } public function testAddServiceIdWithUnsupportedCharacters() { $class = 'Symfony_DI_PhpDumper_Test_Unsupported_Characters'; - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->setParameter("'", 'oh-no'); - $container->register('foo*/oh-no', 'FooClass')->setPublic(\true); - $container->register('bar$', 'FooClass')->setPublic(\true); - $container->register('bar$!', 'FooClass')->setPublic(\true); + $container->register('foo*/oh-no', 'FooClass')->setPublic(true); + $container->register('bar$', 'FooClass')->setPublic(true); + $container->register('bar$!', 'FooClass')->setPublic(true); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services_unsupported_characters.php', $dumper->dump(['class' => $class])); require_once self::$fixturesPath . '/php/services_unsupported_characters.php'; - $this->assertTrue(\method_exists($class, 'getFooOhNoService')); - $this->assertTrue(\method_exists($class, 'getBarService')); - $this->assertTrue(\method_exists($class, 'getBar2Service')); + $this->assertTrue(method_exists($class, 'getFooOhNoService')); + $this->assertTrue(method_exists($class, 'getBarService')); + $this->assertTrue(method_exists($class, 'getBar2Service')); } public function testConflictingServiceIds() { $class = 'Symfony_DI_PhpDumper_Test_Conflicting_Service_Ids'; - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo_bar', 'FooClass')->setPublic(\true); - $container->register('foobar', 'FooClass')->setPublic(\true); + $container = new ContainerBuilder(); + $container->register('foo_bar', 'FooClass')->setPublic(true); + $container->register('foobar', 'FooClass')->setPublic(true); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); eval('?>' . $dumper->dump(['class' => $class])); - $this->assertTrue(\method_exists($class, 'getFooBarService')); - $this->assertTrue(\method_exists($class, 'getFoobar2Service')); + $this->assertTrue(method_exists($class, 'getFooBarService')); + $this->assertTrue(method_exists($class, 'getFoobar2Service')); } public function testConflictingMethodsWithParent() { $class = 'Symfony_DI_PhpDumper_Test_Conflicting_Method_With_Parent'; - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('bar', 'FooClass')->setPublic(\true); - $container->register('foo_bar', 'FooClass')->setPublic(\true); + $container = new ContainerBuilder(); + $container->register('bar', 'FooClass')->setPublic(true); + $container->register('foo_bar', 'FooClass')->setPublic(true); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); eval('?>' . $dumper->dump(['class' => $class, 'base_class' => '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\containers\\CustomContainer'])); - $this->assertTrue(\method_exists($class, 'getBar2Service')); - $this->assertTrue(\method_exists($class, 'getFoobar2Service')); + $this->assertTrue(method_exists($class, 'getBar2Service')); + $this->assertTrue(method_exists($class, 'getFoobar2Service')); } /** * @dataProvider provideInvalidFactories @@ -227,13 +265,13 @@ public function testInvalidFactories($factory) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); $this->expectExceptionMessage('Cannot dump definition'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $def = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); - $def->setPublic(\true); + $container = new ContainerBuilder(); + $def = new Definition('stdClass'); + $def->setPublic(true); $def->setFactory($factory); $container->setDefinition('bar', $def); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $dumper->dump(); } public function provideInvalidFactories() @@ -245,20 +283,20 @@ public function testAliases() $container = (include self::$fixturesPath . '/containers/container9.php'); $container->setParameter('foo_bar', 'foo_bar'); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); eval('?>' . $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Aliases'])); - $container = new \_PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Aliases(); + $container = new Symfony_DI_PhpDumper_Test_Aliases(); $foo = $container->get('foo'); $this->assertSame($foo, $container->get('alias_for_foo')); $this->assertSame($foo, $container->get('alias_for_alias')); } public function testFrozenContainerWithoutAliases() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); eval('?>' . $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Frozen_No_Aliases'])); - $container = new \_PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Frozen_No_Aliases(); + $container = new Symfony_DI_PhpDumper_Test_Frozen_No_Aliases(); $this->assertFalse($container->has('foo')); } /** @@ -268,186 +306,186 @@ public function testFrozenContainerWithoutAliases() public function testOverrideServiceWhenUsingADumpedContainer() { require_once self::$fixturesPath . '/php/services9_compiled.php'; - $container = new \_PhpScoper5ea00cc67502b\ProjectServiceContainer(); + $container = new ProjectServiceContainer(); $container->get('decorator_service'); - $container->set('decorator_service', $decorator = new \stdClass()); + $container->set('decorator_service', $decorator = new stdClass()); $this->assertSame($decorator, $container->get('decorator_service'), '->set() overrides an already defined service'); } public function testDumpAutowireData() { $container = (include self::$fixturesPath . '/containers/container24.php'); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services24.php', $dumper->dump()); } public function testEnvInId() { $container = (include self::$fixturesPath . '/containers/container_env_in_id.php'); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services_env_in_id.php', $dumper->dump()); } public function testEnvParameter() { - $rand = \mt_rand(); - \putenv('Baz=' . $rand); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $rand = mt_rand(); + putenv('Baz=' . $rand); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services26.yml'); $container->setParameter('env(json_file)', self::$fixturesPath . '/array.json'); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services26.php', $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_EnvParameters', 'file' => self::$fixturesPath . '/php/services26.php'])); require self::$fixturesPath . '/php/services26.php'; - $container = new \_PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_EnvParameters(); + $container = new Symfony_DI_PhpDumper_Test_EnvParameters(); $this->assertSame($rand, $container->getParameter('baz')); $this->assertSame([123, 'abc'], $container->getParameter('json')); $this->assertSame('sqlite:///foo/bar/var/data.db', $container->getParameter('db_dsn')); - \putenv('Baz'); + putenv('Baz'); } public function testResolvedBase64EnvParameters() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->setParameter('env(foo)', \base64_encode('world')); + $container = new ContainerBuilder(); + $container->setParameter('env(foo)', base64_encode('world')); $container->setParameter('hello', '%env(base64:foo)%'); - $container->compile(\true); + $container->compile(true); $expected = ['env(foo)' => 'd29ybGQ=', 'hello' => 'world']; $this->assertSame($expected, $container->getParameterBag()->all()); } public function testDumpedBase64EnvParameters() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->setParameter('env(foo)', \base64_encode('world')); + $container = new ContainerBuilder(); + $container->setParameter('env(foo)', base64_encode('world')); $container->setParameter('hello', '%env(base64:foo)%'); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $dumper->dump(); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services_base64_env.php', $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Base64Parameters'])); require self::$fixturesPath . '/php/services_base64_env.php'; - $container = new \_PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Base64Parameters(); + $container = new Symfony_DI_PhpDumper_Test_Base64Parameters(); $this->assertSame('world', $container->getParameter('hello')); } public function testCustomEnvParameters() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->setParameter('env(foo)', \str_rot13('world')); + $container = new ContainerBuilder(); + $container->setParameter('env(foo)', str_rot13('world')); $container->setParameter('hello', '%env(rot13:foo)%'); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor::class)->addTag('container.env_var_processor')->setPublic(\true); + $container->register(Rot13EnvVarProcessor::class)->addTag('container.env_var_processor')->setPublic(true); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $dumper->dump(); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services_rot13_env.php', $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Rot13Parameters'])); require self::$fixturesPath . '/php/services_rot13_env.php'; - $container = new \_PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Rot13Parameters(); + $container = new Symfony_DI_PhpDumper_Test_Rot13Parameters(); $this->assertSame('world', $container->getParameter('hello')); } public function testFileEnvProcessor() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->setParameter('env(foo)', __FILE__); $container->setParameter('random', '%env(file:foo)%'); - $container->compile(\true); + $container->compile(true); $this->assertStringEqualsFile(__FILE__, $container->getParameter('random')); } public function testUnusedEnvParameter() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\EnvParameterException'); $this->expectExceptionMessage('Environment variables "FOO" are never used. Please, check your container\'s configuration.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->getParameter('env(FOO)'); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $dumper->dump(); } public function testCircularDynamicEnv() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\ParameterCircularReferenceException'); $this->expectExceptionMessage('Circular reference detected for parameter "env(resolve:DUMMY_ENV_VAR)" ("env(resolve:DUMMY_ENV_VAR)" > "env(resolve:DUMMY_ENV_VAR)").'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->setParameter('foo', '%bar%'); $container->setParameter('bar', '%env(resolve:DUMMY_ENV_VAR)%'); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $dump = $dumper->dump(['class' => $class = __FUNCTION__]); eval('?>' . $dump); $container = new $class(); - \putenv('DUMMY_ENV_VAR=%foo%'); + putenv('DUMMY_ENV_VAR=%foo%'); try { $container->getParameter('bar'); } finally { - \putenv('DUMMY_ENV_VAR'); + putenv('DUMMY_ENV_VAR'); } } public function testInlinedDefinitionReferencingServiceContainer() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', 'stdClass')->addMethodCall('add', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('service_container')])->setPublic(\false); - $container->register('bar', 'stdClass')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo'))->setPublic(\true); + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass')->addMethodCall('add', [new Reference('service_container')])->setPublic(false); + $container->register('bar', 'stdClass')->addArgument(new Reference('foo'))->setPublic(true); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services13.php', $dumper->dump(), '->dump() dumps inline definitions which reference service_container'); } public function testNonSharedLazyDefinitionReferences() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', 'stdClass')->setShared(\false)->setLazy(\true); - $container->register('bar', 'stdClass')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder::EXCEPTION_ON_INVALID_REFERENCE, \false)); + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass')->setShared(false)->setLazy(true); + $container->register('bar', 'stdClass')->addArgument(new Reference('foo', ContainerBuilder::EXCEPTION_ON_INVALID_REFERENCE, false)); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); - $dumper->setProxyDumper(new \_PhpScoper5ea00cc67502b\DummyProxyDumper()); + $dumper = new PhpDumper($container); + $dumper->setProxyDumper(new DummyProxyDumper()); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services_non_shared_lazy.php', $dumper->dump()); } public function testInitializePropertiesBeforeMethodCalls() { require_once self::$fixturesPath . '/includes/classes.php'; - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', 'stdClass')->setPublic(\true); - $container->register('bar', 'MethodCallClass')->setPublic(\true)->setProperty('simple', 'bar')->setProperty('complex', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo'))->addMethodCall('callMe'); + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass')->setPublic(true); + $container->register('bar', 'MethodCallClass')->setPublic(true)->setProperty('simple', 'bar')->setProperty('complex', new Reference('foo'))->addMethodCall('callMe'); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); eval('?>' . $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Properties_Before_Method_Calls'])); - $container = new \_PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Properties_Before_Method_Calls(); + $container = new Symfony_DI_PhpDumper_Test_Properties_Before_Method_Calls(); $this->assertTrue($container->get('bar')->callPassed(), '->dump() initializes properties before method calls'); } public function testCircularReferenceAllowanceForLazyServices() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', 'stdClass')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar'))->setPublic(\true); - $container->register('bar', 'stdClass')->setLazy(\true)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo'))->setPublic(\true); + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass')->addArgument(new Reference('bar'))->setPublic(true); + $container->register('bar', 'stdClass')->setLazy(true)->addArgument(new Reference('foo'))->setPublic(true); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); - $dumper->setProxyDumper(new \_PhpScoper5ea00cc67502b\DummyProxyDumper()); + $dumper = new PhpDumper($container); + $dumper->setProxyDumper(new DummyProxyDumper()); $dumper->dump(); $this->addToAssertionCount(1); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $message = 'Circular reference detected for service "foo", path: "foo -> bar -> foo". Try running "composer require symfony/proxy-manager-bridge".'; - $this->expectException(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException::class); + $this->expectException(ServiceCircularReferenceException::class); $this->expectExceptionMessage($message); $dumper->dump(); } public function testDedupLazyProxy() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', 'stdClass')->setLazy(\true)->setPublic(\true); - $container->register('bar', 'stdClass')->setLazy(\true)->setPublic(\true); + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass')->setLazy(true)->setPublic(true); + $container->register('bar', 'stdClass')->setLazy(true)->setPublic(true); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); - $dumper->setProxyDumper(new \_PhpScoper5ea00cc67502b\DummyProxyDumper()); + $dumper = new PhpDumper($container); + $dumper->setProxyDumper(new DummyProxyDumper()); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services_dedup_lazy_proxy.php', $dumper->dump()); } public function testLazyArgumentProvideGenerator() { require_once self::$fixturesPath . '/includes/classes.php'; - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('lazy_referenced', 'stdClass')->setPublic(\true); - $container->register('lazy_context', 'LazyContext')->setPublic(\true)->setArguments([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument(['k1' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('lazy_referenced'), 'k2' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('service_container')]), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument([])]); + $container = new ContainerBuilder(); + $container->register('lazy_referenced', 'stdClass')->setPublic(true); + $container->register('lazy_context', 'LazyContext')->setPublic(true)->setArguments([new IteratorArgument(['k1' => new Reference('lazy_referenced'), 'k2' => new Reference('service_container')]), new IteratorArgument([])]); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); eval('?>' . $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Lazy_Argument_Provide_Generator'])); - $container = new \_PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Lazy_Argument_Provide_Generator(); + $container = new Symfony_DI_PhpDumper_Test_Lazy_Argument_Provide_Generator(); $lazyContext = $container->get('lazy_context'); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator::class, $lazyContext->lazyValues); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator::class, $lazyContext->lazyEmptyValues); + $this->assertInstanceOf(RewindableGenerator::class, $lazyContext->lazyValues); + $this->assertInstanceOf(RewindableGenerator::class, $lazyContext->lazyEmptyValues); $this->assertCount(2, $lazyContext->lazyValues); $this->assertCount(0, $lazyContext->lazyEmptyValues); $i = -1; @@ -463,98 +501,98 @@ public function testLazyArgumentProvideGenerator() break; } } - $this->assertEmpty(\iterator_to_array($lazyContext->lazyEmptyValues)); + $this->assertEmpty(iterator_to_array($lazyContext->lazyEmptyValues)); } public function testNormalizedId() { $container = (include self::$fixturesPath . '/containers/container33.php'); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services33.php', $dumper->dump()); } public function testDumpContainerBuilderWithFrozenConstructorIncludingPrivateServices() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo_service', 'stdClass')->setArguments([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz_service')])->setPublic(\true); - $container->register('bar_service', 'stdClass')->setArguments([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz_service')])->setPublic(\true); - $container->register('baz_service', 'stdClass')->setPublic(\false); + $container = new ContainerBuilder(); + $container->register('foo_service', 'stdClass')->setArguments([new Reference('baz_service')])->setPublic(true); + $container->register('bar_service', 'stdClass')->setArguments([new Reference('baz_service')])->setPublic(true); + $container->register('baz_service', 'stdClass')->setPublic(false); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services_private_frozen.php', $dumper->dump()); } public function testServiceLocator() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo_service', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator::class)->setPublic(\true)->addArgument(['bar' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar_service')), 'baz' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\TypedReference('baz_service', 'stdClass')), 'nil' => $nil = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('nil'))]); + $container = new ContainerBuilder(); + $container->register('foo_service', ServiceLocator::class)->setPublic(true)->addArgument(['bar' => new ServiceClosureArgument(new Reference('bar_service')), 'baz' => new ServiceClosureArgument(new TypedReference('baz_service', 'stdClass')), 'nil' => $nil = new ServiceClosureArgument(new Reference('nil'))]); // no method calls - $container->register('translator.loader_1', 'stdClass')->setPublic(\true); - $container->register('translator.loader_1_locator', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator::class)->setPublic(\false)->addArgument(['translator.loader_1' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('translator.loader_1'))]); - $container->register('translator_1', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator::class)->setPublic(\true)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('translator.loader_1_locator')); + $container->register('translator.loader_1', 'stdClass')->setPublic(true); + $container->register('translator.loader_1_locator', ServiceLocator::class)->setPublic(false)->addArgument(['translator.loader_1' => new ServiceClosureArgument(new Reference('translator.loader_1'))]); + $container->register('translator_1', StubbedTranslator::class)->setPublic(true)->addArgument(new Reference('translator.loader_1_locator')); // one method calls - $container->register('translator.loader_2', 'stdClass')->setPublic(\true); - $container->register('translator.loader_2_locator', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator::class)->setPublic(\false)->addArgument(['translator.loader_2' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('translator.loader_2'))]); - $container->register('translator_2', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator::class)->setPublic(\true)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('translator.loader_2_locator'))->addMethodCall('addResource', ['db', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('translator.loader_2'), 'nl']); + $container->register('translator.loader_2', 'stdClass')->setPublic(true); + $container->register('translator.loader_2_locator', ServiceLocator::class)->setPublic(false)->addArgument(['translator.loader_2' => new ServiceClosureArgument(new Reference('translator.loader_2'))]); + $container->register('translator_2', StubbedTranslator::class)->setPublic(true)->addArgument(new Reference('translator.loader_2_locator'))->addMethodCall('addResource', ['db', new Reference('translator.loader_2'), 'nl']); // two method calls - $container->register('translator.loader_3', 'stdClass')->setPublic(\true); - $container->register('translator.loader_3_locator', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator::class)->setPublic(\false)->addArgument(['translator.loader_3' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('translator.loader_3'))]); - $container->register('translator_3', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator::class)->setPublic(\true)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('translator.loader_3_locator'))->addMethodCall('addResource', ['db', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('translator.loader_3'), 'nl'])->addMethodCall('addResource', ['db', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('translator.loader_3'), 'en']); + $container->register('translator.loader_3', 'stdClass')->setPublic(true); + $container->register('translator.loader_3_locator', ServiceLocator::class)->setPublic(false)->addArgument(['translator.loader_3' => new ServiceClosureArgument(new Reference('translator.loader_3'))]); + $container->register('translator_3', StubbedTranslator::class)->setPublic(true)->addArgument(new Reference('translator.loader_3_locator'))->addMethodCall('addResource', ['db', new Reference('translator.loader_3'), 'nl'])->addMethodCall('addResource', ['db', new Reference('translator.loader_3'), 'en']); $nil->setValues([null]); - $container->register('bar_service', 'stdClass')->setArguments([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz_service')])->setPublic(\true); - $container->register('baz_service', 'stdClass')->setPublic(\false); + $container->register('bar_service', 'stdClass')->setArguments([new Reference('baz_service')])->setPublic(true); + $container->register('baz_service', 'stdClass')->setPublic(false); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services_locator.php', $dumper->dump()); } public function testServiceSubscriber() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo_service', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::class)->setPublic(\true)->setAutowired(\true)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference(\_PhpScoper5ea00cc67502b\Psr\Container\ContainerInterface::class))->addTag('container.service_subscriber', ['key' => 'bar', 'id' => \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::class]); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber::class)->setPublic(\true); - $container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition::class)->setPublic(\false); + $container = new ContainerBuilder(); + $container->register('foo_service', TestServiceSubscriber::class)->setPublic(true)->setAutowired(true)->addArgument(new Reference(ContainerInterface::class))->addTag('container.service_subscriber', ['key' => 'bar', 'id' => TestServiceSubscriber::class]); + $container->register(TestServiceSubscriber::class, TestServiceSubscriber::class)->setPublic(true); + $container->register(CustomDefinition::class, CustomDefinition::class)->setPublic(false); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services_subscriber.php', $dumper->dump()); } public function testPrivateWithIgnoreOnInvalidReference() { require_once self::$fixturesPath . '/includes/classes.php'; - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('not_invalid', 'BazClass')->setPublic(\false); - $container->register('bar', 'BarClass')->setPublic(\true)->addMethodCall('setBaz', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('not_invalid', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]); + $container = new ContainerBuilder(); + $container->register('not_invalid', 'BazClass')->setPublic(false); + $container->register('bar', 'BarClass')->setPublic(true)->addMethodCall('setBaz', [new Reference('not_invalid', SymfonyContainerInterface::IGNORE_ON_INVALID_REFERENCE)]); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); eval('?>' . $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Private_With_Ignore_On_Invalid_Reference'])); - $container = new \_PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Private_With_Ignore_On_Invalid_Reference(); + $container = new Symfony_DI_PhpDumper_Test_Private_With_Ignore_On_Invalid_Reference(); $this->assertInstanceOf('BazClass', $container->get('bar')->getBaz()); } public function testArrayParameters() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->setParameter('array_1', [123]); $container->setParameter('array_2', [__DIR__]); - $container->register('bar', 'BarClass')->setPublic(\true)->addMethodCall('setBaz', ['%array_1%', '%array_2%', '%%array_1%%', [123]]); + $container->register('bar', 'BarClass')->setPublic(true)->addMethodCall('setBaz', ['%array_1%', '%array_2%', '%%array_1%%', [123]]); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); - $this->assertStringEqualsFile(self::$fixturesPath . '/php/services_array_params.php', \str_replace('\\\\Dumper', '/Dumper', $dumper->dump(['file' => self::$fixturesPath . '/php/services_array_params.php']))); + $dumper = new PhpDumper($container); + $this->assertStringEqualsFile(self::$fixturesPath . '/php/services_array_params.php', str_replace('\\\\Dumper', '/Dumper', $dumper->dump(['file' => self::$fixturesPath . '/php/services_array_params.php']))); } public function testExpressionReferencingPrivateService() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('private_bar', 'stdClass')->setPublic(\false); - $container->register('private_foo', 'stdClass')->setPublic(\false); - $container->register('public_foo', 'stdClass')->setPublic(\true)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression('service("private_foo").bar')); + $container = new ContainerBuilder(); + $container->register('private_bar', 'stdClass')->setPublic(false); + $container->register('private_foo', 'stdClass')->setPublic(false); + $container->register('public_foo', 'stdClass')->setPublic(true)->addArgument(new Expression('service("private_foo").bar')); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services_private_in_expression.php', $dumper->dump()); } public function testUninitializedReference() { $container = (include self::$fixturesPath . '/containers/container_uninitialized_ref.php'); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services_uninitialized_ref.php', $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Uninitialized_Reference'])); require self::$fixturesPath . '/php/services_uninitialized_ref.php'; - $container = new \_PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Uninitialized_Reference(); + $container = new Symfony_DI_PhpDumper_Test_Uninitialized_Reference(); $bar = $container->get('bar'); $this->assertNull($bar->foo1); $this->assertNull($bar->foo2); @@ -562,18 +600,18 @@ public function testUninitializedReference() $this->assertNull($bar->closures[0]()); $this->assertNull($bar->closures[1]()); $this->assertNull($bar->closures[2]()); - $this->assertSame([], \iterator_to_array($bar->iter)); - $container = new \_PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Uninitialized_Reference(); + $this->assertSame([], iterator_to_array($bar->iter)); + $container = new Symfony_DI_PhpDumper_Test_Uninitialized_Reference(); $container->get('foo1'); $container->get('baz'); $bar = $container->get('bar'); - $this->assertEquals(new \stdClass(), $bar->foo1); + $this->assertEquals(new stdClass(), $bar->foo1); $this->assertNull($bar->foo2); - $this->assertEquals(new \stdClass(), $bar->foo3); - $this->assertEquals(new \stdClass(), $bar->closures[0]()); + $this->assertEquals(new stdClass(), $bar->foo3); + $this->assertEquals(new stdClass(), $bar->closures[0]()); $this->assertNull($bar->closures[1]()); - $this->assertEquals(new \stdClass(), $bar->closures[2]()); - $this->assertEquals(['foo1' => new \stdClass(), 'foo3' => new \stdClass()], \iterator_to_array($bar->iter)); + $this->assertEquals(new stdClass(), $bar->closures[2]()); + $this->assertEquals(['foo1' => new stdClass(), 'foo3' => new stdClass()], iterator_to_array($bar->iter)); } /** * @dataProvider provideAlmostCircular @@ -582,8 +620,8 @@ public function testAlmostCircular($visibility) { $container = (include self::$fixturesPath . '/containers/container_almost_circular.php'); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); - $container = 'Symfony_DI_PhpDumper_Test_Almost_Circular_' . \ucfirst($visibility); + $dumper = new PhpDumper($container); + $container = 'Symfony_DI_PhpDumper_Test_Almost_Circular_' . ucfirst($visibility); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services_almost_circular_' . $visibility . '.php', $dumper->dump(['class' => $container])); require self::$fixturesPath . '/php/services_almost_circular_' . $visibility . '.php'; $container = new $container(); @@ -595,12 +633,12 @@ public function testAlmostCircular($visibility) $foo5 = $container->get('foo5'); $this->assertSame($foo5, $foo5->bar->foo); $manager = $container->get('manager'); - $this->assertEquals(new \stdClass(), $manager); + $this->assertEquals(new stdClass(), $manager); $manager = $container->get('manager2'); - $this->assertEquals(new \stdClass(), $manager); + $this->assertEquals(new stdClass(), $manager); $foo6 = $container->get('foo6'); $this->assertEquals((object) ['bar6' => (object) []], $foo6); - $this->assertInstanceOf(\stdClass::class, $container->get('root')); + $this->assertInstanceOf(stdClass::class, $container->get('root')); $manager3 = $container->get('manager3'); $listener3 = $container->get('listener3'); $this->assertSame($manager3, $listener3->manager); @@ -614,83 +652,83 @@ public function provideAlmostCircular() } public function testDeepServiceGraph() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services_deep_graph.yml'); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $dumper->dump(); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services_deep_graph.php', $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Deep_Graph'])); require self::$fixturesPath . '/php/services_deep_graph.php'; - $container = new \_PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Deep_Graph(); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Dumper\FooForDeepGraph::class, $container->get('foo')); + $container = new Symfony_DI_PhpDumper_Test_Deep_Graph(); + $this->assertInstanceOf(FooForDeepGraph::class, $container->get('foo')); $this->assertEquals((object) ['p2' => (object) ['p3' => (object) []]], $container->get('foo')->bClone); } public function testInlineSelfRef() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $bar = (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('_PhpScoper5ea00cc67502b\\App\\Bar'))->setProperty('foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('_PhpScoper5ea00cc67502b\\App\\Foo')); - $baz = (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('_PhpScoper5ea00cc67502b\\App\\Baz'))->setProperty('bar', $bar)->addArgument($bar); - $container->register('_PhpScoper5ea00cc67502b\\App\\Foo')->setPublic(\true)->addArgument($baz); + $container = new ContainerBuilder(); + $bar = (new Definition('_PhpScoper5ea00cc67502b\\App\\Bar'))->setProperty('foo', new Reference('_PhpScoper5ea00cc67502b\\App\\Foo')); + $baz = (new Definition('_PhpScoper5ea00cc67502b\\App\\Baz'))->setProperty('bar', $bar)->addArgument($bar); + $container->register('_PhpScoper5ea00cc67502b\\App\\Foo')->setPublic(true)->addArgument($baz); $container->getCompiler()->getPassConfig(); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services_inline_self_ref.php', $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Inline_Self_Ref'])); } public function testHotPathOptimizations() { $container = (include self::$fixturesPath . '/containers/container_inline_requires.php'); - $container->setParameter('inline_requires', \true); + $container->setParameter('inline_requires', true); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $dump = $dumper->dump(['hot_path_tag' => 'container.hot_path', 'inline_class_loader_parameter' => 'inline_requires', 'file' => self::$fixturesPath . '/php/services_inline_requires.php']); - if ('\\' === \DIRECTORY_SEPARATOR) { - $dump = \str_replace("'\\\\includes\\\\HotPath\\\\", "'/includes/HotPath/", $dump); + if ('\\' === DIRECTORY_SEPARATOR) { + $dump = str_replace("'\\\\includes\\\\HotPath\\\\", "'/includes/HotPath/", $dump); } $this->assertStringEqualsFile(self::$fixturesPath . '/php/services_inline_requires.php', $dump); } public function testDumpHandlesLiteralClassWithRootNamespace() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', '\\stdClass')->setPublic(\true); + $container = new ContainerBuilder(); + $container->register('foo', '\\stdClass')->setPublic(true); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); eval('?>' . $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Literal_Class_With_Root_Namespace'])); - $container = new \_PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Literal_Class_With_Root_Namespace(); + $container = new Symfony_DI_PhpDumper_Test_Literal_Class_With_Root_Namespace(); $this->assertInstanceOf('stdClass', $container->get('foo')); } public function testDumpHandlesObjectClassNames() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['class' => 'stdClass'])); - $container->setDefinition('foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Parameter('class'))); - $container->setDefinition('bar', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo')]))->setPublic(\true); - $container->setParameter('inline_requires', \true); + $container = new ContainerBuilder(new ParameterBag(['class' => 'stdClass'])); + $container->setDefinition('foo', new Definition(new Parameter('class'))); + $container->setDefinition('bar', new Definition('stdClass', [new Reference('foo')]))->setPublic(true); + $container->setParameter('inline_requires', true); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); eval('?>' . $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Object_Class_Name', 'inline_class_loader_parameter' => 'inline_requires'])); - $container = new \_PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Object_Class_Name(); + $container = new Symfony_DI_PhpDumper_Test_Object_Class_Name(); $this->assertInstanceOf('stdClass', $container->get('bar')); } public function testUninitializedSyntheticReference() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', 'stdClass')->setPublic(\true)->setSynthetic(\true); - $container->register('bar', 'stdClass')->setPublic(\true)->setShared(\false)->setProperty('foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder::IGNORE_ON_UNINITIALIZED_REFERENCE)); + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass')->setPublic(true)->setSynthetic(true); + $container->register('bar', 'stdClass')->setPublic(true)->setShared(false)->setProperty('foo', new Reference('foo', ContainerBuilder::IGNORE_ON_UNINITIALIZED_REFERENCE)); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); eval('?>' . $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_UninitializedSyntheticReference', 'inline_class_loader_parameter' => 'inline_requires'])); - $container = new \_PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_UninitializedSyntheticReference(); + $container = new Symfony_DI_PhpDumper_Test_UninitializedSyntheticReference(); $this->assertEquals((object) ['foo' => null], $container->get('bar')); $container->set('foo', (object) [123]); $this->assertEquals((object) ['foo' => (object) [123]], $container->get('bar')); } public function testAdawsonContainer() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services_adawson.yml'); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services_adawson.php', $dumper->dump()); } /** @@ -706,23 +744,23 @@ public function testAdawsonContainer() */ public function testLegacyPrivateServices() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services_legacy_privates.yml'); - $container->setDefinition('private_child', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('foo')); - $container->setDefinition('private_parent', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ChildDefinition('private')); - $container->getDefinition('private')->setPrivate(\true); - $container->getDefinition('private_not_inlined')->setPrivate(\true); - $container->getDefinition('private_not_removed')->setPrivate(\true); - $container->getDefinition('decorated_private')->setPrivate(\true); - $container->getDefinition('private_child')->setPrivate(\true); - $container->getAlias('decorated_private_alias')->setPrivate(\true); - $container->getAlias('private_alias')->setPrivate(\true); - $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $container->setDefinition('private_child', new ChildDefinition('foo')); + $container->setDefinition('private_parent', new ChildDefinition('private')); + $container->getDefinition('private')->setPrivate(true); + $container->getDefinition('private_not_inlined')->setPrivate(true); + $container->getDefinition('private_not_removed')->setPrivate(true); + $container->getDefinition('decorated_private')->setPrivate(true); + $container->getDefinition('private_child')->setPrivate(true); + $container->getAlias('decorated_private_alias')->setPrivate(true); + $container->getAlias('private_alias')->setPrivate(true); + $container->compile(); + $dumper = new PhpDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services_legacy_privates.php', $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Legacy_Privates', 'file' => self::$fixturesPath . '/php/services_legacy_privates.php'])); require self::$fixturesPath . '/php/services_legacy_privates.php'; - $container = new \_PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Legacy_Privates(); + $container = new Symfony_DI_PhpDumper_Test_Legacy_Privates(); $container->get('private'); $container->get('private_alias'); $container->get('alias_to_private'); @@ -742,13 +780,13 @@ public function testLegacyPrivateServices() */ public function testPrivateServiceTriggersDeprecation() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', 'stdClass')->setPublic(\false)->setDeprecated(\true); - $container->register('bar', 'stdClass')->setPublic(\true)->setProperty('foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo')); + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass')->setPublic(false)->setDeprecated(true); + $container->register('bar', 'stdClass')->setPublic(true)->setProperty('foo', new Reference('foo')); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); eval('?>' . $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Private_Service_Triggers_Deprecation'])); - $container = new \_PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Private_Service_Triggers_Deprecation(); + $container = new Symfony_DI_PhpDumper_Test_Private_Service_Triggers_Deprecation(); $container->get('bar'); } /** @@ -759,11 +797,11 @@ public function testPrivateServiceTriggersDeprecation() */ public function testParameterWithMixedCase() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['Foo' => 'bar', 'BAR' => 'foo'])); + $container = new ContainerBuilder(new ParameterBag(['Foo' => 'bar', 'BAR' => 'foo'])); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); eval('?>' . $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Parameter_With_Mixed_Case'])); - $container = new \_PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Parameter_With_Mixed_Case(); + $container = new Symfony_DI_PhpDumper_Test_Parameter_With_Mixed_Case(); $this->assertSame('bar', $container->getParameter('foo')); $this->assertSame('bar', $container->getParameter('FOO')); $this->assertSame('foo', $container->getParameter('bar')); @@ -775,11 +813,11 @@ public function testParameterWithMixedCase() */ public function testParameterWithLowerCase() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => 'bar'])); + $container = new ContainerBuilder(new ParameterBag(['foo' => 'bar'])); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); eval('?>' . $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Parameter_With_Lower_Case'])); - $container = new \_PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Parameter_With_Lower_Case(); + $container = new Symfony_DI_PhpDumper_Test_Parameter_With_Lower_Case(); $this->assertSame('bar', $container->getParameter('FOO')); } /** @@ -789,49 +827,49 @@ public function testParameterWithLowerCase() */ public function testReferenceWithLowerCaseId() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('Bar', 'stdClass')->setProperty('foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo'))->setPublic(\true); + $container = new ContainerBuilder(); + $container->register('Bar', 'stdClass')->setProperty('foo', new Reference('foo'))->setPublic(true); $container->register('Foo', 'stdClass')->setDeprecated(); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); eval('?>' . $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Reference_With_Lower_Case_Id'])); - $container = new \_PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Reference_With_Lower_Case_Id(); + $container = new Symfony_DI_PhpDumper_Test_Reference_With_Lower_Case_Id(); $this->assertEquals((object) ['foo' => (object) []], $container->get('Bar')); } public function testScalarService() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', 'string')->setPublic(\true)->setFactory([\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\ScalarFactory::class, 'getSomeValue']); + $container = new ContainerBuilder(); + $container->register('foo', 'string')->setPublic(true)->setFactory([ScalarFactory::class, 'getSomeValue']); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); eval('?>' . $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Scalar_Service'])); - $container = new \_PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_Test_Scalar_Service(); + $container = new Symfony_DI_PhpDumper_Test_Scalar_Service(); $this->assertTrue($container->has('foo')); $this->assertSame('some value', $container->get('foo')); } public function testAliasCanBeFoundInTheDumpedContainerWhenBothTheAliasAndTheServiceArePublic() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', 'stdClass')->setPublic(\true); - $container->setAlias('bar', 'foo')->setPublic(\true); + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass')->setPublic(true); + $container->setAlias('bar', 'foo')->setPublic(true); $container->compile(); // Bar is found in the compiled container $service_ids = $container->getServiceIds(); $this->assertContains('bar', $service_ids); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $dump = $dumper->dump(['class' => 'Symfony_DI_PhpDumper_AliasesCanBeFoundInTheDumpedContainer']); eval('?>' . $dump); - $container = new \_PhpScoper5ea00cc67502b\Symfony_DI_PhpDumper_AliasesCanBeFoundInTheDumpedContainer(); + $container = new Symfony_DI_PhpDumper_AliasesCanBeFoundInTheDumpedContainer(); // Bar should still be found in the compiled container $service_ids = $container->getServiceIds(); $this->assertContains('bar', $service_ids); } } -class Rot13EnvVarProcessor implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\EnvVarProcessorInterface +class Rot13EnvVarProcessor implements EnvVarProcessorInterface { - public function getEnv($prefix, $name, \Closure $getEnv) + public function getEnv($prefix, $name, Closure $getEnv) { - return \str_rot13($getEnv($name)); + return str_rot13($getEnv($name)); } public static function getProvidedTypes() { @@ -841,7 +879,7 @@ public static function getProvidedTypes() class FooForDeepGraph { public $bClone; - public function __construct(\stdClass $a, \stdClass $b) + public function __construct(stdClass $a, stdClass $b) { // clone to verify that $b has been fully initialized before $this->bClone = clone $b; diff --git a/vendor/symfony/dependency-injection/Tests/Dumper/XmlDumperTest.php b/vendor/symfony/dependency-injection/Tests/Dumper/XmlDumperTest.php index 5e00d2525..60d103b47 100644 --- a/vendor/symfony/dependency-injection/Tests/Dumper/XmlDumperTest.php +++ b/vendor/symfony/dependency-injection/Tests/Dumper/XmlDumperTest.php @@ -17,41 +17,48 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\XmlDumper; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; -class XmlDumperTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use Exception; +use stdClass; +use function file_get_contents; +use function realpath; +use function str_replace; +use const DIRECTORY_SEPARATOR; + +class XmlDumperTest extends TestCase { protected static $fixturesPath; public static function setUpBeforeClass() { - self::$fixturesPath = \realpath(__DIR__ . '/../Fixtures/'); + self::$fixturesPath = realpath(__DIR__ . '/../Fixtures/'); } public function testDump() { - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\XmlDumper(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder()); + $dumper = new XmlDumper(new ContainerBuilder()); $this->assertXmlStringEqualsXmlFile(self::$fixturesPath . '/xml/services1.xml', $dumper->dump(), '->dump() dumps an empty container as an empty XML file'); } public function testExportParameters() { $container = (include self::$fixturesPath . '//containers/container8.php'); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\XmlDumper($container); + $dumper = new XmlDumper($container); $this->assertXmlStringEqualsXmlFile(self::$fixturesPath . '/xml/services8.xml', $dumper->dump(), '->dump() dumps parameters'); } public function testAddParameters() { $container = (include self::$fixturesPath . '//containers/container8.php'); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\XmlDumper($container); + $dumper = new XmlDumper($container); $this->assertXmlStringEqualsXmlFile(self::$fixturesPath . '/xml/services8.xml', $dumper->dump(), '->dump() dumps parameters'); } public function testAddService() { $container = (include self::$fixturesPath . '/containers/container9.php'); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\XmlDumper($container); - $this->assertEquals(\str_replace('%path%', self::$fixturesPath . \DIRECTORY_SEPARATOR . 'includes' . \DIRECTORY_SEPARATOR, \file_get_contents(self::$fixturesPath . '/xml/services9.xml')), $dumper->dump(), '->dump() dumps services'); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\XmlDumper($container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder()); - $container->register('foo', 'FooClass')->addArgument(new \stdClass())->setPublic(\true); + $dumper = new XmlDumper($container); + $this->assertEquals(str_replace('%path%', self::$fixturesPath . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR, file_get_contents(self::$fixturesPath . '/xml/services9.xml')), $dumper->dump(), '->dump() dumps services'); + $dumper = new XmlDumper($container = new ContainerBuilder()); + $container->register('foo', 'FooClass')->addArgument(new stdClass())->setPublic(true); try { $dumper->dump(); $this->fail('->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertInstanceOf('\\RuntimeException', $e, '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); $this->assertEquals('Unable to dump a service container if a parameter is an object or a resource.', $e->getMessage(), '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); } @@ -59,7 +66,7 @@ public function testAddService() public function testDumpAnonymousServices() { $container = (include self::$fixturesPath . '/containers/container11.php'); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\XmlDumper($container); + $dumper = new XmlDumper($container); $this->assertEquals(' @@ -82,7 +89,7 @@ public function testDumpAnonymousServices() public function testDumpEntities() { $container = (include self::$fixturesPath . '/containers/container12.php'); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\XmlDumper($container); + $dumper = new XmlDumper($container); $this->assertEquals("\n\n \n \n \n \n foo<>&bar\n \n \n \n \n\n", $dumper->dump()); } /** @@ -90,12 +97,12 @@ public function testDumpEntities() */ public function testDumpDecoratedServices($expectedXmlDump, $container) { - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\XmlDumper($container); + $dumper = new XmlDumper($container); $this->assertEquals($expectedXmlDump, $dumper->dump()); } public function provideDecoratedServicesData() { - $fixturesPath = \realpath(__DIR__ . '/../Fixtures/'); + $fixturesPath = realpath(__DIR__ . '/../Fixtures/'); return [["\n\n \n \n \n \n \n \n\n", include $fixturesPath . '/containers/container15.php'], ["\n\n \n \n \n \n \n \n\n", include $fixturesPath . '/containers/container16.php']]; } /** @@ -106,7 +113,7 @@ public function testCompiledContainerCanBeDumped($containerFile) $fixturesPath = __DIR__ . '/../Fixtures'; $container = (require $fixturesPath . '/containers/' . $containerFile . '.php'); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\XmlDumper($container); + $dumper = new XmlDumper($container); $dumper->dump(); $this->addToAssertionCount(1); } @@ -117,28 +124,28 @@ public function provideCompiledContainerData() public function testDumpInlinedServices() { $container = (include self::$fixturesPath . '/containers/container21.php'); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\XmlDumper($container); - $this->assertEquals(\file_get_contents(self::$fixturesPath . '/xml/services21.xml'), $dumper->dump()); + $dumper = new XmlDumper($container); + $this->assertEquals(file_get_contents(self::$fixturesPath . '/xml/services21.xml'), $dumper->dump()); } public function testDumpAutowireData() { $container = (include self::$fixturesPath . '/containers/container24.php'); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\XmlDumper($container); - $this->assertEquals(\file_get_contents(self::$fixturesPath . '/xml/services24.xml'), $dumper->dump()); + $dumper = new XmlDumper($container); + $this->assertEquals(file_get_contents(self::$fixturesPath . '/xml/services24.xml'), $dumper->dump()); } public function testDumpLoad() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('services_dump_load.xml'); - $this->assertEquals([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE)], $container->getDefinition('foo')->getArguments()); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\XmlDumper($container); + $this->assertEquals([new Reference('bar', ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE)], $container->getDefinition('foo')->getArguments()); + $dumper = new XmlDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/xml/services_dump_load.xml', $dumper->dump()); } public function testDumpAbstractServices() { $container = (include self::$fixturesPath . '/containers/container_abstract.php'); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\XmlDumper($container); - $this->assertEquals(\file_get_contents(self::$fixturesPath . '/xml/services_abstract.xml'), $dumper->dump()); + $dumper = new XmlDumper($container); + $this->assertEquals(file_get_contents(self::$fixturesPath . '/xml/services_abstract.xml'), $dumper->dump()); } } diff --git a/vendor/symfony/dependency-injection/Tests/Dumper/YamlDumperTest.php b/vendor/symfony/dependency-injection/Tests/Dumper/YamlDumperTest.php index a4ecc317e..ba5d7f186 100644 --- a/vendor/symfony/dependency-injection/Tests/Dumper/YamlDumperTest.php +++ b/vendor/symfony/dependency-injection/Tests/Dumper/YamlDumperTest.php @@ -20,35 +20,42 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser; use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml; -class YamlDumperTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use Exception; +use stdClass; +use function file_get_contents; +use function realpath; +use function str_replace; +use const DIRECTORY_SEPARATOR; + +class YamlDumperTest extends TestCase { protected static $fixturesPath; public static function setUpBeforeClass() { - self::$fixturesPath = \realpath(__DIR__ . '/../Fixtures/'); + self::$fixturesPath = realpath(__DIR__ . '/../Fixtures/'); } public function testDump() { - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\YamlDumper($container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder()); - $this->assertEqualYamlStructure(\file_get_contents(self::$fixturesPath . '/yaml/services1.yml'), $dumper->dump(), '->dump() dumps an empty container as an empty YAML file'); + $dumper = new YamlDumper($container = new ContainerBuilder()); + $this->assertEqualYamlStructure(file_get_contents(self::$fixturesPath . '/yaml/services1.yml'), $dumper->dump(), '->dump() dumps an empty container as an empty YAML file'); } public function testAddParameters() { $container = (include self::$fixturesPath . '/containers/container8.php'); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\YamlDumper($container); - $this->assertEqualYamlStructure(\file_get_contents(self::$fixturesPath . '/yaml/services8.yml'), $dumper->dump(), '->dump() dumps parameters'); + $dumper = new YamlDumper($container); + $this->assertEqualYamlStructure(file_get_contents(self::$fixturesPath . '/yaml/services8.yml'), $dumper->dump(), '->dump() dumps parameters'); } public function testAddService() { $container = (include self::$fixturesPath . '/containers/container9.php'); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\YamlDumper($container); - $this->assertEqualYamlStructure(\str_replace('%path%', self::$fixturesPath . \DIRECTORY_SEPARATOR . 'includes' . \DIRECTORY_SEPARATOR, \file_get_contents(self::$fixturesPath . '/yaml/services9.yml')), $dumper->dump(), '->dump() dumps services'); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\YamlDumper($container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder()); - $container->register('foo', 'FooClass')->addArgument(new \stdClass())->setPublic(\true); + $dumper = new YamlDumper($container); + $this->assertEqualYamlStructure(str_replace('%path%', self::$fixturesPath . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR, file_get_contents(self::$fixturesPath . '/yaml/services9.yml')), $dumper->dump(), '->dump() dumps services'); + $dumper = new YamlDumper($container = new ContainerBuilder()); + $container->register('foo', 'FooClass')->addArgument(new stdClass())->setPublic(true); try { $dumper->dump(); $this->fail('->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertInstanceOf('\\RuntimeException', $e, '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); $this->assertEquals('Unable to dump a service container if a parameter is an object or a resource.', $e->getMessage(), '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); } @@ -56,28 +63,28 @@ public function testAddService() public function testDumpAutowireData() { $container = (include self::$fixturesPath . '/containers/container24.php'); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\YamlDumper($container); + $dumper = new YamlDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/yaml/services24.yml', $dumper->dump()); } public function testDumpLoad() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services_dump_load.yml'); - $this->assertEquals([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE)], $container->getDefinition('foo')->getArguments()); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\YamlDumper($container); + $this->assertEquals([new Reference('bar', ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE)], $container->getDefinition('foo')->getArguments()); + $dumper = new YamlDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/yaml/services_dump_load.yml', $dumper->dump()); } public function testInlineServices() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->register('foo', 'Class1')->setPublic(\true)->addArgument((new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('Class2'))->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('Class2'))); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\YamlDumper($container); + $container = new ContainerBuilder(); + $container->register('foo', 'Class1')->setPublic(true)->addArgument((new Definition('Class2'))->addArgument(new Definition('Class2'))); + $dumper = new YamlDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/yaml/services_inline.yml', $dumper->dump()); } private function assertEqualYamlStructure($expected, $yaml, $message = '') { - $parser = new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser(); - $this->assertEquals($parser->parse($expected, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_CUSTOM_TAGS), $parser->parse($yaml, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_CUSTOM_TAGS), $message); + $parser = new Parser(); + $this->assertEquals($parser->parse($expected, Yaml::PARSE_CUSTOM_TAGS), $parser->parse($yaml, Yaml::PARSE_CUSTOM_TAGS), $message); } } diff --git a/vendor/symfony/dependency-injection/Tests/Dumper/index.php b/vendor/symfony/dependency-injection/Tests/Dumper/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Dumper/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/EnvVarProcessorTest.php b/vendor/symfony/dependency-injection/Tests/EnvVarProcessorTest.php index 3b1bc2597..745b08f79 100644 --- a/vendor/symfony/dependency-injection/Tests/EnvVarProcessorTest.php +++ b/vendor/symfony/dependency-injection/Tests/EnvVarProcessorTest.php @@ -6,7 +6,11 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\EnvVarProcessor; -class EnvVarProcessorTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use function base64_encode; +use function json_encode; +use const E_ERROR; + +class EnvVarProcessorTest extends TestCase { const TEST_CONST = 'test'; /** @@ -14,10 +18,10 @@ class EnvVarProcessorTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\Tes */ public function testGetEnvString($value, $processed) { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->setParameter('env(foo)', $value); $container->compile(); - $processor = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\EnvVarProcessor($container); + $processor = new EnvVarProcessor($container); $result = $processor->getEnv('string', 'foo', function () { $this->fail('Should not be called'); }); @@ -32,7 +36,7 @@ public function validStrings() */ public function testGetEnvBool($value, $processed) { - $processor = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\EnvVarProcessor(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container()); + $processor = new EnvVarProcessor(new Container()); $result = $processor->getEnv('bool', 'foo', function ($name) use($value) { $this->assertSame('foo', $name); return $value; @@ -41,14 +45,14 @@ public function testGetEnvBool($value, $processed) } public function validBools() { - return [['true', \true], ['false', \false], ['null', \false], ['1', \true], ['0', \false], ['1.1', \true], ['1e1', \true]]; + return [['true', true], ['false', false], ['null', false], ['1', true], ['0', false], ['1.1', true], ['1e1', true]]; } /** * @dataProvider validInts */ public function testGetEnvInt($value, $processed) { - $processor = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\EnvVarProcessor(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container()); + $processor = new EnvVarProcessor(new Container()); $result = $processor->getEnv('int', 'foo', function ($name) use($value) { $this->assertSame('foo', $name); return $value; @@ -66,7 +70,7 @@ public function testGetEnvIntInvalid($value) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); $this->expectExceptionMessage('Non-numeric env var'); - $processor = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\EnvVarProcessor(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container()); + $processor = new EnvVarProcessor(new Container()); $processor->getEnv('int', 'foo', function ($name) use($value) { $this->assertSame('foo', $name); return $value; @@ -81,7 +85,7 @@ public function invalidInts() */ public function testGetEnvFloat($value, $processed) { - $processor = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\EnvVarProcessor(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container()); + $processor = new EnvVarProcessor(new Container()); $result = $processor->getEnv('float', 'foo', function ($name) use($value) { $this->assertSame('foo', $name); return $value; @@ -99,7 +103,7 @@ public function testGetEnvFloatInvalid($value) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); $this->expectExceptionMessage('Non-numeric env var'); - $processor = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\EnvVarProcessor(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container()); + $processor = new EnvVarProcessor(new Container()); $processor->getEnv('float', 'foo', function ($name) use($value) { $this->assertSame('foo', $name); return $value; @@ -114,7 +118,7 @@ public function invalidFloats() */ public function testGetEnvConst($value, $processed) { - $processor = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\EnvVarProcessor(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container()); + $processor = new EnvVarProcessor(new Container()); $result = $processor->getEnv('const', 'foo', function ($name) use($value) { $this->assertSame('foo', $name); return $value; @@ -123,7 +127,7 @@ public function testGetEnvConst($value, $processed) } public function validConsts() { - return [['Symfony\\Component\\DependencyInjection\\Tests\\EnvVarProcessorTest::TEST_CONST', self::TEST_CONST], ['E_ERROR', \E_ERROR]]; + return [['Symfony\\Component\\DependencyInjection\\Tests\\EnvVarProcessorTest::TEST_CONST', self::TEST_CONST], ['E_ERROR', E_ERROR]]; } /** * @dataProvider invalidConsts @@ -132,7 +136,7 @@ public function testGetEnvConstInvalid($value) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); $this->expectExceptionMessage('undefined constant'); - $processor = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\EnvVarProcessor(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container()); + $processor = new EnvVarProcessor(new Container()); $processor->getEnv('const', 'foo', function ($name) use($value) { $this->assertSame('foo', $name); return $value; @@ -144,19 +148,19 @@ public function invalidConsts() } public function testGetEnvBase64() { - $processor = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\EnvVarProcessor(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container()); + $processor = new EnvVarProcessor(new Container()); $result = $processor->getEnv('base64', 'foo', function ($name) { $this->assertSame('foo', $name); - return \base64_encode('hello'); + return base64_encode('hello'); }); $this->assertSame('hello', $result); } public function testGetEnvJson() { - $processor = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\EnvVarProcessor(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container()); + $processor = new EnvVarProcessor(new Container()); $result = $processor->getEnv('json', 'foo', function ($name) { $this->assertSame('foo', $name); - return \json_encode([1]); + return json_encode([1]); }); $this->assertSame([1], $result); } @@ -164,7 +168,7 @@ public function testGetEnvInvalidJson() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); $this->expectExceptionMessage('Syntax error'); - $processor = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\EnvVarProcessor(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container()); + $processor = new EnvVarProcessor(new Container()); $processor->getEnv('json', 'foo', function ($name) { $this->assertSame('foo', $name); return 'invalid_json'; @@ -177,21 +181,21 @@ public function testGetEnvJsonOther($value) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); $this->expectExceptionMessage('Invalid JSON env var'); - $processor = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\EnvVarProcessor(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container()); + $processor = new EnvVarProcessor(new Container()); $processor->getEnv('json', 'foo', function ($name) use($value) { $this->assertSame('foo', $name); - return \json_encode($value); + return json_encode($value); }); } public function otherJsonValues() { - return [[1], [1.1], [\true], [\false]]; + return [[1], [1.1], [true], [false]]; } public function testGetEnvUnknown() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); $this->expectExceptionMessage('Unsupported env var prefix'); - $processor = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\EnvVarProcessor(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container()); + $processor = new EnvVarProcessor(new Container()); $processor->getEnv('unknown', 'foo', function ($name) { $this->assertSame('foo', $name); return 'foo'; diff --git a/vendor/symfony/dependency-injection/Tests/Extension/ExtensionTest.php b/vendor/symfony/dependency-injection/Tests/Extension/ExtensionTest.php index 32349b4bc..5736dd68c 100644 --- a/vendor/symfony/dependency-injection/Tests/Extension/ExtensionTest.php +++ b/vendor/symfony/dependency-injection/Tests/Extension/ExtensionTest.php @@ -13,34 +13,34 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Extension\Extension; -class ExtensionTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class ExtensionTest extends TestCase { /** * @dataProvider getResolvedEnabledFixtures */ public function testIsConfigEnabledReturnsTheResolvedValue($enabled) { - $extension = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Extension\EnableableExtension(); - $this->assertSame($enabled, $extension->isConfigEnabled(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), ['enabled' => $enabled])); + $extension = new EnableableExtension(); + $this->assertSame($enabled, $extension->isConfigEnabled(new ContainerBuilder(), ['enabled' => $enabled])); } public function getResolvedEnabledFixtures() { - return [[\true], [\false]]; + return [[true], [false]]; } public function testIsConfigEnabledOnNonEnableableConfig() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('The config array has no \'enabled\' key.'); - $extension = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Extension\EnableableExtension(); - $extension->isConfigEnabled(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), []); + $extension = new EnableableExtension(); + $extension->isConfigEnabled(new ContainerBuilder(), []); } } -class EnableableExtension extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Extension\Extension +class EnableableExtension extends Extension { - public function load(array $configs, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container) { } - public function isConfigEnabled(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container, array $config) + public function isConfigEnabled(ContainerBuilder $container, array $config) { return parent::isConfigEnabled($container, $config); } diff --git a/vendor/symfony/dependency-injection/Tests/Extension/index.php b/vendor/symfony/dependency-injection/Tests/Extension/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Extension/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/Bar.php b/vendor/symfony/dependency-injection/Tests/Fixtures/Bar.php index 65861af98..6553a13ad 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/Bar.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/Bar.php @@ -10,14 +10,16 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures; -class Bar implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\BarInterface +use _PhpScoper5ea00cc67502b\NonExistent; + +class Bar implements BarInterface { public $quz; - public function __construct($quz = null, \_PhpScoper5ea00cc67502b\NonExistent $nonExistent = null, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\BarInterface $decorated = null, array $foo = []) + public function __construct($quz = null, NonExistent $nonExistent = null, BarInterface $decorated = null, array $foo = []) { $this->quz = $quz; } - public static function create(\_PhpScoper5ea00cc67502b\NonExistent $nonExistent = null, $factory = null) + public static function create(NonExistent $nonExistent = null, $factory = null) { } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/Container/NoConstructorContainer.php b/vendor/symfony/dependency-injection/Tests/Fixtures/Container/NoConstructorContainer.php index 9b69a47ee..2c35c7034 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/Container/NoConstructorContainer.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/Container/NoConstructorContainer.php @@ -3,6 +3,6 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Container; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container; -class NoConstructorContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class NoConstructorContainer extends Container { } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/Container/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/Container/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/Container/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/CustomDefinition.php b/vendor/symfony/dependency-injection/Tests/Fixtures/CustomDefinition.php index 3fdf8892d..d46526bc3 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/CustomDefinition.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/CustomDefinition.php @@ -11,6 +11,6 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; -class CustomDefinition extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition +class CustomDefinition extends Definition { } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/DeprecatedClass.php b/vendor/symfony/dependency-injection/Tests/Fixtures/DeprecatedClass.php index 524ca801c..a656e9b7d 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/DeprecatedClass.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/DeprecatedClass.php @@ -10,7 +10,10 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures; -@\trigger_error('deprecated', \E_USER_DEPRECATED); +use function trigger_error; +use const E_USER_DEPRECATED; + +@trigger_error('deprecated', E_USER_DEPRECATED); class DeprecatedClass { } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/FactoryDummy.php b/vendor/symfony/dependency-injection/Tests/Fixtures/FactoryDummy.php index 89ebd4d63..139c3cce4 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/FactoryDummy.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/FactoryDummy.php @@ -10,12 +10,14 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures; -class FactoryDummy extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryParent +use stdClass; + +class FactoryDummy extends FactoryParent { - public static function createFactory() : \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummy + public static function createFactory() : FactoryDummy { } - public function create() : \stdClass + public function create() : stdClass { } // Not supported by hhvm @@ -32,6 +34,6 @@ public static function createParent() : \_PhpScoper5ea00cc67502b\parent class FactoryParent { } -function factoryFunction() : \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummy +function factoryFunction() : FactoryDummy { } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/FooForCircularWithAddCalls.php b/vendor/symfony/dependency-injection/Tests/Fixtures/FooForCircularWithAddCalls.php index 51e3ebb7f..84536daa5 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/FooForCircularWithAddCalls.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/FooForCircularWithAddCalls.php @@ -10,9 +10,11 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures; +use stdClass; + class FooForCircularWithAddCalls { - public function call(\stdClass $argument) + public function call(stdClass $argument) { } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/NamedArgumentsDummy.php b/vendor/symfony/dependency-injection/Tests/Fixtures/NamedArgumentsDummy.php index 281a688dc..a0186cc3e 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/NamedArgumentsDummy.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/NamedArgumentsDummy.php @@ -7,13 +7,13 @@ */ class NamedArgumentsDummy { - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass $c, $apiKey, $hostName) + public function __construct(CaseSensitiveClass $c, $apiKey, $hostName) { } public function setApiKey($apiKey) { } - public function setSensitiveClass(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass $c) + public function setSensitiveClass(CaseSensitiveClass $c) { } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/ParentNotExists.php b/vendor/symfony/dependency-injection/Tests/Fixtures/ParentNotExists.php index 356610961..df7098f78 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/ParentNotExists.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/ParentNotExists.php @@ -2,6 +2,8 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures; -class ParentNotExists extends \_PhpScoper5ea00cc67502b\NotExists +use _PhpScoper5ea00cc67502b\NotExists; + +class ParentNotExists extends NotExists { } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/BadClasses/MissingParent.php b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/BadClasses/MissingParent.php index d7265a2cb..2ac7b55b7 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/BadClasses/MissingParent.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/BadClasses/MissingParent.php @@ -2,6 +2,6 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\BadClasses; -class MissingParent extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\BadClasses\MissingClass +class MissingParent extends MissingClass { } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/BadClasses/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/BadClasses/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/BadClasses/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/Foo.php b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/Foo.php index 318831c01..2fbb1fceb 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/Foo.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/Foo.php @@ -2,7 +2,9 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype; -class Foo implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\FooInterface, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\BarInterface +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\BarInterface; + +class Foo implements FooInterface, BarInterface { public function __construct($bar = null) { diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/OtherDir/AnotherSub/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/OtherDir/AnotherSub/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/OtherDir/AnotherSub/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/OtherDir/Component1/Dir1/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/OtherDir/Component1/Dir1/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/OtherDir/Component1/Dir1/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/OtherDir/Component1/Dir2/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/OtherDir/Component1/Dir2/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/OtherDir/Component1/Dir2/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/OtherDir/Component1/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/OtherDir/Component1/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/OtherDir/Component1/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/OtherDir/Component2/Dir1/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/OtherDir/Component2/Dir1/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/OtherDir/Component2/Dir1/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/OtherDir/Component2/Dir2/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/OtherDir/Component2/Dir2/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/OtherDir/Component2/Dir2/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/OtherDir/Component2/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/OtherDir/Component2/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/OtherDir/Component2/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/OtherDir/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/OtherDir/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/OtherDir/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/Sub/Bar.php b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/Sub/Bar.php index cdfd5293d..864c6a987 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/Sub/Bar.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/Sub/Bar.php @@ -2,6 +2,6 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub; -class Bar implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\BarInterface +class Bar implements BarInterface { } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/Sub/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/Sub/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/Sub/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/Prototype/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/SimilarArgumentsDummy.php b/vendor/symfony/dependency-injection/Tests/Fixtures/SimilarArgumentsDummy.php index 1d029a763..e4516d850 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/SimilarArgumentsDummy.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/SimilarArgumentsDummy.php @@ -14,7 +14,7 @@ class SimilarArgumentsDummy { public $class1; public $class2; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass $class1, $token, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass $class2) + public function __construct(CaseSensitiveClass $class1, $token, CaseSensitiveClass $class2) { $this->class1 = $class1; $this->class2 = $class2; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/StubbedTranslator.php b/vendor/symfony/dependency-injection/Tests/Fixtures/StubbedTranslator.php index 9b11185e6..6a9f1eb0f 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/StubbedTranslator.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/StubbedTranslator.php @@ -16,7 +16,7 @@ */ class StubbedTranslator { - public function __construct(\_PhpScoper5ea00cc67502b\Psr\Container\ContainerInterface $container) + public function __construct(ContainerInterface $container) { } public function addResource($format, $resource, $locale, $domain = null) diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/TestDefinition1.php b/vendor/symfony/dependency-injection/Tests/Fixtures/TestDefinition1.php index c9bb56dd6..8875d9283 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/TestDefinition1.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/TestDefinition1.php @@ -11,6 +11,6 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; -class TestDefinition1 extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition +class TestDefinition1 extends Definition { } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/TestDefinition2.php b/vendor/symfony/dependency-injection/Tests/Fixtures/TestDefinition2.php index cbcf5deb7..c411b6cda 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/TestDefinition2.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/TestDefinition2.php @@ -3,6 +3,6 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; -class TestDefinition2 extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition +class TestDefinition2 extends Definition { } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/TestServiceSubscriber.php b/vendor/symfony/dependency-injection/Tests/Fixtures/TestServiceSubscriber.php index 136cc9a3b..f5cdc2dcf 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/TestServiceSubscriber.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/TestServiceSubscriber.php @@ -3,13 +3,13 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceSubscriberInterface; -class TestServiceSubscriber implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceSubscriberInterface +class TestServiceSubscriber implements ServiceSubscriberInterface { public function __construct($container) { } public static function getSubscribedServices() { - return [__CLASS__, '?' . \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition::class, 'bar' => \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition::class, 'baz' => '?' . \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition::class]; + return [__CLASS__, '?' . CustomDefinition::class, 'bar' => CustomDefinition::class, 'baz' => '?' . CustomDefinition::class]; } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/config/basic.php b/vendor/symfony/dependency-injection/Tests/Fixtures/config/basic.php index 252eec68c..7427bb0cb 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/config/basic.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/config/basic.php @@ -3,7 +3,7 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator; use _PhpScoper5ea00cc67502b\App\BarService; -return function (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator $c) { +return function (ContainerConfigurator $c) { $s = $c->services(); - $s->set(\_PhpScoper5ea00cc67502b\App\BarService::class)->args([inline('FooClass')]); + $s->set(BarService::class)->args([inline('FooClass')]); }; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/config/child.php b/vendor/symfony/dependency-injection/Tests/Fixtures/config/child.php index a7fa866cb..4c3897fce 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/config/child.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/config/child.php @@ -3,6 +3,6 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator; use _PhpScoper5ea00cc67502b\App\BarService; -return function (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator $c) { - $c->services()->set('bar', 'Class1')->set(\_PhpScoper5ea00cc67502b\App\BarService::class)->abstract(\true)->lazy()->set('foo')->parent(\_PhpScoper5ea00cc67502b\App\BarService::class)->decorate('bar', 'b', 1)->args([ref('b')])->class('Class2')->file('file.php')->parent('bar')->parent(\_PhpScoper5ea00cc67502b\App\BarService::class); +return function (ContainerConfigurator $c) { + $c->services()->set('bar', 'Class1')->set(BarService::class)->abstract(true)->lazy()->set('foo')->parent(BarService::class)->decorate('bar', 'b', 1)->args([ref('b')])->class('Class2')->file('file.php')->parent('bar')->parent(BarService::class); }; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/config/defaults.php b/vendor/symfony/dependency-injection/Tests/Fixtures/config/defaults.php index 77f0965d9..040eb00e6 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/config/defaults.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/config/defaults.php @@ -3,9 +3,9 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo; -return function (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator $c) { +return function (ContainerConfigurator $c) { $c->import('basic.php'); - $s = $c->services()->defaults()->public()->private()->autoconfigure()->autowire()->tag('t', ['a' => 'b'])->bind(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo::class, ref('bar'))->private(); - $s->set(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo::class)->args([ref('bar')])->public(); - $s->set('bar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo::class)->call('setFoo')->autoconfigure(\false); + $s = $c->services()->defaults()->public()->private()->autoconfigure()->autowire()->tag('t', ['a' => 'b'])->bind(Foo::class, ref('bar'))->private(); + $s->set(Foo::class)->args([ref('bar')])->public(); + $s->set('bar', Foo::class)->call('setFoo')->autoconfigure(false); }; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/config/factory_short_notation.php b/vendor/symfony/dependency-injection/Tests/Fixtures/config/factory_short_notation.php index 27ec3bb8a..045cb0a48 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/config/factory_short_notation.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/config/factory_short_notation.php @@ -2,6 +2,8 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator; -return function (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator $c) { - $c->services()->set('service', \stdClass::class)->factory('factory:method'); +use stdClass; + +return function (ContainerConfigurator $c) { + $c->services()->set('service', stdClass::class)->factory('factory:method'); }; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/config/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/config/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/config/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/config/instanceof.php b/vendor/symfony/dependency-injection/Tests/Fixtures/config/instanceof.php index 605548b66..61b32cf27 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/config/instanceof.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/config/instanceof.php @@ -4,9 +4,11 @@ use _PhpScoper5ea00cc67502b\App\FooService; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype; -return function (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator $c) { +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo; + +return function (ContainerConfigurator $c) { $s = $c->services(); - $s->instanceof(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo::class)->property('p', 0)->call('setFoo', [ref('foo')])->tag('tag', ['k' => 'v'])->share(\false)->lazy()->configurator('c')->property('p', 1); - $s->load(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype::class . '\\', '../Prototype')->exclude('../Prototype/*/*'); - $s->set('foo', \_PhpScoper5ea00cc67502b\App\FooService::class); + $s->instanceof(Foo::class)->property('p', 0)->call('setFoo', [ref('foo')])->tag('tag', ['k' => 'v'])->share(false)->lazy()->configurator('c')->property('p', 1); + $s->load(Prototype::class . '\\', '../Prototype')->exclude('../Prototype/*/*'); + $s->set('foo', FooService::class); }; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/config/php7.php b/vendor/symfony/dependency-injection/Tests/Fixtures/config/php7.php index 54291fa5b..af3c2df41 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/config/php7.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/config/php7.php @@ -3,7 +3,7 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo; -return function (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator $c) { +return function (ContainerConfigurator $c) { $c->parameters()('foo', 'Foo')('bar', 'Bar'); - $c->services()(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo::class)->arg('$bar', ref('bar'))->public()('bar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo::class)->call('setFoo'); + $c->services()(Foo::class)->arg('$bar', ref('bar'))->public()('bar', Foo::class)->call('setFoo'); }; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/config/prototype.php b/vendor/symfony/dependency-injection/Tests/Fixtures/config/prototype.php index fe228e7b7..cdb5c20ef 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/config/prototype.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/config/prototype.php @@ -3,9 +3,11 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype; -return function (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator $c) { +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo; + +return function (ContainerConfigurator $c) { $di = $c->services()->defaults()->tag('baz'); - $di->load(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype::class . '\\', '../Prototype')->autoconfigure()->exclude('../Prototype/{OtherDir,BadClasses}')->factory('f')->deprecate('%service_id%')->args([0])->args([1])->autoconfigure(\false)->tag('foo')->parent('foo'); + $di->load(Prototype::class . '\\', '../Prototype')->autoconfigure()->exclude('../Prototype/{OtherDir,BadClasses}')->factory('f')->deprecate('%service_id%')->args([0])->args([1])->autoconfigure(false)->tag('foo')->parent('foo'); $di->set('foo')->lazy()->abstract(); - $di->get(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo::class)->lazy(\false); + $di->get(Foo::class)->lazy(false); }; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/config/services9.php b/vendor/symfony/dependency-injection/Tests/Fixtures/config/services9.php index 1729a3efb..c1a7b2422 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/config/services9.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/config/services9.php @@ -4,18 +4,20 @@ use _PhpScoper5ea00cc67502b\Bar\FooClass; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Parameter; +use function realpath; + require_once __DIR__ . '/../includes/classes.php'; require_once __DIR__ . '/../includes/foo.php'; -return function (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator $c) { +return function (ContainerConfigurator $c) { $p = $c->parameters(); $p->set('baz_class', 'BazClass'); - $p->set('foo_class', \_PhpScoper5ea00cc67502b\Bar\FooClass::class)->set('foo', 'bar'); + $p->set('foo_class', FooClass::class)->set('foo', 'bar'); $s = $c->services(); - $s->set('foo')->args(['foo', ref('foo.baz'), ['%foo%' => 'foo is %foo%', 'foobar' => '%foo%'], \true, ref('service_container')])->class(\_PhpScoper5ea00cc67502b\Bar\FooClass::class)->tag('foo', ['foo' => 'foo'])->tag('foo', ['bar' => 'bar', 'baz' => 'baz'])->factory([\_PhpScoper5ea00cc67502b\Bar\FooClass::class, 'getInstance'])->property('foo', 'bar')->property('moo', ref('foo.baz'))->property('qux', ['%foo%' => 'foo is %foo%', 'foobar' => '%foo%'])->call('setBar', [ref('bar')])->call('initialize')->configurator('sc_configure'); + $s->set('foo')->args(['foo', ref('foo.baz'), ['%foo%' => 'foo is %foo%', 'foobar' => '%foo%'], true, ref('service_container')])->class(FooClass::class)->tag('foo', ['foo' => 'foo'])->tag('foo', ['bar' => 'bar', 'baz' => 'baz'])->factory([FooClass::class, 'getInstance'])->property('foo', 'bar')->property('moo', ref('foo.baz'))->property('qux', ['%foo%' => 'foo is %foo%', 'foobar' => '%foo%'])->call('setBar', [ref('bar')])->call('initialize')->configurator('sc_configure'); $s->set('foo.baz', '%baz_class%')->factory(['%baz_class%', 'getInstance'])->configurator(['%baz_class%', 'configureStatic1']); - $s->set('bar', \_PhpScoper5ea00cc67502b\Bar\FooClass::class)->args(['foo', ref('foo.baz'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Parameter('foo_bar')])->configurator([ref('foo.baz'), 'configure']); - $s->set('foo_bar', '%foo_class%')->args([ref('deprecated_service')])->share(\false); - $s->set('method_call1', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->file(\realpath(__DIR__ . '/../includes/foo.php'))->call('setBar', [ref('foo')])->call('setBar', [ref('foo2')->nullOnInvalid()])->call('setBar', [ref('foo3')->ignoreOnInvalid()])->call('setBar', [ref('foobaz')->ignoreOnInvalid()])->call('setBar', [expr('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')]); + $s->set('bar', FooClass::class)->args(['foo', ref('foo.baz'), new Parameter('foo_bar')])->configurator([ref('foo.baz'), 'configure']); + $s->set('foo_bar', '%foo_class%')->args([ref('deprecated_service')])->share(false); + $s->set('method_call1', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->file(realpath(__DIR__ . '/../includes/foo.php'))->call('setBar', [ref('foo')])->call('setBar', [ref('foo2')->nullOnInvalid()])->call('setBar', [ref('foo3')->ignoreOnInvalid()])->call('setBar', [ref('foobaz')->ignoreOnInvalid()])->call('setBar', [expr('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')]); $s->set('foo_with_inline', 'Foo')->call('setBar', [ref('inlined')]); $s->set('inlined', 'Bar')->property('pub', 'pub')->call('setBaz', [ref('baz')])->private(); $s->set('baz', 'Baz')->call('setFoo', [ref('foo_with_inline')]); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/config/services_autoconfigure_with_parent.php b/vendor/symfony/dependency-injection/Tests/Fixtures/config/services_autoconfigure_with_parent.php index 8119eadf2..51fb7eaa3 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/config/services_autoconfigure_with_parent.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/config/services_autoconfigure_with_parent.php @@ -2,6 +2,8 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator; -return function (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator $c) { - $c->services()->set('parent_service', \stdClass::class)->set('child_service')->parent('parent_service')->autoconfigure(\true); +use stdClass; + +return function (ContainerConfigurator $c) { + $c->services()->set('parent_service', stdClass::class)->set('child_service')->parent('parent_service')->autoconfigure(true); }; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/CustomContainer.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/CustomContainer.php index 5ee7f3c4d..9e41e09f3 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/CustomContainer.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/CustomContainer.php @@ -4,7 +4,7 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; -class CustomContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class CustomContainer extends Container { public function getBarService() { diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container10.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container10.php index 7aebb34e3..b090bf154 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container10.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container10.php @@ -5,6 +5,6 @@ require_once __DIR__ . '/../includes/classes.php'; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; -$container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); -$container->register('foo', 'FooClass')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar'))->setPublic(\true); +$container = new ContainerBuilder(); +$container->register('foo', 'FooClass')->addArgument(new Reference('bar'))->setPublic(true); return $container; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container11.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container11.php index c66adf959..b4828a29d 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container11.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container11.php @@ -4,6 +4,6 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; -$container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); -$container->register('foo', 'FooClass')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('BarClass', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('BazClass')]))->setPublic(\true); +$container = new ContainerBuilder(); +$container->register('foo', 'FooClass')->addArgument(new Definition('BarClass', [new Definition('BazClass')]))->setPublic(true); return $container; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container12.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container12.php index 849ea332e..479db0023 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container12.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container12.php @@ -3,6 +3,6 @@ namespace _PhpScoper5ea00cc67502b; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; -$container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); -$container->register('foo', '_PhpScoper5ea00cc67502b\\FooClass\\Foo')->addArgument('foo<>&bar')->addTag('_PhpScoper5ea00cc67502b\\foo"bar\\bar', ['foo' => 'foo"barřž€'])->setPublic(\true); +$container = new ContainerBuilder(); +$container->register('foo', '_PhpScoper5ea00cc67502b\\FooClass\\Foo')->addArgument('foo<>&bar')->addTag('_PhpScoper5ea00cc67502b\\foo"bar\\bar', ['foo' => 'foo"barřž€'])->setPublic(true); return $container; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container13.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container13.php index 5b7fa14c5..88aabc082 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container13.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container13.php @@ -4,8 +4,8 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; -$container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); -$container->register('foo', 'FooClass')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar'))->setPublic(\true); -$container->register('bar', 'BarClass')->setPublic(\true); +$container = new ContainerBuilder(); +$container->register('foo', 'FooClass')->addArgument(new Reference('bar'))->setPublic(true); +$container->register('bar', 'BarClass')->setPublic(true); $container->compile(); return $container; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container14.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container14.php index 6e31168dc..f351c632b 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container14.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container14.php @@ -3,13 +3,15 @@ namespace _PhpScoper5ea00cc67502b\Container14; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; +use function class_exists; + /* * This file is included in Tests\Dumper\GraphvizDumperTest::testDumpWithFrozenCustomClassContainer * and Tests\Dumper\XmlDumperTest::testCompiledContainerCanBeDumped. */ -if (!\class_exists('_PhpScoper5ea00cc67502b\\Container14\\ProjectServiceContainer')) { - class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder +if (!class_exists('_PhpScoper5ea00cc67502b\\Container14\\ProjectServiceContainer')) { + class ProjectServiceContainer extends ContainerBuilder { } } -return new \_PhpScoper5ea00cc67502b\Container14\ProjectServiceContainer(); +return new ProjectServiceContainer(); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container15.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container15.php index f83df887b..a18c355b1 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container15.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container15.php @@ -3,6 +3,6 @@ namespace _PhpScoper5ea00cc67502b; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; -$container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); -$container->register('foo', '_PhpScoper5ea00cc67502b\\FooClass\\Foo')->setDecoratedService('bar', 'bar.woozy')->setPublic(\true); +$container = new ContainerBuilder(); +$container->register('foo', '_PhpScoper5ea00cc67502b\\FooClass\\Foo')->setDecoratedService('bar', 'bar.woozy')->setPublic(true); return $container; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container16.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container16.php index 74b2f61d4..ee3c53d8c 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container16.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container16.php @@ -3,6 +3,6 @@ namespace _PhpScoper5ea00cc67502b; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; -$container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); -$container->register('foo', '_PhpScoper5ea00cc67502b\\FooClass\\Foo')->setDecoratedService('bar')->setPublic(\true); +$container = new ContainerBuilder(); +$container->register('foo', '_PhpScoper5ea00cc67502b\\FooClass\\Foo')->setDecoratedService('bar')->setPublic(true); return $container; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container17.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container17.php index eaf2d4ee9..c75741c77 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container17.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container17.php @@ -3,6 +3,6 @@ namespace _PhpScoper5ea00cc67502b; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; -$container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); -$container->register('foo', '%foo.class%')->setPublic(\true); +$container = new ContainerBuilder(); +$container->register('foo', '%foo.class%')->setPublic(true); return $container; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container19.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container19.php index 590c6aab2..97e2e32ef 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container19.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container19.php @@ -5,11 +5,11 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; require_once __DIR__ . '/../includes/classes.php'; -$container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); +$container = new ContainerBuilder(); $container->setParameter('env(FOO)', '_PhpScoper5ea00cc67502b\\Bar\\FaooClass'); $container->setParameter('foo', '%env(FOO)%'); -$container->register('service_from_anonymous_factory', '%foo%')->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('%foo%'), 'getInstance'])->setPublic(\true); -$anonymousServiceWithFactory = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('_PhpScoper5ea00cc67502b\\Bar\\FooClass'); +$container->register('service_from_anonymous_factory', '%foo%')->setFactory([new Definition('%foo%'), 'getInstance'])->setPublic(true); +$anonymousServiceWithFactory = new Definition('_PhpScoper5ea00cc67502b\\Bar\\FooClass'); $anonymousServiceWithFactory->setFactory('Bar\\FooClass::getInstance'); -$container->register('service_with_method_call_and_factory', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->addMethodCall('setBar', [$anonymousServiceWithFactory])->setPublic(\true); +$container->register('service_with_method_call_and_factory', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->addMethodCall('setBar', [$anonymousServiceWithFactory])->setPublic(true); return $container; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container21.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container21.php index 974814b91..ffe5e6496 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container21.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container21.php @@ -4,10 +4,10 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; -$container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); -$bar = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('Bar'); -$bar->setConfigurator([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('Baz'), 'configureBar']); -$fooFactory = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('FooFactory'); -$fooFactory->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('Foobar'), 'createFooFactory']); -$container->register('foo', 'Foo')->setFactory([$fooFactory, 'createFoo'])->setConfigurator([$bar, 'configureFoo'])->setPublic(\true); +$container = new ContainerBuilder(); +$bar = new Definition('Bar'); +$bar->setConfigurator([new Definition('Baz'), 'configureBar']); +$fooFactory = new Definition('FooFactory'); +$fooFactory->setFactory([new Definition('Foobar'), 'createFooFactory']); +$container->register('foo', 'Foo')->setFactory([$fooFactory, 'createFoo'])->setConfigurator([$bar, 'configureFoo'])->setPublic(true); return $container; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container24.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container24.php index d07ba70d6..5d23b8002 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container24.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container24.php @@ -3,6 +3,6 @@ namespace _PhpScoper5ea00cc67502b; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; -$container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); -$container->register('foo', 'Foo')->setAutowired(\true)->setPublic(\true); +$container = new ContainerBuilder(); +$container->register('foo', 'Foo')->setAutowired(true)->setPublic(true); return $container; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container33.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container33.php index 8f155c3e1..1bc207d0c 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container33.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container33.php @@ -2,8 +2,9 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Container33; +use _PhpScoper5ea00cc67502b\Bar\Foo; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; -$container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); -$container->register(\_PhpScoper5ea00cc67502b\Foo\Foo::class)->setPublic(\true); -$container->register(\_PhpScoper5ea00cc67502b\Bar\Foo::class)->setPublic(\true); +$container = new ContainerBuilder(); +$container->register(\_PhpScoper5ea00cc67502b\Foo\Foo::class)->setPublic(true); +$container->register(Foo::class)->setPublic(true); return $container; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container8.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container8.php index edb43c928..7f952a0b7 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container8.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container8.php @@ -4,5 +4,5 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; -$container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => '%baz%', 'baz' => 'bar', 'bar' => 'foo is %%foo bar', 'escape' => '@escapeme', 'values' => [\true, \false, null, 0, 1000.3, 'true', 'false', 'null'], 'null string' => 'null', 'string of digits' => '123', 'string of digits prefixed with minus character' => '-123', 'true string' => 'true', 'false string' => 'false', 'binary number string' => '0b0110', 'numeric string' => '-1.2E2', 'hexadecimal number string' => '0xFF', 'float string' => '10100.1', 'positive float string' => '+10100.1', 'negative float string' => '-10100.1'])); +$container = new ContainerBuilder(new ParameterBag(['foo' => '%baz%', 'baz' => 'bar', 'bar' => 'foo is %%foo bar', 'escape' => '@escapeme', 'values' => [true, false, null, 0, 1000.3, 'true', 'false', 'null'], 'null string' => 'null', 'string of digits' => '123', 'string of digits prefixed with minus character' => '-123', 'true string' => 'true', 'false string' => 'false', 'binary number string' => '0b0110', 'numeric string' => '-1.2E2', 'hexadecimal number string' => '0xFF', 'float string' => '10100.1', 'positive float string' => '+10100.1', 'negative float string' => '-10100.1'])); return $container; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container9.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container9.php index 4cedc76d2..2f4195118 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container9.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container9.php @@ -11,36 +11,38 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Parameter; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression; -$container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); -$container->register('foo', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->addTag('foo', ['foo' => 'foo'])->addTag('foo', ['bar' => 'bar', 'baz' => 'baz'])->setFactory(['_PhpScoper5ea00cc67502b\\Bar\\FooClass', 'getInstance'])->setArguments(['foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo.baz'), ['%foo%' => 'foo is %foo%', 'foobar' => '%foo%'], \true, new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('service_container')])->setProperties(['foo' => 'bar', 'moo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo.baz'), 'qux' => ['%foo%' => 'foo is %foo%', 'foobar' => '%foo%']])->addMethodCall('setBar', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar')])->addMethodCall('initialize')->setConfigurator('sc_configure')->setPublic(\true); -$container->register('foo.baz', '%baz_class%')->setFactory(['%baz_class%', 'getInstance'])->setConfigurator(['%baz_class%', 'configureStatic1'])->setPublic(\true); -$container->register('bar', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->setArguments(['foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo.baz'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Parameter('foo_bar')])->setConfigurator([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo.baz'), 'configure'])->setPublic(\true); -$container->register('foo_bar', '%foo_class%')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('deprecated_service'))->setShared(\false)->setPublic(\true); +use function realpath; + +$container = new ContainerBuilder(); +$container->register('foo', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->addTag('foo', ['foo' => 'foo'])->addTag('foo', ['bar' => 'bar', 'baz' => 'baz'])->setFactory(['_PhpScoper5ea00cc67502b\\Bar\\FooClass', 'getInstance'])->setArguments(['foo', new Reference('foo.baz'), ['%foo%' => 'foo is %foo%', 'foobar' => '%foo%'], true, new Reference('service_container')])->setProperties(['foo' => 'bar', 'moo' => new Reference('foo.baz'), 'qux' => ['%foo%' => 'foo is %foo%', 'foobar' => '%foo%']])->addMethodCall('setBar', [new Reference('bar')])->addMethodCall('initialize')->setConfigurator('sc_configure')->setPublic(true); +$container->register('foo.baz', '%baz_class%')->setFactory(['%baz_class%', 'getInstance'])->setConfigurator(['%baz_class%', 'configureStatic1'])->setPublic(true); +$container->register('bar', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->setArguments(['foo', new Reference('foo.baz'), new Parameter('foo_bar')])->setConfigurator([new Reference('foo.baz'), 'configure'])->setPublic(true); +$container->register('foo_bar', '%foo_class%')->addArgument(new Reference('deprecated_service'))->setShared(false)->setPublic(true); $container->getParameterBag()->clear(); $container->getParameterBag()->add(['baz_class' => 'BazClass', 'foo_class' => '_PhpScoper5ea00cc67502b\\Bar\\FooClass', 'foo' => 'bar']); -$container->register('method_call1', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->setFile(\realpath(__DIR__ . '/../includes/foo.php'))->addMethodCall('setBar', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo')])->addMethodCall('setBar', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo2', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::NULL_ON_INVALID_REFERENCE)])->addMethodCall('setBar', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo3', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE)])->addMethodCall('setBar', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foobaz', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE)])->addMethodCall('setBar', [new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')])->setPublic(\true); -$container->register('foo_with_inline', 'Foo')->addMethodCall('setBar', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('inlined')])->setPublic(\true); -$container->register('inlined', 'Bar')->setProperty('pub', 'pub')->addMethodCall('setBaz', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz')])->setPublic(\false); -$container->register('baz', 'Baz')->addMethodCall('setFoo', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo_with_inline')])->setPublic(\true); -$container->register('request', 'Request')->setSynthetic(\true)->setPublic(\true); -$container->register('configurator_service', 'ConfClass')->setPublic(\false)->addMethodCall('setFoo', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz')]); -$container->register('configured_service', 'stdClass')->setConfigurator([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('configurator_service'), 'configureStdClass'])->setPublic(\true); -$container->register('configurator_service_simple', 'ConfClass')->addArgument('bar')->setPublic(\false); -$container->register('configured_service_simple', 'stdClass')->setConfigurator([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('configurator_service_simple'), 'configureStdClass'])->setPublic(\true); -$container->register('decorated', 'stdClass')->setPublic(\true); -$container->register('decorator_service', 'stdClass')->setDecoratedService('decorated')->setPublic(\true); -$container->register('decorator_service_with_name', 'stdClass')->setDecoratedService('decorated', 'decorated.pif-pouf')->setPublic(\true); -$container->register('deprecated_service', 'stdClass')->setDeprecated(\true)->setPublic(\true); -$container->register('new_factory', 'FactoryClass')->setProperty('foo', 'bar')->setPublic(\false); -$container->register('factory_service', 'Bar')->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo.baz'), 'getInstance'])->setPublic(\true); -$container->register('new_factory_service', 'FooBarBaz')->setProperty('foo', 'bar')->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('new_factory'), 'getInstance'])->setPublic(\true); -$container->register('service_from_static_method', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->setFactory(['_PhpScoper5ea00cc67502b\\Bar\\FooClass', 'getInstance'])->setPublic(\true); -$container->register('factory_simple', 'SimpleFactoryClass')->addArgument('foo')->setDeprecated(\true)->setPublic(\false); -$container->register('factory_service_simple', 'Bar')->setFactory([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('factory_simple'), 'getInstance'])->setPublic(\true); -$container->register('lazy_context', 'LazyContext')->setArguments([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument(['k1' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo.baz'), 'k2' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('service_container')]), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument([])])->setPublic(\true); -$container->register('lazy_context_ignore_invalid_ref', 'LazyContext')->setArguments([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo.baz'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('invalid', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument([])])->setPublic(\true); -$container->register('tagged_iterator_foo', 'Bar')->addTag('foo')->setPublic(\false); -$container->register('tagged_iterator', 'Bar')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument('foo'))->setPublic(\true); -$container->setAlias('alias_for_foo', 'foo')->setPublic(\true); -$container->setAlias('alias_for_alias', 'alias_for_foo')->setPublic(\true); +$container->register('method_call1', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->setFile(realpath(__DIR__ . '/../includes/foo.php'))->addMethodCall('setBar', [new Reference('foo')])->addMethodCall('setBar', [new Reference('foo2', ContainerInterface::NULL_ON_INVALID_REFERENCE)])->addMethodCall('setBar', [new Reference('foo3', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)])->addMethodCall('setBar', [new Reference('foobaz', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)])->addMethodCall('setBar', [new Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')])->setPublic(true); +$container->register('foo_with_inline', 'Foo')->addMethodCall('setBar', [new Reference('inlined')])->setPublic(true); +$container->register('inlined', 'Bar')->setProperty('pub', 'pub')->addMethodCall('setBaz', [new Reference('baz')])->setPublic(false); +$container->register('baz', 'Baz')->addMethodCall('setFoo', [new Reference('foo_with_inline')])->setPublic(true); +$container->register('request', 'Request')->setSynthetic(true)->setPublic(true); +$container->register('configurator_service', 'ConfClass')->setPublic(false)->addMethodCall('setFoo', [new Reference('baz')]); +$container->register('configured_service', 'stdClass')->setConfigurator([new Reference('configurator_service'), 'configureStdClass'])->setPublic(true); +$container->register('configurator_service_simple', 'ConfClass')->addArgument('bar')->setPublic(false); +$container->register('configured_service_simple', 'stdClass')->setConfigurator([new Reference('configurator_service_simple'), 'configureStdClass'])->setPublic(true); +$container->register('decorated', 'stdClass')->setPublic(true); +$container->register('decorator_service', 'stdClass')->setDecoratedService('decorated')->setPublic(true); +$container->register('decorator_service_with_name', 'stdClass')->setDecoratedService('decorated', 'decorated.pif-pouf')->setPublic(true); +$container->register('deprecated_service', 'stdClass')->setDeprecated(true)->setPublic(true); +$container->register('new_factory', 'FactoryClass')->setProperty('foo', 'bar')->setPublic(false); +$container->register('factory_service', 'Bar')->setFactory([new Reference('foo.baz'), 'getInstance'])->setPublic(true); +$container->register('new_factory_service', 'FooBarBaz')->setProperty('foo', 'bar')->setFactory([new Reference('new_factory'), 'getInstance'])->setPublic(true); +$container->register('service_from_static_method', '_PhpScoper5ea00cc67502b\\Bar\\FooClass')->setFactory(['_PhpScoper5ea00cc67502b\\Bar\\FooClass', 'getInstance'])->setPublic(true); +$container->register('factory_simple', 'SimpleFactoryClass')->addArgument('foo')->setDeprecated(true)->setPublic(false); +$container->register('factory_service_simple', 'Bar')->setFactory([new Reference('factory_simple'), 'getInstance'])->setPublic(true); +$container->register('lazy_context', 'LazyContext')->setArguments([new IteratorArgument(['k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container')]), new IteratorArgument([])])->setPublic(true); +$container->register('lazy_context_ignore_invalid_ref', 'LazyContext')->setArguments([new IteratorArgument([new Reference('foo.baz'), new Reference('invalid', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]), new IteratorArgument([])])->setPublic(true); +$container->register('tagged_iterator_foo', 'Bar')->addTag('foo')->setPublic(false); +$container->register('tagged_iterator', 'Bar')->addArgument(new TaggedIteratorArgument('foo'))->setPublic(true); +$container->setAlias('alias_for_foo', 'foo')->setPublic(true); +$container->setAlias('alias_for_alias', 'alias_for_foo')->setPublic(true); return $container; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_abstract.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_abstract.php index 850e52984..d43388278 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_abstract.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_abstract.php @@ -3,6 +3,6 @@ namespace _PhpScoper5ea00cc67502b; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; -$container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); -$container->register('foo', 'Foo')->setAbstract(\true)->setPublic(\true); +$container = new ContainerBuilder(); +$container->register('foo', 'Foo')->setAbstract(true)->setPublic(true); return $container; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_almost_circular.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_almost_circular.php index bbf4c736c..f057ca3f7 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_almost_circular.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_almost_circular.php @@ -7,56 +7,56 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls; $public = 'public' === $visibility; -$container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); +$container = new ContainerBuilder(); // same visibility for deps -$container->register('foo', \_PhpScoper5ea00cc67502b\FooCircular::class)->setPublic(\true)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar')); -$container->register('bar', \_PhpScoper5ea00cc67502b\BarCircular::class)->setPublic($public)->addMethodCall('addFoobar', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foobar')]); -$container->register('foobar', \_PhpScoper5ea00cc67502b\FoobarCircular::class)->setPublic($public)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo')); +$container->register('foo', FooCircular::class)->setPublic(true)->addArgument(new Reference('bar')); +$container->register('bar', BarCircular::class)->setPublic($public)->addMethodCall('addFoobar', [new Reference('foobar')]); +$container->register('foobar', FoobarCircular::class)->setPublic($public)->addArgument(new Reference('foo')); // mixed visibility for deps -$container->register('foo2', \_PhpScoper5ea00cc67502b\FooCircular::class)->setPublic(\true)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar2')); -$container->register('bar2', \_PhpScoper5ea00cc67502b\BarCircular::class)->setPublic(!$public)->addMethodCall('addFoobar', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foobar2')]); -$container->register('foobar2', \_PhpScoper5ea00cc67502b\FoobarCircular::class)->setPublic($public)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo2')); +$container->register('foo2', FooCircular::class)->setPublic(true)->addArgument(new Reference('bar2')); +$container->register('bar2', BarCircular::class)->setPublic(!$public)->addMethodCall('addFoobar', [new Reference('foobar2')]); +$container->register('foobar2', FoobarCircular::class)->setPublic($public)->addArgument(new Reference('foo2')); // simple inline setter with internal reference -$container->register('bar3', \_PhpScoper5ea00cc67502b\BarCircular::class)->setPublic(\true)->addMethodCall('addFoobar', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foobar3'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foobar3')]); -$container->register('foobar3', \_PhpScoper5ea00cc67502b\FoobarCircular::class)->setPublic($public); +$container->register('bar3', BarCircular::class)->setPublic(true)->addMethodCall('addFoobar', [new Reference('foobar3'), new Reference('foobar3')]); +$container->register('foobar3', FoobarCircular::class)->setPublic($public); // loop with non-shared dep -$container->register('foo4', 'stdClass')->setPublic($public)->setShared(\false)->setProperty('foobar', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foobar4')); -$container->register('foobar4', 'stdClass')->setPublic(\true)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo4')); +$container->register('foo4', 'stdClass')->setPublic($public)->setShared(false)->setProperty('foobar', new Reference('foobar4')); +$container->register('foobar4', 'stdClass')->setPublic(true)->addArgument(new Reference('foo4')); // loop on the constructor of a setter-injected dep with property -$container->register('foo5', 'stdClass')->setPublic(\true)->setProperty('bar', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar5')); -$container->register('bar5', 'stdClass')->setPublic($public)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo5'))->setProperty('foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo5')); +$container->register('foo5', 'stdClass')->setPublic(true)->setProperty('bar', new Reference('bar5')); +$container->register('bar5', 'stdClass')->setPublic($public)->addArgument(new Reference('foo5'))->setProperty('foo', new Reference('foo5')); // doctrine-like event system + some extra -$container->register('manager', 'stdClass')->setPublic(\true)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('connection')); -$container->register('logger', 'stdClass')->setPublic(\true)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('connection'))->setProperty('handler', (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'))->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('manager'))); -$container->register('connection', 'stdClass')->setPublic(\true)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('dispatcher'))->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('config')); -$container->register('config', 'stdClass')->setPublic(\false)->setProperty('logger', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('logger')); -$container->register('dispatcher', 'stdClass')->setPublic($public)->setLazy($public)->setProperty('subscriber', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('subscriber')); -$container->register('subscriber', 'stdClass')->setPublic(\true)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('manager')); +$container->register('manager', 'stdClass')->setPublic(true)->addArgument(new Reference('connection')); +$container->register('logger', 'stdClass')->setPublic(true)->addArgument(new Reference('connection'))->setProperty('handler', (new Definition('stdClass'))->addArgument(new Reference('manager'))); +$container->register('connection', 'stdClass')->setPublic(true)->addArgument(new Reference('dispatcher'))->addArgument(new Reference('config')); +$container->register('config', 'stdClass')->setPublic(false)->setProperty('logger', new Reference('logger')); +$container->register('dispatcher', 'stdClass')->setPublic($public)->setLazy($public)->setProperty('subscriber', new Reference('subscriber')); +$container->register('subscriber', 'stdClass')->setPublic(true)->addArgument(new Reference('manager')); // doctrine-like event system + some extra (bis) -$container->register('manager2', 'stdClass')->setPublic(\true)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('connection2')); -$container->register('logger2', 'stdClass')->setPublic(\false)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('connection2'))->setProperty('handler2', (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'))->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('manager2'))); -$container->register('connection2', 'stdClass')->setPublic(\true)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('dispatcher2'))->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('config2')); -$container->register('config2', 'stdClass')->setPublic(\false)->setProperty('logger2', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('logger2')); -$container->register('dispatcher2', 'stdClass')->setPublic($public)->setLazy($public)->setProperty('subscriber2', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('subscriber2')); -$container->register('subscriber2', 'stdClass')->setPublic(\false)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('manager2')); +$container->register('manager2', 'stdClass')->setPublic(true)->addArgument(new Reference('connection2')); +$container->register('logger2', 'stdClass')->setPublic(false)->addArgument(new Reference('connection2'))->setProperty('handler2', (new Definition('stdClass'))->addArgument(new Reference('manager2'))); +$container->register('connection2', 'stdClass')->setPublic(true)->addArgument(new Reference('dispatcher2'))->addArgument(new Reference('config2')); +$container->register('config2', 'stdClass')->setPublic(false)->setProperty('logger2', new Reference('logger2')); +$container->register('dispatcher2', 'stdClass')->setPublic($public)->setLazy($public)->setProperty('subscriber2', new Reference('subscriber2')); +$container->register('subscriber2', 'stdClass')->setPublic(false)->addArgument(new Reference('manager2')); // doctrine-like event system with listener -$container->register('manager3', 'stdClass')->setLazy(\true)->setPublic(\true)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('connection3')); -$container->register('connection3', 'stdClass')->setPublic($public)->setProperty('listener', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('listener3')]); -$container->register('listener3', 'stdClass')->setPublic(\true)->setProperty('manager', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('manager3')); +$container->register('manager3', 'stdClass')->setLazy(true)->setPublic(true)->addArgument(new Reference('connection3')); +$container->register('connection3', 'stdClass')->setPublic($public)->setProperty('listener', [new Reference('listener3')]); +$container->register('listener3', 'stdClass')->setPublic(true)->setProperty('manager', new Reference('manager3')); // doctrine-like event system with small differences -$container->register('manager4', 'stdClass')->setLazy(\true)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('connection4')); -$container->register('connection4', 'stdClass')->setPublic($public)->setProperty('listener', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('listener4')]); -$container->register('listener4', 'stdClass')->setPublic(\true)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('manager4')); +$container->register('manager4', 'stdClass')->setLazy(true)->addArgument(new Reference('connection4')); +$container->register('connection4', 'stdClass')->setPublic($public)->setProperty('listener', [new Reference('listener4')]); +$container->register('listener4', 'stdClass')->setPublic(true)->addArgument(new Reference('manager4')); // private service involved in a loop -$container->register('foo6', 'stdClass')->setPublic(\true)->setProperty('bar6', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar6')); -$container->register('bar6', 'stdClass')->setPublic(\false)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo6')); -$container->register('baz6', 'stdClass')->setPublic(\true)->setProperty('bar6', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar6')); +$container->register('foo6', 'stdClass')->setPublic(true)->setProperty('bar6', new Reference('bar6')); +$container->register('bar6', 'stdClass')->setPublic(false)->addArgument(new Reference('foo6')); +$container->register('baz6', 'stdClass')->setPublic(true)->setProperty('bar6', new Reference('bar6')); // provided by Christian Schiffler -$container->register('root', 'stdClass')->setArguments([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('level2'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('multiuse1')])->setPublic(\true); -$container->register('level2', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls::class)->addMethodCall('call', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('level3')]); +$container->register('root', 'stdClass')->setArguments([new Reference('level2'), new Reference('multiuse1')])->setPublic(true); +$container->register('level2', FooForCircularWithAddCalls::class)->addMethodCall('call', [new Reference('level3')]); $container->register('multiuse1', 'stdClass'); -$container->register('level3', 'stdClass')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('level4')); -$container->register('level4', 'stdClass')->setArguments([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('multiuse1'), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('level5')]); -$container->register('level5', 'stdClass')->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('level6')); -$container->register('level6', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls::class)->addMethodCall('call', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('level5')]); +$container->register('level3', 'stdClass')->addArgument(new Reference('level4')); +$container->register('level4', 'stdClass')->setArguments([new Reference('multiuse1'), new Reference('level5')]); +$container->register('level5', 'stdClass')->addArgument(new Reference('level6')); +$container->register('level6', FooForCircularWithAddCalls::class)->addMethodCall('call', [new Reference('level5')]); return $container; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_env_in_id.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_env_in_id.php index d591a0a80..d994c06ca 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_env_in_id.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_env_in_id.php @@ -6,10 +6,10 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; -$container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); +$container = new ContainerBuilder(); $container->setParameter('env(BAR)', 'bar'); -$container->register('foo', 'stdClass')->setPublic(\true)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar_%env(BAR)%'))->addArgument(['baz_%env(BAR)%' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz_%env(BAR)%')]); -$container->register('bar', 'stdClass')->setPublic(\true)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('bar_%env(BAR)%')); -$container->register('bar_%env(BAR)%', 'stdClass')->setPublic(\false); -$container->register('baz_%env(BAR)%', 'stdClass')->setPublic(\false); +$container->register('foo', 'stdClass')->setPublic(true)->addArgument(new Reference('bar_%env(BAR)%'))->addArgument(['baz_%env(BAR)%' => new Reference('baz_%env(BAR)%')]); +$container->register('bar', 'stdClass')->setPublic(true)->addArgument(new Reference('bar_%env(BAR)%')); +$container->register('bar_%env(BAR)%', 'stdClass')->setPublic(false); +$container->register('baz_%env(BAR)%', 'stdClass')->setPublic(false); return $container; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_inline_requires.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_inline_requires.php index 1c7b6838f..4885eb2fa 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_inline_requires.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_inline_requires.php @@ -7,10 +7,13 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath; +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C1; +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C2; +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\ParentNotExists; -$container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); -$container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C1::class)->addTag('container.hot_path')->setPublic(\true); -$container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C2::class)->addArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3::class))->setPublic(\true); -$container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3::class); -$container->register(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\ParentNotExists::class)->setPublic(\true); +$container = new ContainerBuilder(); +$container->register(C1::class)->addTag('container.hot_path')->setPublic(true); +$container->register(C2::class)->addArgument(new Reference(C3::class))->setPublic(true); +$container->register(C3::class); +$container->register(ParentNotExists::class)->setPublic(true); return $container; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_uninitialized_ref.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_uninitialized_ref.php index 1dea17f6c..183e6f538 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_uninitialized_ref.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_uninitialized_ref.php @@ -6,10 +6,10 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; -$container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); -$container->register('foo1', 'stdClass')->setPublic(\true); -$container->register('foo2', 'stdClass')->setPublic(\false); -$container->register('foo3', 'stdClass')->setPublic(\false); -$container->register('baz', 'stdClass')->setProperty('foo3', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo3'))->setPublic(\true); -$container->register('bar', 'stdClass')->setProperty('foo1', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo1', $container::IGNORE_ON_UNINITIALIZED_REFERENCE))->setProperty('foo2', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo2', $container::IGNORE_ON_UNINITIALIZED_REFERENCE))->setProperty('foo3', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo3', $container::IGNORE_ON_UNINITIALIZED_REFERENCE))->setProperty('closures', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo1', $container::IGNORE_ON_UNINITIALIZED_REFERENCE)), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo2', $container::IGNORE_ON_UNINITIALIZED_REFERENCE)), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo3', $container::IGNORE_ON_UNINITIALIZED_REFERENCE))])->setProperty('iter', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument(['foo1' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo1', $container::IGNORE_ON_UNINITIALIZED_REFERENCE), 'foo2' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo2', $container::IGNORE_ON_UNINITIALIZED_REFERENCE), 'foo3' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo3', $container::IGNORE_ON_UNINITIALIZED_REFERENCE)]))->setPublic(\true); +$container = new ContainerBuilder(); +$container->register('foo1', 'stdClass')->setPublic(true); +$container->register('foo2', 'stdClass')->setPublic(false); +$container->register('foo3', 'stdClass')->setPublic(false); +$container->register('baz', 'stdClass')->setProperty('foo3', new Reference('foo3'))->setPublic(true); +$container->register('bar', 'stdClass')->setProperty('foo1', new Reference('foo1', $container::IGNORE_ON_UNINITIALIZED_REFERENCE))->setProperty('foo2', new Reference('foo2', $container::IGNORE_ON_UNINITIALIZED_REFERENCE))->setProperty('foo3', new Reference('foo3', $container::IGNORE_ON_UNINITIALIZED_REFERENCE))->setProperty('closures', [new ServiceClosureArgument(new Reference('foo1', $container::IGNORE_ON_UNINITIALIZED_REFERENCE)), new ServiceClosureArgument(new Reference('foo2', $container::IGNORE_ON_UNINITIALIZED_REFERENCE)), new ServiceClosureArgument(new Reference('foo3', $container::IGNORE_ON_UNINITIALIZED_REFERENCE))])->setProperty('iter', new IteratorArgument(['foo1' => new Reference('foo1', $container::IGNORE_ON_UNINITIALIZED_REFERENCE), 'foo2' => new Reference('foo2', $container::IGNORE_ON_UNINITIALIZED_REFERENCE), 'foo3' => new Reference('foo3', $container::IGNORE_ON_UNINITIALIZED_REFERENCE)]))->setPublic(true); return $container; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/directory/import/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/directory/import/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/directory/import/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/directory/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/directory/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/directory/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/directory/recurse/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/directory/recurse/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/directory/recurse/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/graphviz/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/graphviz/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/graphviz/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/includes/FooVariadic.php b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/FooVariadic.php index fcd851aa1..ff91ef2d4 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/includes/FooVariadic.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/FooVariadic.php @@ -5,7 +5,7 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo; class FooVariadic { - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo $foo) + public function __construct(Foo $foo) { } public function bar(...$arguments) diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/includes/HotPath/C1.php b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/HotPath/C1.php index 1e958017a..bae5745a0 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/includes/HotPath/C1.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/HotPath/C1.php @@ -2,7 +2,7 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath; -class C1 extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\P1 +class C1 extends P1 { use T1; } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/includes/HotPath/P1.php b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/HotPath/P1.php index 98709c1db..3fafa16c3 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/includes/HotPath/P1.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/HotPath/P1.php @@ -2,6 +2,6 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath; -class P1 implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\I1 +class P1 implements I1 { } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/includes/HotPath/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/HotPath/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/HotPath/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/includes/ProjectExtension.php b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/ProjectExtension.php index d1ef2707c..fc82285a9 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/includes/ProjectExtension.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/ProjectExtension.php @@ -5,26 +5,30 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Extension\ExtensionInterface; -class ProjectExtension implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Extension\ExtensionInterface +use function array_filter; +use function call_user_func_array; +use function class_alias; + +class ProjectExtension implements ExtensionInterface { - public function load(array $configs, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $configuration) + public function load(array $configs, ContainerBuilder $configuration) { $configuration->setParameter('project.configs', $configs); - $configs = \array_filter($configs); + $configs = array_filter($configs); if ($configs) { - $config = \call_user_func_array('array_merge', $configs); + $config = call_user_func_array('array_merge', $configs); } else { $config = []; } - $configuration->setDefinition('project.service.bar', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('FooClass')); + $configuration->setDefinition('project.service.bar', new Definition('FooClass')); $configuration->setParameter('project.parameter.bar', isset($config['foo']) ? $config['foo'] : 'foobar'); - $configuration->setDefinition('project.service.foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('FooClass')); + $configuration->setDefinition('project.service.foo', new Definition('FooClass')); $configuration->setParameter('project.parameter.foo', isset($config['foo']) ? $config['foo'] : 'foobar'); return $configuration; } public function getXsdValidationBasePath() { - return \false; + return false; } public function getNamespace() { @@ -34,8 +38,8 @@ public function getAlias() { return 'project'; } - public function getConfiguration(array $config, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder $container) + public function getConfiguration(array $config, ContainerBuilder $container) { } } -\class_alias('_PhpScoper5ea00cc67502b\\ProjectExtension', 'ProjectExtension', \false); +class_alias('_PhpScoper5ea00cc67502b\\ProjectExtension', 'ProjectExtension', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/includes/ProjectWithXsdExtension.php b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/ProjectWithXsdExtension.php index 034ec9c4f..336794cc3 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/includes/ProjectWithXsdExtension.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/ProjectWithXsdExtension.php @@ -2,7 +2,9 @@ namespace _PhpScoper5ea00cc67502b; -class ProjectWithXsdExtension extends \_PhpScoper5ea00cc67502b\ProjectExtension +use function class_alias; + +class ProjectWithXsdExtension extends ProjectExtension { public function getXsdValidationBasePath() { @@ -17,4 +19,4 @@ public function getAlias() return 'projectwithxsd'; } } -\class_alias('_PhpScoper5ea00cc67502b\\ProjectWithXsdExtension', 'ProjectWithXsdExtension', \false); +class_alias('_PhpScoper5ea00cc67502b\\ProjectWithXsdExtension', 'ProjectWithXsdExtension', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/includes/autowiring_classes.php b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/autowiring_classes.php index 585fb1ff4..021cad19d 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/includes/autowiring_classes.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/autowiring_classes.php @@ -2,96 +2,98 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler; +use stdClass; + class Foo { } class Bar { - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo $foo) + public function __construct(Foo $foo) { } } interface AInterface { } -class A implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\AInterface +class A implements AInterface { - public static function create(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo $foo) + public static function create(Foo $foo) { } } -class B extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A +class B extends A { } class C { - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A $a) + public function __construct(A $a) { } } interface DInterface { } -interface EInterface extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\DInterface +interface EInterface extends DInterface { } interface IInterface { } -class I implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\IInterface +class I implements IInterface { } -class F extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\I implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\EInterface +class F extends I implements EInterface { } class G { - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\DInterface $d, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\EInterface $e, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\IInterface $i) + public function __construct(DInterface $d, EInterface $e, IInterface $i) { } } class H { - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\B $b, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\DInterface $d) + public function __construct(B $b, DInterface $d) { } } class D { - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A $a, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\DInterface $d) + public function __construct(A $a, DInterface $d) { } } class E { - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\D $d = null) + public function __construct(D $d = null) { } } class J { - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\I $i) + public function __construct(I $i) { } } class K { - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\IInterface $i) + public function __construct(IInterface $i) { } } interface CollisionInterface { } -class CollisionA implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CollisionInterface +class CollisionA implements CollisionInterface { } -class CollisionB implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CollisionInterface +class CollisionB implements CollisionInterface { } class CannotBeAutowired { - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CollisionInterface $collision) + public function __construct(CollisionInterface $collision) { } } @@ -100,67 +102,67 @@ class Lille } class Dunglas { - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Lille $l) + public function __construct(Lille $l) { } } class LesTilleuls { - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Dunglas $j, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Dunglas $k) + public function __construct(Dunglas $j, Dunglas $k) { } } class OptionalParameter { - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CollisionInterface $c = null, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A $a, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo $f = null) + public function __construct(CollisionInterface $c = null, A $a, Foo $f = null) { } } class BadTypeHintedArgument { - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Dunglas $k, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\NotARealClass $r) + public function __construct(Dunglas $k, NotARealClass $r) { } } class BadParentTypeHintedArgument { - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Dunglas $k, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\OptionalServiceClass $r) + public function __construct(Dunglas $k, OptionalServiceClass $r) { } } class NotGuessableArgument { - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo $k) + public function __construct(Foo $k) { } } class NotGuessableArgumentForSubclass { - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A $k) + public function __construct(A $k) { } } class MultipleArguments { - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A $k, $foo, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Dunglas $dunglas, array $bar) + public function __construct(A $k, $foo, Dunglas $dunglas, array $bar) { } } class MultipleArgumentsOptionalScalar { - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A $a, $foo = 'default_val', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Lille $lille = null) + public function __construct(A $a, $foo = 'default_val', Lille $lille = null) { } } class MultipleArgumentsOptionalScalarLast { - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A $a, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Lille $lille, $foo = 'some_val') + public function __construct(A $a, Lille $lille, $foo = 'some_val') { } } class MultipleArgumentsOptionalScalarNotReallyOptional { - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A $a, $foo = 'default_val', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Lille $lille) + public function __construct(A $a, $foo = 'default_val', Lille $lille) { } } @@ -169,19 +171,19 @@ public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\Dependenc */ class ClassForResource { - public function __construct($foo, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Bar $bar = null) + public function __construct($foo, Bar $bar = null) { } - public function setBar(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Bar $bar) + public function setBar(Bar $bar) { } } -class IdenticalClassResource extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\ClassForResource +class IdenticalClassResource extends ClassForResource { } -class ClassChangedConstructorArgs extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\ClassForResource +class ClassChangedConstructorArgs extends ClassForResource { - public function __construct($foo, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Bar $bar, $baz) + public function __construct($foo, Bar $bar, $baz) { } } @@ -190,74 +192,74 @@ class SetterInjectionCollision /** * @required */ - public function setMultipleInstancesForOneArg(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\CollisionInterface $collision) + public function setMultipleInstancesForOneArg(CollisionInterface $collision) { // The CollisionInterface cannot be autowired - there are multiple // should throw an exception } } -class SetterInjection extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\SetterInjectionParent +class SetterInjection extends SetterInjectionParent { /** * @required */ - public function setFoo(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo $foo) + public function setFoo(Foo $foo) { // should be called } /** @inheritdoc*/ // <- brackets are missing on purpose - public function setDependencies(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo $foo, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A $a) + public function setDependencies(Foo $foo, A $a) { // should be called } /** {@inheritdoc} */ - public function setWithCallsConfigured(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A $a) + public function setWithCallsConfigured(A $a) { // this method has a calls configured on it } - public function notASetter(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A $a) + public function notASetter(A $a) { // should be called only when explicitly specified } /** * @required*/ - public function setChildMethodWithoutDocBlock(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A $a) + public function setChildMethodWithoutDocBlock(A $a) { } } class SetterInjectionParent { /** @required*/ - public function setDependencies(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\Foo $foo, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A $a) + public function setDependencies(Foo $foo, A $a) { // should be called } - public function notASetter(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A $a) + public function notASetter(A $a) { // @required should be ignored when the child does not add @inheritdoc } /** @required prefix is on purpose */ - public function setWithCallsConfigured(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A $a) + public function setWithCallsConfigured(A $a) { } /** @required */ - public function setChildMethodWithoutDocBlock(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A $a) + public function setChildMethodWithoutDocBlock(A $a) { } } class NotWireable { - public function setNotAutowireable(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\NotARealClass $n) + public function setNotAutowireable(NotARealClass $n) { } public function setBar() { } - public function setOptionalNotAutowireable(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\NotARealClass $n = null) + public function setOptionalNotAutowireable(NotARealClass $n = null) { } - public function setDifferentNamespace(\stdClass $n) + public function setDifferentNamespace(stdClass $n) { } public function setOptionalNoTypeHint($foo = null) @@ -267,7 +269,7 @@ public function setOptionalArgNoAutowireable($other = 'default_val') { } /** @required */ - protected function setProtectedMethod(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Compiler\A $a) + protected function setProtectedMethod(A $a) { } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/includes/classes.php b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/classes.php index e200e71ea..244b37498 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/includes/classes.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/classes.php @@ -5,15 +5,19 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface as ProxyDumper; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceSubscriberInterface; +use function class_alias; +use function is_object; +use function is_scalar; + function sc_configure($instance) { $instance->configure(); } -class BarClass extends \_PhpScoper5ea00cc67502b\BazClass +class BarClass extends BazClass { protected $baz; public $foo = 'foo'; - public function setBaz(\_PhpScoper5ea00cc67502b\BazClass $baz) + public function setBaz(BazClass $baz) { $this->baz = $baz; } @@ -22,11 +26,11 @@ public function getBaz() return $this->baz; } } -\class_alias('_PhpScoper5ea00cc67502b\\BarClass', 'BarClass', \false); +class_alias('_PhpScoper5ea00cc67502b\\BarClass', 'BarClass', false); class BazClass { protected $foo; - public function setFoo(\_PhpScoper5ea00cc67502b\Foo $foo) + public function setFoo(Foo $foo) { $this->foo = $foo; } @@ -46,47 +50,47 @@ public static function configureStatic1() { } } -\class_alias('_PhpScoper5ea00cc67502b\\BazClass', 'BazClass', \false); +class_alias('_PhpScoper5ea00cc67502b\\BazClass', 'BazClass', false); class BarUserClass { public $bar; - public function __construct(\_PhpScoper5ea00cc67502b\BarClass $bar) + public function __construct(BarClass $bar) { $this->bar = $bar; } } -\class_alias('_PhpScoper5ea00cc67502b\\BarUserClass', 'BarUserClass', \false); +class_alias('_PhpScoper5ea00cc67502b\\BarUserClass', 'BarUserClass', false); class MethodCallClass { public $simple; public $complex; - private $callPassed = \false; + private $callPassed = false; public function callMe() { - $this->callPassed = \is_scalar($this->simple) && \is_object($this->complex); + $this->callPassed = is_scalar($this->simple) && is_object($this->complex); } public function callPassed() { return $this->callPassed; } } -\class_alias('_PhpScoper5ea00cc67502b\\MethodCallClass', 'MethodCallClass', \false); -class DummyProxyDumper implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface +class_alias('_PhpScoper5ea00cc67502b\\MethodCallClass', 'MethodCallClass', false); +class DummyProxyDumper implements ProxyDumper { - public function isProxyCandidate(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition) + public function isProxyCandidate(Definition $definition) { return $definition->isLazy(); } - public function getProxyFactoryCode(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition, $id, $factoryCall = null) + public function getProxyFactoryCode(Definition $definition, $id, $factoryCall = null) { return " // lazy factory for {$definition->getClass()}\n\n"; } - public function getProxyCode(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition $definition) + public function getProxyCode(Definition $definition) { return "// proxy code for {$definition->getClass()}\n"; } } -\class_alias('_PhpScoper5ea00cc67502b\\DummyProxyDumper', 'DummyProxyDumper', \false); +class_alias('_PhpScoper5ea00cc67502b\\DummyProxyDumper', 'DummyProxyDumper', false); class LazyContext { public $lazyValues; @@ -97,28 +101,28 @@ public function __construct($lazyValues, $lazyEmptyValues) $this->lazyEmptyValues = $lazyEmptyValues; } } -\class_alias('_PhpScoper5ea00cc67502b\\LazyContext', 'LazyContext', \false); +class_alias('_PhpScoper5ea00cc67502b\\LazyContext', 'LazyContext', false); class FoobarCircular { - public function __construct(\_PhpScoper5ea00cc67502b\FooCircular $foo) + public function __construct(FooCircular $foo) { $this->foo = $foo; } } -\class_alias('_PhpScoper5ea00cc67502b\\FoobarCircular', 'FoobarCircular', \false); +class_alias('_PhpScoper5ea00cc67502b\\FoobarCircular', 'FoobarCircular', false); class FooCircular { - public function __construct(\_PhpScoper5ea00cc67502b\BarCircular $bar) + public function __construct(BarCircular $bar) { $this->bar = $bar; } } -\class_alias('_PhpScoper5ea00cc67502b\\FooCircular', 'FooCircular', \false); +class_alias('_PhpScoper5ea00cc67502b\\FooCircular', 'FooCircular', false); class BarCircular { - public function addFoobar(\_PhpScoper5ea00cc67502b\FoobarCircular $foobar) + public function addFoobar(FoobarCircular $foobar) { $this->foobar = $foobar; } } -\class_alias('_PhpScoper5ea00cc67502b\\BarCircular', 'BarCircular', \false); +class_alias('_PhpScoper5ea00cc67502b\\BarCircular', 'BarCircular', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/includes/createphar.php b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/createphar.php index e3ef91697..23f43d379 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/includes/createphar.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/createphar.php @@ -2,11 +2,15 @@ namespace _PhpScoper5ea00cc67502b; +use Phar; +use function is_file; +use function unlink; + $file = __DIR__ . '/ProjectWithXsdExtensionInPhar.phar'; -if (\is_file($file)) { - @\unlink($file); +if (is_file($file)) { + @unlink($file); } -$phar = new \Phar($file, 0, 'ProjectWithXsdExtensionInPhar.phar'); +$phar = new Phar($file, 0, 'ProjectWithXsdExtensionInPhar.phar'); $phar->addFromString('ProjectWithXsdExtensionInPhar.php', <<<'EOT' called = \true; + $obj->called = true; return $obj; } public function initialize() { - $this->initialized = \true; + $this->initialized = true; } public function configure() { - $this->configured = \true; + $this->configured = true; } public function setBar($value = null) { diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/includes/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/includes/schema/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/schema/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/schema/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/ini/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/ini/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/ini/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_constructor_without_arguments.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_constructor_without_arguments.php index e7542d193..44ef0c0fb 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_constructor_without_arguments.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_constructor_without_arguments.php @@ -9,13 +9,17 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Container\ConstructorWithoutArgumentsContainer +class ProjectServiceContainer extends ConstructorWithoutArgumentsContainer { private $parameters = []; private $targetDirs = []; @@ -28,19 +32,19 @@ public function __construct() } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_with_mandatory_constructor_arguments.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_with_mandatory_constructor_arguments.php index 4cf10ca4b..92e48c5a3 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_with_mandatory_constructor_arguments.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_with_mandatory_constructor_arguments.php @@ -9,13 +9,17 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Container\ConstructorWithMandatoryArgumentsContainer +class ProjectServiceContainer extends ConstructorWithMandatoryArgumentsContainer { private $parameters = []; private $targetDirs = []; @@ -26,19 +30,19 @@ public function __construct() } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_with_optional_constructor_arguments.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_with_optional_constructor_arguments.php index 6cea63e2a..a68f12f52 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_with_optional_constructor_arguments.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_with_optional_constructor_arguments.php @@ -9,13 +9,17 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Container\ConstructorWithOptionalArgumentsContainer +class ProjectServiceContainer extends ConstructorWithOptionalArgumentsContainer { private $parameters = []; private $targetDirs = []; @@ -28,19 +32,19 @@ public function __construct() } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_without_constructor.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_without_constructor.php index f35a26bcb..bffdbdb56 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_without_constructor.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_without_constructor.php @@ -9,13 +9,17 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Container\NoConstructorContainer +class ProjectServiceContainer extends NoConstructorContainer { private $parameters = []; private $targetDirs = []; @@ -26,19 +30,19 @@ public function __construct() } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services1-1.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services1-1.php index fb37efbcb..7c3e262d8 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services1-1.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services1-1.php @@ -9,13 +9,17 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class Container extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dump\AbstractContainer +class Container extends AbstractContainer { private $parameters = []; private $targetDirs = []; @@ -26,19 +30,19 @@ public function __construct() } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services1.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services1.php index f19b6e642..b4d9de6f5 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services1.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services1.php @@ -9,13 +9,18 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use function class_alias; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class ProjectServiceContainer extends Container { private $parameters = []; private $targetDirs = []; @@ -26,20 +31,20 @@ public function __construct() } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } } /** @@ -48,4 +53,4 @@ public function isFrozen() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', \false); +class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services10.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services10.php index 435d8901c..f6a9e9ec5 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services10.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services10.php @@ -9,13 +9,21 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use stdClass; +use function array_key_exists; +use function class_alias; +use function sprintf; +use function strtolower; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class ProjectServiceContainer extends Container { private $parameters = []; private $targetDirs = []; @@ -28,37 +36,37 @@ public function __construct() } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } /** * Gets the public 'test' shared service. * - * @return \stdClass + * @return stdClass */ protected function getTestService() { - return $this->services['test'] = new \stdClass(['only dot' => '.', 'concatenation as value' => '.\'\'.', 'concatenation from the start value' => '\'\'.', '.' => 'dot as a key', '.\'\'.' => 'concatenation as a key', '\'\'.' => 'concatenation from the start key', 'optimize concatenation' => 'string1-string2', 'optimize concatenation with empty string' => 'string1string2', 'optimize concatenation from the start' => 'start', 'optimize concatenation at the end' => 'end', 'new line' => 'string with ' . "\n" . 'new line']); + return $this->services['test'] = new stdClass(['only dot' => '.', 'concatenation as value' => '.\'\'.', 'concatenation from the start value' => '\'\'.', '.' => 'dot as a key', '.\'\'.' => 'concatenation as a key', '\'\'.' => 'concatenation from the start key', 'optimize concatenation' => 'string1-string2', 'optimize concatenation with empty string' => 'string1string2', 'optimize concatenation from the start' => 'start', 'optimize concatenation at the end' => 'end', 'new line' => 'string with ' . "\n" . 'new line']); } public function getParameter($name) { $name = (string) $name; - if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { $name = $this->normalizeParameterName($name); - if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The parameter "%s" must be defined.', $name)); + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { + throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); } } if (isset($this->loadedDynamicParameters[$name])) { @@ -70,11 +78,11 @@ public function hasParameter($name) { $name = (string) $name; $name = $this->normalizeParameterName($name); - return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters); + return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters); } public function setParameter($name, $value) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('Impossible to call set() on a frozen ParameterBag.'); + throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); } public function getParameterBag() { @@ -83,7 +91,7 @@ public function getParameterBag() foreach ($this->loadedDynamicParameters as $name => $loaded) { $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name); } - $this->parameterBag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag($parameters); + $this->parameterBag = new FrozenParameterBag($parameters); } return $this->parameterBag; } @@ -100,15 +108,15 @@ public function getParameterBag() */ private function getDynamicParameter($name) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The dynamic parameter "%s" must be defined.', $name)); + throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } private $normalizedParameterNames = []; private function normalizeParameterName($name) { - if (isset($this->normalizedParameterNames[$normalizedName = \strtolower($name)]) || isset($this->parameters[$normalizedName]) || \array_key_exists($normalizedName, $this->parameters)) { + if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) { $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName; if ((string) $name !== $normalizedName) { - @\trigger_error(\sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), \E_USER_DEPRECATED); + @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), E_USER_DEPRECATED); } } else { $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name; @@ -131,4 +139,4 @@ protected function getDefaultParameters() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', \false); +class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services12.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services12.php index a0957bfc9..2f4432979 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services12.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services12.php @@ -9,13 +9,22 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use stdClass; +use function array_key_exists; +use function class_alias; +use function dirname; +use function sprintf; +use function strtolower; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class ProjectServiceContainer extends Container { private $parameters = []; private $targetDirs = []; @@ -23,7 +32,7 @@ public function __construct() { $dir = __DIR__; for ($i = 1; $i <= 5; ++$i) { - $this->targetDirs[$i] = $dir = \dirname($dir); + $this->targetDirs[$i] = $dir = dirname($dir); } $this->parameters = $this->getDefaultParameters(); $this->services = []; @@ -32,37 +41,37 @@ public function __construct() } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } /** * Gets the public 'test' shared service. * - * @return \stdClass + * @return stdClass */ protected function getTestService() { - return $this->services['test'] = new \stdClass('wiz' . $this->targetDirs[1], ['wiz' . $this->targetDirs[1] => $this->targetDirs[2] . '/']); + return $this->services['test'] = new stdClass('wiz' . $this->targetDirs[1], ['wiz' . $this->targetDirs[1] => $this->targetDirs[2] . '/']); } public function getParameter($name) { $name = (string) $name; - if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { $name = $this->normalizeParameterName($name); - if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The parameter "%s" must be defined.', $name)); + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { + throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); } } if (isset($this->loadedDynamicParameters[$name])) { @@ -74,11 +83,11 @@ public function hasParameter($name) { $name = (string) $name; $name = $this->normalizeParameterName($name); - return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters); + return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters); } public function setParameter($name, $value) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('Impossible to call set() on a frozen ParameterBag.'); + throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); } public function getParameterBag() { @@ -87,11 +96,11 @@ public function getParameterBag() foreach ($this->loadedDynamicParameters as $name => $loaded) { $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name); } - $this->parameterBag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag($parameters); + $this->parameterBag = new FrozenParameterBag($parameters); } return $this->parameterBag; } - private $loadedDynamicParameters = ['foo' => \false, 'buz' => \false]; + private $loadedDynamicParameters = ['foo' => false, 'buz' => false]; private $dynamicParameters = []; /** * Computes a dynamic parameter. @@ -112,18 +121,18 @@ private function getDynamicParameter($name) $value = $this->targetDirs[2]; break; default: - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The dynamic parameter "%s" must be defined.', $name)); + throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } - $this->loadedDynamicParameters[$name] = \true; + $this->loadedDynamicParameters[$name] = true; return $this->dynamicParameters[$name] = $value; } private $normalizedParameterNames = []; private function normalizeParameterName($name) { - if (isset($this->normalizedParameterNames[$normalizedName = \strtolower($name)]) || isset($this->parameters[$normalizedName]) || \array_key_exists($normalizedName, $this->parameters)) { + if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) { $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName; if ((string) $name !== $normalizedName) { - @\trigger_error(\sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), \E_USER_DEPRECATED); + @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), E_USER_DEPRECATED); } } else { $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name; @@ -146,4 +155,4 @@ protected function getDefaultParameters() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', \false); +class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services13.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services13.php index 0cf165455..28c3cfe50 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services13.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services13.php @@ -9,13 +9,19 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use stdClass; +use function class_alias; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class ProjectServiceContainer extends Container { private $parameters = []; private $targetDirs = []; @@ -27,31 +33,31 @@ public function __construct() } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true, 'foo' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'foo' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } /** * Gets the public 'bar' shared service. * - * @return \stdClass + * @return stdClass */ protected function getBarService() { - $a = new \stdClass(); + $a = new stdClass(); $a->add($this); - return $this->services['bar'] = new \stdClass($a); + return $this->services['bar'] = new stdClass($a); } } /** @@ -60,4 +66,4 @@ protected function getBarService() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', \false); +class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services19.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services19.php index eb672192c..091651ab4 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services19.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services19.php @@ -2,6 +2,7 @@ namespace _PhpScoper5ea00cc67502b; +use _PhpScoper5ea00cc67502b\Bar\FooClass; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container; @@ -9,13 +10,20 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use function array_key_exists; +use function class_alias; +use function sprintf; +use function strtolower; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class ProjectServiceContainer extends Container { private $parameters = []; private $targetDirs = []; @@ -28,20 +36,20 @@ public function __construct() } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } /** * Gets the public 'service_from_anonymous_factory' shared service. @@ -50,7 +58,7 @@ public function isFrozen() */ protected function getServiceFromAnonymousFactoryService() { - return $this->services['service_from_anonymous_factory'] = (new ${($_ = $this->getEnv('FOO')) && \false ?: "_"}())->getInstance(); + return $this->services['service_from_anonymous_factory'] = (new ${($_ = $this->getEnv('FOO')) && false ?: "_"}())->getInstance(); } /** * Gets the public 'service_with_method_call_and_factory' shared service. @@ -59,17 +67,17 @@ protected function getServiceFromAnonymousFactoryService() */ protected function getServiceWithMethodCallAndFactoryService() { - $this->services['service_with_method_call_and_factory'] = $instance = new \_PhpScoper5ea00cc67502b\Bar\FooClass(); - $instance->setBar(\_PhpScoper5ea00cc67502b\Bar\FooClass::getInstance()); + $this->services['service_with_method_call_and_factory'] = $instance = new FooClass(); + $instance->setBar(FooClass::getInstance()); return $instance; } public function getParameter($name) { $name = (string) $name; - if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { $name = $this->normalizeParameterName($name); - if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The parameter "%s" must be defined.', $name)); + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { + throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); } } if (isset($this->loadedDynamicParameters[$name])) { @@ -81,11 +89,11 @@ public function hasParameter($name) { $name = (string) $name; $name = $this->normalizeParameterName($name); - return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters); + return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters); } public function setParameter($name, $value) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('Impossible to call set() on a frozen ParameterBag.'); + throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); } public function getParameterBag() { @@ -94,11 +102,11 @@ public function getParameterBag() foreach ($this->loadedDynamicParameters as $name => $loaded) { $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name); } - $this->parameterBag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag($parameters); + $this->parameterBag = new FrozenParameterBag($parameters); } return $this->parameterBag; } - private $loadedDynamicParameters = ['foo' => \false]; + private $loadedDynamicParameters = ['foo' => false]; private $dynamicParameters = []; /** * Computes a dynamic parameter. @@ -116,18 +124,18 @@ private function getDynamicParameter($name) $value = $this->getEnv('FOO'); break; default: - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The dynamic parameter "%s" must be defined.', $name)); + throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } - $this->loadedDynamicParameters[$name] = \true; + $this->loadedDynamicParameters[$name] = true; return $this->dynamicParameters[$name] = $value; } private $normalizedParameterNames = ['env(foo)' => 'env(FOO)']; private function normalizeParameterName($name) { - if (isset($this->normalizedParameterNames[$normalizedName = \strtolower($name)]) || isset($this->parameters[$normalizedName]) || \array_key_exists($normalizedName, $this->parameters)) { + if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) { $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName; if ((string) $name !== $normalizedName) { - @\trigger_error(\sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), \E_USER_DEPRECATED); + @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), E_USER_DEPRECATED); } } else { $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name; @@ -150,4 +158,4 @@ protected function getDefaultParameters() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', \false); +class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services24.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services24.php index 6d545b587..31fb58232 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services24.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services24.php @@ -9,13 +9,19 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use Foo; +use function class_alias; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class ProjectServiceContainer extends Container { private $parameters = []; private $targetDirs = []; @@ -27,29 +33,29 @@ public function __construct() } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } /** * Gets the public 'foo' shared autowired service. * - * @return \Foo + * @return Foo */ protected function getFooService() { - return $this->services['foo'] = new \_PhpScoper5ea00cc67502b\Foo(); + return $this->services['foo'] = new Foo(); } } /** @@ -58,4 +64,4 @@ protected function getFooService() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', \false); +class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services26.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services26.php index 8c6293e55..f800b26bf 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services26.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services26.php @@ -9,13 +9,22 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Bar; +use function array_key_exists; +use function class_alias; +use function dirname; +use function sprintf; +use function strtolower; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class Symfony_DI_PhpDumper_Test_EnvParameters extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class Symfony_DI_PhpDumper_Test_EnvParameters extends Container { private $parameters = []; private $targetDirs = []; @@ -23,7 +32,7 @@ public function __construct() { $dir = __DIR__; for ($i = 1; $i <= 5; ++$i) { - $this->targetDirs[$i] = $dir = \dirname($dir); + $this->targetDirs[$i] = $dir = dirname($dir); } $this->parameters = $this->getDefaultParameters(); $this->services = []; @@ -32,20 +41,20 @@ public function __construct() } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } /** * Gets the public 'bar' shared service. @@ -54,7 +63,7 @@ public function isFrozen() */ protected function getBarService() { - return $this->services['bar'] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Bar($this->getEnv('QUZ')); + return $this->services['bar'] = new Bar($this->getEnv('QUZ')); } /** * Gets the public 'test' shared service. @@ -69,10 +78,10 @@ protected function getTestService() public function getParameter($name) { $name = (string) $name; - if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { $name = $this->normalizeParameterName($name); - if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The parameter "%s" must be defined.', $name)); + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { + throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); } } if (isset($this->loadedDynamicParameters[$name])) { @@ -84,11 +93,11 @@ public function hasParameter($name) { $name = (string) $name; $name = $this->normalizeParameterName($name); - return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters); + return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters); } public function setParameter($name, $value) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('Impossible to call set() on a frozen ParameterBag.'); + throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); } public function getParameterBag() { @@ -97,11 +106,11 @@ public function getParameterBag() foreach ($this->loadedDynamicParameters as $name => $loaded) { $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name); } - $this->parameterBag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag($parameters); + $this->parameterBag = new FrozenParameterBag($parameters); } return $this->parameterBag; } - private $loadedDynamicParameters = ['bar' => \false, 'baz' => \false, 'json' => \false, 'db_dsn' => \false, 'env(json_file)' => \false]; + private $loadedDynamicParameters = ['bar' => false, 'baz' => false, 'json' => false, 'db_dsn' => false, 'env(json_file)' => false]; private $dynamicParameters = []; /** * Computes a dynamic parameter. @@ -131,18 +140,18 @@ private function getDynamicParameter($name) $value = $this->targetDirs[1] . '/array.json'; break; default: - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The dynamic parameter "%s" must be defined.', $name)); + throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } - $this->loadedDynamicParameters[$name] = \true; + $this->loadedDynamicParameters[$name] = true; return $this->dynamicParameters[$name] = $value; } private $normalizedParameterNames = ['env(foo)' => 'env(FOO)', 'env(db)' => 'env(DB)']; private function normalizeParameterName($name) { - if (isset($this->normalizedParameterNames[$normalizedName = \strtolower($name)]) || isset($this->parameters[$normalizedName]) || \array_key_exists($normalizedName, $this->parameters)) { + if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) { $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName; if ((string) $name !== $normalizedName) { - @\trigger_error(\sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), \E_USER_DEPRECATED); + @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), E_USER_DEPRECATED); } } else { $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name; @@ -165,4 +174,4 @@ protected function getDefaultParameters() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\Symfony_DI_PhpDumper_Test_EnvParameters', 'Symfony_DI_PhpDumper_Test_EnvParameters', \false); +class_alias('_PhpScoper5ea00cc67502b\\Symfony_DI_PhpDumper_Test_EnvParameters', 'Symfony_DI_PhpDumper_Test_EnvParameters', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services33.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services33.php index 5d87dacd2..69bb1daf4 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services33.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services33.php @@ -2,6 +2,7 @@ namespace _PhpScoper5ea00cc67502b; +use _PhpScoper5ea00cc67502b\Foo\Foo; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container; @@ -9,13 +10,18 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use function class_alias; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class ProjectServiceContainer extends Container { private $parameters = []; private $targetDirs = []; @@ -28,20 +34,20 @@ public function __construct() } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } /** * Gets the public 'Bar\Foo' shared service. @@ -59,7 +65,7 @@ protected function getFooService() */ protected function getFoo2Service() { - return $this->services['Foo\\Foo'] = new \_PhpScoper5ea00cc67502b\Foo\Foo(); + return $this->services['Foo\\Foo'] = new Foo(); } } /** @@ -68,4 +74,4 @@ protected function getFoo2Service() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', \false); +class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services8.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services8.php index 08efddd67..4d7266f86 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services8.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services8.php @@ -9,13 +9,20 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use function array_key_exists; +use function class_alias; +use function sprintf; +use function strtolower; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class ProjectServiceContainer extends Container { private $parameters = []; private $targetDirs = []; @@ -27,28 +34,28 @@ public function __construct() } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } public function getParameter($name) { $name = (string) $name; - if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { $name = $this->normalizeParameterName($name); - if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The parameter "%s" must be defined.', $name)); + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { + throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); } } if (isset($this->loadedDynamicParameters[$name])) { @@ -60,11 +67,11 @@ public function hasParameter($name) { $name = (string) $name; $name = $this->normalizeParameterName($name); - return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters); + return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters); } public function setParameter($name, $value) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('Impossible to call set() on a frozen ParameterBag.'); + throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); } public function getParameterBag() { @@ -73,7 +80,7 @@ public function getParameterBag() foreach ($this->loadedDynamicParameters as $name => $loaded) { $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name); } - $this->parameterBag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag($parameters); + $this->parameterBag = new FrozenParameterBag($parameters); } return $this->parameterBag; } @@ -90,15 +97,15 @@ public function getParameterBag() */ private function getDynamicParameter($name) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The dynamic parameter "%s" must be defined.', $name)); + throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } private $normalizedParameterNames = []; private function normalizeParameterName($name) { - if (isset($this->normalizedParameterNames[$normalizedName = \strtolower($name)]) || isset($this->parameters[$normalizedName]) || \array_key_exists($normalizedName, $this->parameters)) { + if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) { $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName; if ((string) $name !== $normalizedName) { - @\trigger_error(\sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), \E_USER_DEPRECATED); + @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), E_USER_DEPRECATED); } } else { $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name; @@ -112,7 +119,7 @@ private function normalizeParameterName($name) */ protected function getDefaultParameters() { - return ['foo' => 'bar', 'baz' => 'bar', 'bar' => 'foo is %foo bar', 'escape' => '@escapeme', 'values' => [0 => \true, 1 => \false, 2 => \NULL, 3 => 0, 4 => 1000.3, 5 => 'true', 6 => 'false', 7 => 'null'], 'null string' => 'null', 'string of digits' => '123', 'string of digits prefixed with minus character' => '-123', 'true string' => 'true', 'false string' => 'false', 'binary number string' => '0b0110', 'numeric string' => '-1.2E2', 'hexadecimal number string' => '0xFF', 'float string' => '10100.1', 'positive float string' => '+10100.1', 'negative float string' => '-10100.1']; + return ['foo' => 'bar', 'baz' => 'bar', 'bar' => 'foo is %foo bar', 'escape' => '@escapeme', 'values' => [0 => true, 1 => false, 2 => NULL, 3 => 0, 4 => 1000.3, 5 => 'true', 6 => 'false', 7 => 'null'], 'null string' => 'null', 'string of digits' => '123', 'string of digits prefixed with minus character' => '-123', 'true string' => 'true', 'false string' => 'false', 'binary number string' => '0b0110', 'numeric string' => '-1.2E2', 'hexadecimal number string' => '0xFF', 'float string' => '10100.1', 'positive float string' => '+10100.1', 'negative float string' => '-10100.1']; } } /** @@ -121,4 +128,4 @@ protected function getDefaultParameters() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', \false); +class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9.php index 14bfa0ce4..904150533 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9.php @@ -2,6 +2,7 @@ namespace _PhpScoper5ea00cc67502b; +use _PhpScoper5ea00cc67502b\Bar\FooClass; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container; @@ -9,23 +10,37 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; +use Bar; +use Baz; +use ConfClass; +use EmptyIterator; +use FactoryClass; +use Foo; +use FooBarBaz; +use SimpleFactoryClass; +use stdClass; +use function call_user_func; +use function class_alias; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class ProjectServiceContainer extends Container { private $parameters = []; private $targetDirs = []; public function __construct() { - parent::__construct(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag($this->getDefaultParameters())); + parent::__construct(new ParameterBag($this->getDefaultParameters())); $this->normalizedIds = ['_PhpScoper5ea00cc67502b\\psr\\container\\containerinterface' => '_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface', '_PhpScoper5ea00cc67502b\\symfony\\component\\dependencyinjection\\containerinterface' => '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface']; - $this->syntheticIds = ['request' => \true]; + $this->syntheticIds = ['request' => true]; $this->methodMap = ['bar' => 'getBarService', 'baz' => 'getBazService', 'configurator_service' => 'getConfiguratorServiceService', 'configurator_service_simple' => 'getConfiguratorServiceSimpleService', 'configured_service' => 'getConfiguredServiceService', 'configured_service_simple' => 'getConfiguredServiceSimpleService', 'decorated' => 'getDecoratedService', 'decorator_service' => 'getDecoratorServiceService', 'decorator_service_with_name' => 'getDecoratorServiceWithNameService', 'deprecated_service' => 'getDeprecatedServiceService', 'factory_service' => 'getFactoryServiceService', 'factory_service_simple' => 'getFactoryServiceSimpleService', 'factory_simple' => 'getFactorySimpleService', 'foo' => 'getFooService', 'foo.baz' => 'getFoo_BazService', 'foo_bar' => 'getFooBarService', 'foo_with_inline' => 'getFooWithInlineService', 'inlined' => 'getInlinedService', 'lazy_context' => 'getLazyContextService', 'lazy_context_ignore_invalid_ref' => 'getLazyContextIgnoreInvalidRefService', 'method_call1' => 'getMethodCall1Service', 'new_factory' => 'getNewFactoryService', 'new_factory_service' => 'getNewFactoryServiceService', 'service_from_static_method' => 'getServiceFromStaticMethodService', 'tagged_iterator' => 'getTaggedIteratorService', 'tagged_iterator_foo' => 'getTaggedIteratorFooService']; - $this->privates = ['configurator_service' => \true, 'configurator_service_simple' => \true, 'factory_simple' => \true, 'inlined' => \true, 'new_factory' => \true, 'tagged_iterator_foo' => \true]; + $this->privates = ['configurator_service' => true, 'configurator_service_simple' => true, 'factory_simple' => true, 'inlined' => true, 'new_factory' => true, 'tagged_iterator_foo' => true]; $this->aliases = ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => 'service_container', '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => 'service_container', 'alias_for_alias' => 'foo', 'alias_for_foo' => 'foo']; } /** @@ -35,100 +50,100 @@ public function __construct() */ protected function getBarService() { - $a = ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && \false ?: '_'}; - $this->services['bar'] = $instance = new \_PhpScoper5ea00cc67502b\Bar\FooClass('foo', $a, $this->getParameter('foo_bar')); + $a = ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && false ?: '_'}; + $this->services['bar'] = $instance = new FooClass('foo', $a, $this->getParameter('foo_bar')); $a->configure($instance); return $instance; } /** * Gets the public 'baz' shared service. * - * @return \Baz + * @return Baz */ protected function getBazService() { - $this->services['baz'] = $instance = new \_PhpScoper5ea00cc67502b\Baz(); - $instance->setFoo(${($_ = isset($this->services['foo_with_inline']) ? $this->services['foo_with_inline'] : $this->getFooWithInlineService()) && \false ?: '_'}); + $this->services['baz'] = $instance = new Baz(); + $instance->setFoo(${($_ = isset($this->services['foo_with_inline']) ? $this->services['foo_with_inline'] : $this->getFooWithInlineService()) && false ?: '_'}); return $instance; } /** * Gets the public 'configured_service' shared service. * - * @return \stdClass + * @return stdClass */ protected function getConfiguredServiceService() { - $this->services['configured_service'] = $instance = new \stdClass(); - ${($_ = isset($this->services['configurator_service']) ? $this->services['configurator_service'] : $this->getConfiguratorServiceService()) && \false ?: '_'}->configureStdClass($instance); + $this->services['configured_service'] = $instance = new stdClass(); + ${($_ = isset($this->services['configurator_service']) ? $this->services['configurator_service'] : $this->getConfiguratorServiceService()) && false ?: '_'}->configureStdClass($instance); return $instance; } /** * Gets the public 'configured_service_simple' shared service. * - * @return \stdClass + * @return stdClass */ protected function getConfiguredServiceSimpleService() { - $this->services['configured_service_simple'] = $instance = new \stdClass(); - ${($_ = isset($this->services['configurator_service_simple']) ? $this->services['configurator_service_simple'] : ($this->services['configurator_service_simple'] = new \_PhpScoper5ea00cc67502b\ConfClass('bar'))) && \false ?: '_'}->configureStdClass($instance); + $this->services['configured_service_simple'] = $instance = new stdClass(); + ${($_ = isset($this->services['configurator_service_simple']) ? $this->services['configurator_service_simple'] : ($this->services['configurator_service_simple'] = new ConfClass('bar'))) && false ?: '_'}->configureStdClass($instance); return $instance; } /** * Gets the public 'decorated' shared service. * - * @return \stdClass + * @return stdClass */ protected function getDecoratedService() { - return $this->services['decorated'] = new \stdClass(); + return $this->services['decorated'] = new stdClass(); } /** * Gets the public 'decorator_service' shared service. * - * @return \stdClass + * @return stdClass */ protected function getDecoratorServiceService() { - return $this->services['decorator_service'] = new \stdClass(); + return $this->services['decorator_service'] = new stdClass(); } /** * Gets the public 'decorator_service_with_name' shared service. * - * @return \stdClass + * @return stdClass */ protected function getDecoratorServiceWithNameService() { - return $this->services['decorator_service_with_name'] = new \stdClass(); + return $this->services['decorator_service_with_name'] = new stdClass(); } /** * Gets the public 'deprecated_service' shared service. * - * @return \stdClass + * @return stdClass * * @deprecated The "deprecated_service" service is deprecated. You should stop using it, as it will soon be removed. */ protected function getDeprecatedServiceService() { - @\trigger_error('The "deprecated_service" service is deprecated. You should stop using it, as it will soon be removed.', \E_USER_DEPRECATED); - return $this->services['deprecated_service'] = new \stdClass(); + @trigger_error('The "deprecated_service" service is deprecated. You should stop using it, as it will soon be removed.', E_USER_DEPRECATED); + return $this->services['deprecated_service'] = new stdClass(); } /** * Gets the public 'factory_service' shared service. * - * @return \Bar + * @return Bar */ protected function getFactoryServiceService() { - return $this->services['factory_service'] = ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && \false ?: '_'}->getInstance(); + return $this->services['factory_service'] = ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && false ?: '_'}->getInstance(); } /** * Gets the public 'factory_service_simple' shared service. * - * @return \Bar + * @return Bar */ protected function getFactoryServiceSimpleService() { - return $this->services['factory_service_simple'] = ${($_ = isset($this->services['factory_simple']) ? $this->services['factory_simple'] : $this->getFactorySimpleService()) && \false ?: '_'}->getInstance(); + return $this->services['factory_service_simple'] = ${($_ = isset($this->services['factory_simple']) ? $this->services['factory_simple'] : $this->getFactorySimpleService()) && false ?: '_'}->getInstance(); } /** * Gets the public 'foo' shared service. @@ -137,14 +152,14 @@ protected function getFactoryServiceSimpleService() */ protected function getFooService() { - $a = ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && \false ?: '_'}; - $this->services['foo'] = $instance = \_PhpScoper5ea00cc67502b\Bar\FooClass::getInstance('foo', $a, [$this->getParameter('foo') => 'foo is ' . $this->getParameter('foo') . '', 'foobar' => $this->getParameter('foo')], \true, $this); + $a = ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && false ?: '_'}; + $this->services['foo'] = $instance = FooClass::getInstance('foo', $a, [$this->getParameter('foo') => 'foo is ' . $this->getParameter('foo') . '', 'foobar' => $this->getParameter('foo')], true, $this); $instance->foo = 'bar'; $instance->moo = $a; $instance->qux = [$this->getParameter('foo') => 'foo is ' . $this->getParameter('foo') . '', 'foobar' => $this->getParameter('foo')]; - $instance->setBar(${($_ = isset($this->services['bar']) ? $this->services['bar'] : $this->getBarService()) && \false ?: '_'}); + $instance->setBar(${($_ = isset($this->services['bar']) ? $this->services['bar'] : $this->getBarService()) && false ?: '_'}); $instance->initialize(); - \_PhpScoper5ea00cc67502b\sc_configure($instance); + sc_configure($instance); return $instance; } /** @@ -154,8 +169,8 @@ protected function getFooService() */ protected function getFoo_BazService() { - $this->services['foo.baz'] = $instance = \call_user_func([$this->getParameter('baz_class'), 'getInstance']); - \call_user_func([$this->getParameter('baz_class'), 'configureStatic1'], $instance); + $this->services['foo.baz'] = $instance = call_user_func([$this->getParameter('baz_class'), 'getInstance']); + call_user_func([$this->getParameter('baz_class'), 'configureStatic1'], $instance); return $instance; } /** @@ -166,17 +181,17 @@ protected function getFoo_BazService() protected function getFooBarService() { $class = $this->getParameter('foo_class'); - return new $class(${($_ = isset($this->services['deprecated_service']) ? $this->services['deprecated_service'] : $this->getDeprecatedServiceService()) && \false ?: '_'}); + return new $class(${($_ = isset($this->services['deprecated_service']) ? $this->services['deprecated_service'] : $this->getDeprecatedServiceService()) && false ?: '_'}); } /** * Gets the public 'foo_with_inline' shared service. * - * @return \Foo + * @return Foo */ protected function getFooWithInlineService() { - $this->services['foo_with_inline'] = $instance = new \_PhpScoper5ea00cc67502b\Foo(); - $instance->setBar(${($_ = isset($this->services['inlined']) ? $this->services['inlined'] : $this->getInlinedService()) && \false ?: '_'}); + $this->services['foo_with_inline'] = $instance = new Foo(); + $instance->setBar(${($_ = isset($this->services['inlined']) ? $this->services['inlined'] : $this->getInlinedService()) && false ?: '_'}); return $instance; } /** @@ -186,11 +201,11 @@ protected function getFooWithInlineService() */ protected function getLazyContextService() { - return $this->services['lazy_context'] = new \_PhpScoper5ea00cc67502b\LazyContext(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator(function () { - (yield 'k1' => ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && \false ?: '_'}); + return $this->services['lazy_context'] = new LazyContext(new RewindableGenerator(function () { + (yield 'k1' => ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && false ?: '_'}); (yield 'k2' => $this); - }, 2), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator(function () { - return new \EmptyIterator(); + }, 2), new RewindableGenerator(function () { + return new EmptyIterator(); }, 0)); } /** @@ -200,19 +215,19 @@ protected function getLazyContextService() */ protected function getLazyContextIgnoreInvalidRefService() { - return $this->services['lazy_context_ignore_invalid_ref'] = new \_PhpScoper5ea00cc67502b\LazyContext(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator(function () { - (yield 0 => ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && \false ?: '_'}); + return $this->services['lazy_context_ignore_invalid_ref'] = new LazyContext(new RewindableGenerator(function () { + (yield 0 => ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && false ?: '_'}); if ($this->has('invalid')) { (yield 1 => ${($_ = isset($this->services['invalid']) ? $this->services['invalid'] : $this->get( 'invalid', /* ContainerInterface::NULL_ON_INVALID_REFERENCE */ 2 - )) && \false ?: '_'}); + )) && false ?: '_'}); } }, function () { return 1 + (int) $this->has('invalid'); - }), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator(function () { - return new \EmptyIterator(); + }), new RewindableGenerator(function () { + return new EmptyIterator(); }, 0)); } /** @@ -223,38 +238,38 @@ protected function getLazyContextIgnoreInvalidRefService() protected function getMethodCall1Service() { include_once '%path%foo.php'; - $this->services['method_call1'] = $instance = new \_PhpScoper5ea00cc67502b\Bar\FooClass(); - $instance->setBar(${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && \false ?: '_'}); + $this->services['method_call1'] = $instance = new FooClass(); + $instance->setBar(${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && false ?: '_'}); $instance->setBar(${($_ = isset($this->services['foo2']) ? $this->services['foo2'] : $this->get( 'foo2', /* ContainerInterface::NULL_ON_INVALID_REFERENCE */ 2 - )) && \false ?: '_'}); + )) && false ?: '_'}); if ($this->has('foo3')) { $instance->setBar(${($_ = isset($this->services['foo3']) ? $this->services['foo3'] : $this->get( 'foo3', /* ContainerInterface::NULL_ON_INVALID_REFERENCE */ 2 - )) && \false ?: '_'}); + )) && false ?: '_'}); } if ($this->has('foobaz')) { $instance->setBar(${($_ = isset($this->services['foobaz']) ? $this->services['foobaz'] : $this->get( 'foobaz', /* ContainerInterface::NULL_ON_INVALID_REFERENCE */ 2 - )) && \false ?: '_'}); + )) && false ?: '_'}); } - $instance->setBar(${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && \false ?: '_'}->foo() . ($this->hasParameter("foo") ? $this->getParameter("foo") : "default")); + $instance->setBar(${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && false ?: '_'}->foo() . ($this->hasParameter("foo") ? $this->getParameter("foo") : "default")); return $instance; } /** * Gets the public 'new_factory_service' shared service. * - * @return \FooBarBaz + * @return FooBarBaz */ protected function getNewFactoryServiceService() { - $this->services['new_factory_service'] = $instance = ${($_ = isset($this->services['new_factory']) ? $this->services['new_factory'] : $this->getNewFactoryService()) && \false ?: '_'}->getInstance(); + $this->services['new_factory_service'] = $instance = ${($_ = isset($this->services['new_factory']) ? $this->services['new_factory'] : $this->getNewFactoryService()) && false ?: '_'}->getInstance(); $instance->foo = 'bar'; return $instance; } @@ -265,82 +280,82 @@ protected function getNewFactoryServiceService() */ protected function getServiceFromStaticMethodService() { - return $this->services['service_from_static_method'] = \_PhpScoper5ea00cc67502b\Bar\FooClass::getInstance(); + return $this->services['service_from_static_method'] = FooClass::getInstance(); } /** * Gets the public 'tagged_iterator' shared service. * - * @return \Bar + * @return Bar */ protected function getTaggedIteratorService() { - return $this->services['tagged_iterator'] = new \_PhpScoper5ea00cc67502b\Bar(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator(function () { - return new \EmptyIterator(); + return $this->services['tagged_iterator'] = new Bar(new RewindableGenerator(function () { + return new EmptyIterator(); }, 0)); } /** * Gets the private 'configurator_service' shared service. * - * @return \ConfClass + * @return ConfClass */ protected function getConfiguratorServiceService() { - $this->services['configurator_service'] = $instance = new \_PhpScoper5ea00cc67502b\ConfClass(); - $instance->setFoo(${($_ = isset($this->services['baz']) ? $this->services['baz'] : $this->getBazService()) && \false ?: '_'}); + $this->services['configurator_service'] = $instance = new ConfClass(); + $instance->setFoo(${($_ = isset($this->services['baz']) ? $this->services['baz'] : $this->getBazService()) && false ?: '_'}); return $instance; } /** * Gets the private 'configurator_service_simple' shared service. * - * @return \ConfClass + * @return ConfClass */ protected function getConfiguratorServiceSimpleService() { - return $this->services['configurator_service_simple'] = new \_PhpScoper5ea00cc67502b\ConfClass('bar'); + return $this->services['configurator_service_simple'] = new ConfClass('bar'); } /** * Gets the private 'factory_simple' shared service. * - * @return \SimpleFactoryClass + * @return SimpleFactoryClass * * @deprecated The "factory_simple" service is deprecated. You should stop using it, as it will soon be removed. */ protected function getFactorySimpleService() { - @\trigger_error('The "factory_simple" service is deprecated. You should stop using it, as it will soon be removed.', \E_USER_DEPRECATED); - return $this->services['factory_simple'] = new \_PhpScoper5ea00cc67502b\SimpleFactoryClass('foo'); + @trigger_error('The "factory_simple" service is deprecated. You should stop using it, as it will soon be removed.', E_USER_DEPRECATED); + return $this->services['factory_simple'] = new SimpleFactoryClass('foo'); } /** * Gets the private 'inlined' shared service. * - * @return \Bar + * @return Bar */ protected function getInlinedService() { - $this->services['inlined'] = $instance = new \_PhpScoper5ea00cc67502b\Bar(); + $this->services['inlined'] = $instance = new Bar(); $instance->pub = 'pub'; - $instance->setBaz(${($_ = isset($this->services['baz']) ? $this->services['baz'] : $this->getBazService()) && \false ?: '_'}); + $instance->setBaz(${($_ = isset($this->services['baz']) ? $this->services['baz'] : $this->getBazService()) && false ?: '_'}); return $instance; } /** * Gets the private 'new_factory' shared service. * - * @return \FactoryClass + * @return FactoryClass */ protected function getNewFactoryService() { - $this->services['new_factory'] = $instance = new \_PhpScoper5ea00cc67502b\FactoryClass(); + $this->services['new_factory'] = $instance = new FactoryClass(); $instance->foo = 'bar'; return $instance; } /** * Gets the private 'tagged_iterator_foo' shared service. * - * @return \Bar + * @return Bar */ protected function getTaggedIteratorFooService() { - return $this->services['tagged_iterator_foo'] = new \_PhpScoper5ea00cc67502b\Bar(); + return $this->services['tagged_iterator_foo'] = new Bar(); } /** * Gets the default parameters. @@ -358,4 +373,4 @@ protected function getDefaultParameters() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', \false); +class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9_compiled.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9_compiled.php index 28b9aa24a..6eb2985ea 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9_compiled.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9_compiled.php @@ -2,6 +2,7 @@ namespace _PhpScoper5ea00cc67502b; +use _PhpScoper5ea00cc67502b\Bar\FooClass; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container; @@ -9,13 +10,27 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use Bar; +use Baz; +use EmptyIterator; +use Foo; +use FooBarBaz; +use SimpleFactoryClass; +use stdClass; +use function array_key_exists; +use function class_alias; +use function sprintf; +use function strtolower; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class ProjectServiceContainer extends Container { private $parameters = []; private $targetDirs = []; @@ -23,27 +38,27 @@ public function __construct() { $this->parameters = $this->getDefaultParameters(); $this->services = []; - $this->syntheticIds = ['request' => \true]; + $this->syntheticIds = ['request' => true]; $this->methodMap = ['bar' => 'getBarService', 'baz' => 'getBazService', 'configured_service' => 'getConfiguredServiceService', 'configured_service_simple' => 'getConfiguredServiceSimpleService', 'decorator_service' => 'getDecoratorServiceService', 'decorator_service_with_name' => 'getDecoratorServiceWithNameService', 'deprecated_service' => 'getDeprecatedServiceService', 'factory_service' => 'getFactoryServiceService', 'factory_service_simple' => 'getFactoryServiceSimpleService', 'factory_simple' => 'getFactorySimpleService', 'foo' => 'getFooService', 'foo.baz' => 'getFoo_BazService', 'foo_bar' => 'getFooBarService', 'foo_with_inline' => 'getFooWithInlineService', 'lazy_context' => 'getLazyContextService', 'lazy_context_ignore_invalid_ref' => 'getLazyContextIgnoreInvalidRefService', 'method_call1' => 'getMethodCall1Service', 'new_factory_service' => 'getNewFactoryServiceService', 'service_from_static_method' => 'getServiceFromStaticMethodService', 'tagged_iterator' => 'getTaggedIteratorService', 'tagged_iterator_foo' => 'getTaggedIteratorFooService']; - $this->privates = ['factory_simple' => \true, 'tagged_iterator_foo' => \true]; + $this->privates = ['factory_simple' => true, 'tagged_iterator_foo' => true]; $this->aliases = ['alias_for_alias' => 'foo', 'alias_for_foo' => 'foo', 'decorated' => 'decorator_service_with_name']; } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true, 'configurator_service' => \true, 'configurator_service_simple' => \true, 'decorated.pif-pouf' => \true, 'decorator_service.inner' => \true, 'factory_simple' => \true, 'inlined' => \true, 'new_factory' => \true, 'tagged_iterator_foo' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'configurator_service' => true, 'configurator_service_simple' => true, 'decorated.pif-pouf' => true, 'decorator_service.inner' => true, 'factory_simple' => true, 'inlined' => true, 'new_factory' => true, 'tagged_iterator_foo' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } /** * Gets the public 'bar' shared service. @@ -52,93 +67,93 @@ public function isFrozen() */ protected function getBarService() { - $a = ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && \false ?: '_'}; - $this->services['bar'] = $instance = new \_PhpScoper5ea00cc67502b\Bar\FooClass('foo', $a, $this->getParameter('foo_bar')); + $a = ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && false ?: '_'}; + $this->services['bar'] = $instance = new FooClass('foo', $a, $this->getParameter('foo_bar')); $a->configure($instance); return $instance; } /** * Gets the public 'baz' shared service. * - * @return \Baz + * @return Baz */ protected function getBazService() { - $this->services['baz'] = $instance = new \_PhpScoper5ea00cc67502b\Baz(); - $instance->setFoo(${($_ = isset($this->services['foo_with_inline']) ? $this->services['foo_with_inline'] : $this->getFooWithInlineService()) && \false ?: '_'}); + $this->services['baz'] = $instance = new Baz(); + $instance->setFoo(${($_ = isset($this->services['foo_with_inline']) ? $this->services['foo_with_inline'] : $this->getFooWithInlineService()) && false ?: '_'}); return $instance; } /** * Gets the public 'configured_service' shared service. * - * @return \stdClass + * @return stdClass */ protected function getConfiguredServiceService() { - $this->services['configured_service'] = $instance = new \stdClass(); - $a = new \_PhpScoper5ea00cc67502b\ConfClass(); - $a->setFoo(${($_ = isset($this->services['baz']) ? $this->services['baz'] : $this->getBazService()) && \false ?: '_'}); + $this->services['configured_service'] = $instance = new stdClass(); + $a = new ConfClass(); + $a->setFoo(${($_ = isset($this->services['baz']) ? $this->services['baz'] : $this->getBazService()) && false ?: '_'}); $a->configureStdClass($instance); return $instance; } /** * Gets the public 'configured_service_simple' shared service. * - * @return \stdClass + * @return stdClass */ protected function getConfiguredServiceSimpleService() { - $this->services['configured_service_simple'] = $instance = new \stdClass(); - (new \_PhpScoper5ea00cc67502b\ConfClass('bar'))->configureStdClass($instance); + $this->services['configured_service_simple'] = $instance = new stdClass(); + (new ConfClass('bar'))->configureStdClass($instance); return $instance; } /** * Gets the public 'decorator_service' shared service. * - * @return \stdClass + * @return stdClass */ protected function getDecoratorServiceService() { - return $this->services['decorator_service'] = new \stdClass(); + return $this->services['decorator_service'] = new stdClass(); } /** * Gets the public 'decorator_service_with_name' shared service. * - * @return \stdClass + * @return stdClass */ protected function getDecoratorServiceWithNameService() { - return $this->services['decorator_service_with_name'] = new \stdClass(); + return $this->services['decorator_service_with_name'] = new stdClass(); } /** * Gets the public 'deprecated_service' shared service. * - * @return \stdClass + * @return stdClass * * @deprecated The "deprecated_service" service is deprecated. You should stop using it, as it will soon be removed. */ protected function getDeprecatedServiceService() { - @\trigger_error('The "deprecated_service" service is deprecated. You should stop using it, as it will soon be removed.', \E_USER_DEPRECATED); - return $this->services['deprecated_service'] = new \stdClass(); + @trigger_error('The "deprecated_service" service is deprecated. You should stop using it, as it will soon be removed.', E_USER_DEPRECATED); + return $this->services['deprecated_service'] = new stdClass(); } /** * Gets the public 'factory_service' shared service. * - * @return \Bar + * @return Bar */ protected function getFactoryServiceService() { - return $this->services['factory_service'] = ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && \false ?: '_'}->getInstance(); + return $this->services['factory_service'] = ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && false ?: '_'}->getInstance(); } /** * Gets the public 'factory_service_simple' shared service. * - * @return \Bar + * @return Bar */ protected function getFactoryServiceSimpleService() { - return $this->services['factory_service_simple'] = ${($_ = isset($this->services['factory_simple']) ? $this->services['factory_simple'] : $this->getFactorySimpleService()) && \false ?: '_'}->getInstance(); + return $this->services['factory_service_simple'] = ${($_ = isset($this->services['factory_simple']) ? $this->services['factory_simple'] : $this->getFactorySimpleService()) && false ?: '_'}->getInstance(); } /** * Gets the public 'foo' shared service. @@ -147,14 +162,14 @@ protected function getFactoryServiceSimpleService() */ protected function getFooService() { - $a = ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && \false ?: '_'}; - $this->services['foo'] = $instance = \_PhpScoper5ea00cc67502b\Bar\FooClass::getInstance('foo', $a, ['bar' => 'foo is bar', 'foobar' => 'bar'], \true, $this); + $a = ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && false ?: '_'}; + $this->services['foo'] = $instance = FooClass::getInstance('foo', $a, ['bar' => 'foo is bar', 'foobar' => 'bar'], true, $this); $instance->foo = 'bar'; $instance->moo = $a; $instance->qux = ['bar' => 'foo is bar', 'foobar' => 'bar']; - $instance->setBar(${($_ = isset($this->services['bar']) ? $this->services['bar'] : $this->getBarService()) && \false ?: '_'}); + $instance->setBar(${($_ = isset($this->services['bar']) ? $this->services['bar'] : $this->getBarService()) && false ?: '_'}); $instance->initialize(); - \_PhpScoper5ea00cc67502b\sc_configure($instance); + sc_configure($instance); return $instance; } /** @@ -164,8 +179,8 @@ protected function getFooService() */ protected function getFoo_BazService() { - $this->services['foo.baz'] = $instance = \_PhpScoper5ea00cc67502b\BazClass::getInstance(); - \_PhpScoper5ea00cc67502b\BazClass::configureStatic1($instance); + $this->services['foo.baz'] = $instance = BazClass::getInstance(); + BazClass::configureStatic1($instance); return $instance; } /** @@ -175,19 +190,19 @@ protected function getFoo_BazService() */ protected function getFooBarService() { - return new \_PhpScoper5ea00cc67502b\Bar\FooClass(${($_ = isset($this->services['deprecated_service']) ? $this->services['deprecated_service'] : $this->getDeprecatedServiceService()) && \false ?: '_'}); + return new FooClass(${($_ = isset($this->services['deprecated_service']) ? $this->services['deprecated_service'] : $this->getDeprecatedServiceService()) && false ?: '_'}); } /** * Gets the public 'foo_with_inline' shared service. * - * @return \Foo + * @return Foo */ protected function getFooWithInlineService() { - $this->services['foo_with_inline'] = $instance = new \_PhpScoper5ea00cc67502b\Foo(); - $a = new \_PhpScoper5ea00cc67502b\Bar(); + $this->services['foo_with_inline'] = $instance = new Foo(); + $a = new Bar(); $a->pub = 'pub'; - $a->setBaz(${($_ = isset($this->services['baz']) ? $this->services['baz'] : $this->getBazService()) && \false ?: '_'}); + $a->setBaz(${($_ = isset($this->services['baz']) ? $this->services['baz'] : $this->getBazService()) && false ?: '_'}); $instance->setBar($a); return $instance; } @@ -198,11 +213,11 @@ protected function getFooWithInlineService() */ protected function getLazyContextService() { - return $this->services['lazy_context'] = new \_PhpScoper5ea00cc67502b\LazyContext(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator(function () { - (yield 'k1' => ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && \false ?: '_'}); + return $this->services['lazy_context'] = new LazyContext(new RewindableGenerator(function () { + (yield 'k1' => ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && false ?: '_'}); (yield 'k2' => $this); - }, 2), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator(function () { - return new \EmptyIterator(); + }, 2), new RewindableGenerator(function () { + return new EmptyIterator(); }, 0)); } /** @@ -212,10 +227,10 @@ protected function getLazyContextService() */ protected function getLazyContextIgnoreInvalidRefService() { - return $this->services['lazy_context_ignore_invalid_ref'] = new \_PhpScoper5ea00cc67502b\LazyContext(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator(function () { - (yield 0 => ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && \false ?: '_'}); - }, 1), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator(function () { - return new \EmptyIterator(); + return $this->services['lazy_context_ignore_invalid_ref'] = new LazyContext(new RewindableGenerator(function () { + (yield 0 => ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && false ?: '_'}); + }, 1), new RewindableGenerator(function () { + return new EmptyIterator(); }, 0)); } /** @@ -226,20 +241,20 @@ protected function getLazyContextIgnoreInvalidRefService() protected function getMethodCall1Service() { include_once '%path%foo.php'; - $this->services['method_call1'] = $instance = new \_PhpScoper5ea00cc67502b\Bar\FooClass(); - $instance->setBar(${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && \false ?: '_'}); - $instance->setBar(\NULL); - $instance->setBar(${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && \false ?: '_'}->foo() . ($this->hasParameter("foo") ? $this->getParameter("foo") : "default")); + $this->services['method_call1'] = $instance = new FooClass(); + $instance->setBar(${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && false ?: '_'}); + $instance->setBar(NULL); + $instance->setBar(${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && false ?: '_'}->foo() . ($this->hasParameter("foo") ? $this->getParameter("foo") : "default")); return $instance; } /** * Gets the public 'new_factory_service' shared service. * - * @return \FooBarBaz + * @return FooBarBaz */ protected function getNewFactoryServiceService() { - $a = new \_PhpScoper5ea00cc67502b\FactoryClass(); + $a = new FactoryClass(); $a->foo = 'bar'; $this->services['new_factory_service'] = $instance = $a->getInstance(); $instance->foo = 'bar'; @@ -252,48 +267,48 @@ protected function getNewFactoryServiceService() */ protected function getServiceFromStaticMethodService() { - return $this->services['service_from_static_method'] = \_PhpScoper5ea00cc67502b\Bar\FooClass::getInstance(); + return $this->services['service_from_static_method'] = FooClass::getInstance(); } /** * Gets the public 'tagged_iterator' shared service. * - * @return \Bar + * @return Bar */ protected function getTaggedIteratorService() { - return $this->services['tagged_iterator'] = new \_PhpScoper5ea00cc67502b\Bar(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator(function () { - (yield 0 => ${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && \false ?: '_'}); - (yield 1 => ${($_ = isset($this->services['tagged_iterator_foo']) ? $this->services['tagged_iterator_foo'] : ($this->services['tagged_iterator_foo'] = new \_PhpScoper5ea00cc67502b\Bar())) && \false ?: '_'}); + return $this->services['tagged_iterator'] = new Bar(new RewindableGenerator(function () { + (yield 0 => ${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && false ?: '_'}); + (yield 1 => ${($_ = isset($this->services['tagged_iterator_foo']) ? $this->services['tagged_iterator_foo'] : ($this->services['tagged_iterator_foo'] = new Bar())) && false ?: '_'}); }, 2)); } /** * Gets the private 'factory_simple' shared service. * - * @return \SimpleFactoryClass + * @return SimpleFactoryClass * * @deprecated The "factory_simple" service is deprecated. You should stop using it, as it will soon be removed. */ protected function getFactorySimpleService() { - @\trigger_error('The "factory_simple" service is deprecated. You should stop using it, as it will soon be removed.', \E_USER_DEPRECATED); - return $this->services['factory_simple'] = new \_PhpScoper5ea00cc67502b\SimpleFactoryClass('foo'); + @trigger_error('The "factory_simple" service is deprecated. You should stop using it, as it will soon be removed.', E_USER_DEPRECATED); + return $this->services['factory_simple'] = new SimpleFactoryClass('foo'); } /** * Gets the private 'tagged_iterator_foo' shared service. * - * @return \Bar + * @return Bar */ protected function getTaggedIteratorFooService() { - return $this->services['tagged_iterator_foo'] = new \_PhpScoper5ea00cc67502b\Bar(); + return $this->services['tagged_iterator_foo'] = new Bar(); } public function getParameter($name) { $name = (string) $name; - if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { $name = $this->normalizeParameterName($name); - if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The parameter "%s" must be defined.', $name)); + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { + throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); } } if (isset($this->loadedDynamicParameters[$name])) { @@ -305,11 +320,11 @@ public function hasParameter($name) { $name = (string) $name; $name = $this->normalizeParameterName($name); - return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters); + return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters); } public function setParameter($name, $value) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('Impossible to call set() on a frozen ParameterBag.'); + throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); } public function getParameterBag() { @@ -318,7 +333,7 @@ public function getParameterBag() foreach ($this->loadedDynamicParameters as $name => $loaded) { $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name); } - $this->parameterBag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag($parameters); + $this->parameterBag = new FrozenParameterBag($parameters); } return $this->parameterBag; } @@ -335,15 +350,15 @@ public function getParameterBag() */ private function getDynamicParameter($name) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The dynamic parameter "%s" must be defined.', $name)); + throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } private $normalizedParameterNames = []; private function normalizeParameterName($name) { - if (isset($this->normalizedParameterNames[$normalizedName = \strtolower($name)]) || isset($this->parameters[$normalizedName]) || \array_key_exists($normalizedName, $this->parameters)) { + if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) { $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName; if ((string) $name !== $normalizedName) { - @\trigger_error(\sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), \E_USER_DEPRECATED); + @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), E_USER_DEPRECATED); } } else { $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name; @@ -366,4 +381,4 @@ protected function getDefaultParameters() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', \false); +class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_adawson.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_adawson.php index 0f839c9c7..4dc072b11 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_adawson.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_adawson.php @@ -2,6 +2,13 @@ namespace _PhpScoper5ea00cc67502b; +use _PhpScoper5ea00cc67502b\App\Bus; +use _PhpScoper5ea00cc67502b\App\Db; +use _PhpScoper5ea00cc67502b\App\Handler1; +use _PhpScoper5ea00cc67502b\App\Handler2; +use _PhpScoper5ea00cc67502b\App\Processor; +use _PhpScoper5ea00cc67502b\App\Registry; +use _PhpScoper5ea00cc67502b\App\Schema; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container; @@ -9,13 +16,18 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use function class_alias; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class ProjectServiceContainer extends Container { private $parameters = []; private $targetDirs = []; @@ -24,25 +36,25 @@ public function __construct() $this->services = []; $this->normalizedIds = ['_PhpScoper5ea00cc67502b\\app\\bus' => '_PhpScoper5ea00cc67502b\\App\\Bus', '_PhpScoper5ea00cc67502b\\app\\db' => '_PhpScoper5ea00cc67502b\\App\\Db', '_PhpScoper5ea00cc67502b\\app\\handler1' => '_PhpScoper5ea00cc67502b\\App\\Handler1', '_PhpScoper5ea00cc67502b\\app\\handler2' => '_PhpScoper5ea00cc67502b\\App\\Handler2', '_PhpScoper5ea00cc67502b\\app\\processor' => '_PhpScoper5ea00cc67502b\\App\\Processor', '_PhpScoper5ea00cc67502b\\app\\registry' => '_PhpScoper5ea00cc67502b\\App\\Registry', '_PhpScoper5ea00cc67502b\\app\\schema' => '_PhpScoper5ea00cc67502b\\App\\Schema']; $this->methodMap = ['_PhpScoper5ea00cc67502b\\App\\Bus' => 'getBusService', '_PhpScoper5ea00cc67502b\\App\\Db' => 'getDbService', '_PhpScoper5ea00cc67502b\\App\\Handler1' => 'getHandler1Service', '_PhpScoper5ea00cc67502b\\App\\Handler2' => 'getHandler2Service', '_PhpScoper5ea00cc67502b\\App\\Processor' => 'getProcessorService', '_PhpScoper5ea00cc67502b\\App\\Registry' => 'getRegistryService', '_PhpScoper5ea00cc67502b\\App\\Schema' => 'getSchemaService']; - $this->privates = ['_PhpScoper5ea00cc67502b\\App\\Handler1' => \true, '_PhpScoper5ea00cc67502b\\App\\Handler2' => \true, '_PhpScoper5ea00cc67502b\\App\\Processor' => \true, '_PhpScoper5ea00cc67502b\\App\\Registry' => \true, '_PhpScoper5ea00cc67502b\\App\\Schema' => \true]; + $this->privates = ['_PhpScoper5ea00cc67502b\\App\\Handler1' => true, '_PhpScoper5ea00cc67502b\\App\\Handler2' => true, '_PhpScoper5ea00cc67502b\\App\\Processor' => true, '_PhpScoper5ea00cc67502b\\App\\Registry' => true, '_PhpScoper5ea00cc67502b\\App\\Schema' => true]; $this->aliases = []; } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\App\\Handler1' => \true, '_PhpScoper5ea00cc67502b\\App\\Handler2' => \true, '_PhpScoper5ea00cc67502b\\App\\Processor' => \true, '_PhpScoper5ea00cc67502b\\App\\Registry' => \true, '_PhpScoper5ea00cc67502b\\App\\Schema' => \true, '_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true]; + return ['_PhpScoper5ea00cc67502b\\App\\Handler1' => true, '_PhpScoper5ea00cc67502b\\App\\Handler2' => true, '_PhpScoper5ea00cc67502b\\App\\Processor' => true, '_PhpScoper5ea00cc67502b\\App\\Registry' => true, '_PhpScoper5ea00cc67502b\\App\\Schema' => true, '_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } /** * Gets the public 'App\Bus' shared service. @@ -51,9 +63,9 @@ public function isFrozen() */ protected function getBusService() { - $this->services['App\\Bus'] = $instance = new \_PhpScoper5ea00cc67502b\App\Bus(${($_ = isset($this->services['App\\Db']) ? $this->services['App\\Db'] : $this->getDbService()) && \false ?: '_'}); - $instance->handler1 = ${($_ = isset($this->services['App\\Handler1']) ? $this->services['App\\Handler1'] : $this->getHandler1Service()) && \false ?: '_'}; - $instance->handler2 = ${($_ = isset($this->services['App\\Handler2']) ? $this->services['App\\Handler2'] : $this->getHandler2Service()) && \false ?: '_'}; + $this->services['App\\Bus'] = $instance = new Bus(${($_ = isset($this->services['App\\Db']) ? $this->services['App\\Db'] : $this->getDbService()) && false ?: '_'}); + $instance->handler1 = ${($_ = isset($this->services['App\\Handler1']) ? $this->services['App\\Handler1'] : $this->getHandler1Service()) && false ?: '_'}; + $instance->handler2 = ${($_ = isset($this->services['App\\Handler2']) ? $this->services['App\\Handler2'] : $this->getHandler2Service()) && false ?: '_'}; return $instance; } /** @@ -63,8 +75,8 @@ protected function getBusService() */ protected function getDbService() { - $this->services['App\\Db'] = $instance = new \_PhpScoper5ea00cc67502b\App\Db(); - $instance->schema = ${($_ = isset($this->services['App\\Schema']) ? $this->services['App\\Schema'] : $this->getSchemaService()) && \false ?: '_'}; + $this->services['App\\Db'] = $instance = new Db(); + $instance->schema = ${($_ = isset($this->services['App\\Schema']) ? $this->services['App\\Schema'] : $this->getSchemaService()) && false ?: '_'}; return $instance; } /** @@ -74,11 +86,11 @@ protected function getDbService() */ protected function getHandler1Service() { - $a = ${($_ = isset($this->services['App\\Processor']) ? $this->services['App\\Processor'] : $this->getProcessorService()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['App\\Processor']) ? $this->services['App\\Processor'] : $this->getProcessorService()) && false ?: '_'}; if (isset($this->services['App\\Handler1'])) { return $this->services['App\\Handler1']; } - return $this->services['App\\Handler1'] = new \_PhpScoper5ea00cc67502b\App\Handler1(${($_ = isset($this->services['App\\Db']) ? $this->services['App\\Db'] : $this->getDbService()) && \false ?: '_'}, ${($_ = isset($this->services['App\\Schema']) ? $this->services['App\\Schema'] : $this->getSchemaService()) && \false ?: '_'}, $a); + return $this->services['App\\Handler1'] = new Handler1(${($_ = isset($this->services['App\\Db']) ? $this->services['App\\Db'] : $this->getDbService()) && false ?: '_'}, ${($_ = isset($this->services['App\\Schema']) ? $this->services['App\\Schema'] : $this->getSchemaService()) && false ?: '_'}, $a); } /** * Gets the private 'App\Handler2' shared service. @@ -87,11 +99,11 @@ protected function getHandler1Service() */ protected function getHandler2Service() { - $a = ${($_ = isset($this->services['App\\Processor']) ? $this->services['App\\Processor'] : $this->getProcessorService()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['App\\Processor']) ? $this->services['App\\Processor'] : $this->getProcessorService()) && false ?: '_'}; if (isset($this->services['App\\Handler2'])) { return $this->services['App\\Handler2']; } - return $this->services['App\\Handler2'] = new \_PhpScoper5ea00cc67502b\App\Handler2(${($_ = isset($this->services['App\\Db']) ? $this->services['App\\Db'] : $this->getDbService()) && \false ?: '_'}, ${($_ = isset($this->services['App\\Schema']) ? $this->services['App\\Schema'] : $this->getSchemaService()) && \false ?: '_'}, $a); + return $this->services['App\\Handler2'] = new Handler2(${($_ = isset($this->services['App\\Db']) ? $this->services['App\\Db'] : $this->getDbService()) && false ?: '_'}, ${($_ = isset($this->services['App\\Schema']) ? $this->services['App\\Schema'] : $this->getSchemaService()) && false ?: '_'}, $a); } /** * Gets the private 'App\Processor' shared service. @@ -100,11 +112,11 @@ protected function getHandler2Service() */ protected function getProcessorService() { - $a = ${($_ = isset($this->services['App\\Registry']) ? $this->services['App\\Registry'] : $this->getRegistryService()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['App\\Registry']) ? $this->services['App\\Registry'] : $this->getRegistryService()) && false ?: '_'}; if (isset($this->services['App\\Processor'])) { return $this->services['App\\Processor']; } - return $this->services['App\\Processor'] = new \_PhpScoper5ea00cc67502b\App\Processor($a, ${($_ = isset($this->services['App\\Db']) ? $this->services['App\\Db'] : $this->getDbService()) && \false ?: '_'}); + return $this->services['App\\Processor'] = new Processor($a, ${($_ = isset($this->services['App\\Db']) ? $this->services['App\\Db'] : $this->getDbService()) && false ?: '_'}); } /** * Gets the private 'App\Registry' shared service. @@ -113,8 +125,8 @@ protected function getProcessorService() */ protected function getRegistryService() { - $this->services['App\\Registry'] = $instance = new \_PhpScoper5ea00cc67502b\App\Registry(); - $instance->processor = [0 => ${($_ = isset($this->services['App\\Db']) ? $this->services['App\\Db'] : $this->getDbService()) && \false ?: '_'}, 1 => ${($_ = isset($this->services['App\\Bus']) ? $this->services['App\\Bus'] : $this->getBusService()) && \false ?: '_'}]; + $this->services['App\\Registry'] = $instance = new Registry(); + $instance->processor = [0 => ${($_ = isset($this->services['App\\Db']) ? $this->services['App\\Db'] : $this->getDbService()) && false ?: '_'}, 1 => ${($_ = isset($this->services['App\\Bus']) ? $this->services['App\\Bus'] : $this->getBusService()) && false ?: '_'}]; return $instance; } /** @@ -124,11 +136,11 @@ protected function getRegistryService() */ protected function getSchemaService() { - $a = ${($_ = isset($this->services['App\\Db']) ? $this->services['App\\Db'] : $this->getDbService()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['App\\Db']) ? $this->services['App\\Db'] : $this->getDbService()) && false ?: '_'}; if (isset($this->services['App\\Schema'])) { return $this->services['App\\Schema']; } - return $this->services['App\\Schema'] = new \_PhpScoper5ea00cc67502b\App\Schema($a); + return $this->services['App\\Schema'] = new Schema($a); } } /** @@ -137,4 +149,4 @@ protected function getSchemaService() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', \false); +class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_almost_circular_private.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_almost_circular_private.php index 344947f06..9e07b888f 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_almost_circular_private.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_almost_circular_private.php @@ -9,13 +9,20 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls; +use stdClass; +use function class_alias; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class Symfony_DI_PhpDumper_Test_Almost_Circular_Private extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class Symfony_DI_PhpDumper_Test_Almost_Circular_Private extends Container { private $parameters = []; private $targetDirs = []; @@ -23,25 +30,25 @@ public function __construct() { $this->services = []; $this->methodMap = ['bar2' => 'getBar2Service', 'bar3' => 'getBar3Service', 'bar6' => 'getBar6Service', 'baz6' => 'getBaz6Service', 'connection' => 'getConnectionService', 'connection2' => 'getConnection2Service', 'foo' => 'getFooService', 'foo2' => 'getFoo2Service', 'foo5' => 'getFoo5Service', 'foo6' => 'getFoo6Service', 'foobar4' => 'getFoobar4Service', 'level2' => 'getLevel2Service', 'level3' => 'getLevel3Service', 'level4' => 'getLevel4Service', 'level5' => 'getLevel5Service', 'level6' => 'getLevel6Service', 'listener3' => 'getListener3Service', 'listener4' => 'getListener4Service', 'logger' => 'getLoggerService', 'manager' => 'getManagerService', 'manager2' => 'getManager2Service', 'manager3' => 'getManager3Service', 'manager4' => 'getManager4Service', 'multiuse1' => 'getMultiuse1Service', 'root' => 'getRootService', 'subscriber' => 'getSubscriberService']; - $this->privates = ['bar6' => \true, 'level2' => \true, 'level3' => \true, 'level4' => \true, 'level5' => \true, 'level6' => \true, 'manager4' => \true, 'multiuse1' => \true]; + $this->privates = ['bar6' => true, 'level2' => true, 'level3' => true, 'level4' => true, 'level5' => true, 'level6' => true, 'manager4' => true, 'multiuse1' => true]; $this->aliases = []; } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true, 'bar' => \true, 'bar5' => \true, 'bar6' => \true, 'config' => \true, 'config2' => \true, 'connection3' => \true, 'connection4' => \true, 'dispatcher' => \true, 'dispatcher2' => \true, 'foo4' => \true, 'foobar' => \true, 'foobar2' => \true, 'foobar3' => \true, 'level2' => \true, 'level3' => \true, 'level4' => \true, 'level5' => \true, 'level6' => \true, 'logger2' => \true, 'manager4' => \true, 'multiuse1' => \true, 'subscriber2' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'bar' => true, 'bar5' => true, 'bar6' => true, 'config' => true, 'config2' => true, 'connection3' => true, 'connection4' => true, 'dispatcher' => true, 'dispatcher2' => true, 'foo4' => true, 'foobar' => true, 'foobar2' => true, 'foobar3' => true, 'level2' => true, 'level3' => true, 'level4' => true, 'level5' => true, 'level6' => true, 'logger2' => true, 'manager4' => true, 'multiuse1' => true, 'subscriber2' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } /** * Gets the public 'bar2' shared service. @@ -50,8 +57,8 @@ public function isFrozen() */ protected function getBar2Service() { - $this->services['bar2'] = $instance = new \_PhpScoper5ea00cc67502b\BarCircular(); - $instance->addFoobar(new \_PhpScoper5ea00cc67502b\FoobarCircular(${($_ = isset($this->services['foo2']) ? $this->services['foo2'] : $this->getFoo2Service()) && \false ?: '_'})); + $this->services['bar2'] = $instance = new BarCircular(); + $instance->addFoobar(new FoobarCircular(${($_ = isset($this->services['foo2']) ? $this->services['foo2'] : $this->getFoo2Service()) && false ?: '_'})); return $instance; } /** @@ -61,51 +68,51 @@ protected function getBar2Service() */ protected function getBar3Service() { - $this->services['bar3'] = $instance = new \_PhpScoper5ea00cc67502b\BarCircular(); - $a = new \_PhpScoper5ea00cc67502b\FoobarCircular(); + $this->services['bar3'] = $instance = new BarCircular(); + $a = new FoobarCircular(); $instance->addFoobar($a, $a); return $instance; } /** * Gets the public 'baz6' shared service. * - * @return \stdClass + * @return stdClass */ protected function getBaz6Service() { - $this->services['baz6'] = $instance = new \stdClass(); - $instance->bar6 = ${($_ = isset($this->services['bar6']) ? $this->services['bar6'] : $this->getBar6Service()) && \false ?: '_'}; + $this->services['baz6'] = $instance = new stdClass(); + $instance->bar6 = ${($_ = isset($this->services['bar6']) ? $this->services['bar6'] : $this->getBar6Service()) && false ?: '_'}; return $instance; } /** * Gets the public 'connection' shared service. * - * @return \stdClass + * @return stdClass */ protected function getConnectionService() { - $a = new \stdClass(); - $b = new \stdClass(); - $this->services['connection'] = $instance = new \stdClass($a, $b); - $b->logger = ${($_ = isset($this->services['logger']) ? $this->services['logger'] : $this->getLoggerService()) && \false ?: '_'}; - $a->subscriber = ${($_ = isset($this->services['subscriber']) ? $this->services['subscriber'] : $this->getSubscriberService()) && \false ?: '_'}; + $a = new stdClass(); + $b = new stdClass(); + $this->services['connection'] = $instance = new stdClass($a, $b); + $b->logger = ${($_ = isset($this->services['logger']) ? $this->services['logger'] : $this->getLoggerService()) && false ?: '_'}; + $a->subscriber = ${($_ = isset($this->services['subscriber']) ? $this->services['subscriber'] : $this->getSubscriberService()) && false ?: '_'}; return $instance; } /** * Gets the public 'connection2' shared service. * - * @return \stdClass + * @return stdClass */ protected function getConnection2Service() { - $a = new \stdClass(); - $b = new \stdClass(); - $this->services['connection2'] = $instance = new \stdClass($a, $b); - $c = new \stdClass($instance); - $d = ${($_ = isset($this->services['manager2']) ? $this->services['manager2'] : $this->getManager2Service()) && \false ?: '_'}; - $c->handler2 = new \stdClass($d); + $a = new stdClass(); + $b = new stdClass(); + $this->services['connection2'] = $instance = new stdClass($a, $b); + $c = new stdClass($instance); + $d = ${($_ = isset($this->services['manager2']) ? $this->services['manager2'] : $this->getManager2Service()) && false ?: '_'}; + $c->handler2 = new stdClass($d); $b->logger2 = $c; - $a->subscriber2 = new \stdClass($d); + $a->subscriber2 = new stdClass($d); return $instance; } /** @@ -115,9 +122,9 @@ protected function getConnection2Service() */ protected function getFooService() { - $a = new \_PhpScoper5ea00cc67502b\BarCircular(); - $this->services['foo'] = $instance = new \_PhpScoper5ea00cc67502b\FooCircular($a); - $a->addFoobar(new \_PhpScoper5ea00cc67502b\FoobarCircular($instance)); + $a = new BarCircular(); + $this->services['foo'] = $instance = new FooCircular($a); + $a->addFoobar(new FoobarCircular($instance)); return $instance; } /** @@ -127,21 +134,21 @@ protected function getFooService() */ protected function getFoo2Service() { - $a = ${($_ = isset($this->services['bar2']) ? $this->services['bar2'] : $this->getBar2Service()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['bar2']) ? $this->services['bar2'] : $this->getBar2Service()) && false ?: '_'}; if (isset($this->services['foo2'])) { return $this->services['foo2']; } - return $this->services['foo2'] = new \_PhpScoper5ea00cc67502b\FooCircular($a); + return $this->services['foo2'] = new FooCircular($a); } /** * Gets the public 'foo5' shared service. * - * @return \stdClass + * @return stdClass */ protected function getFoo5Service() { - $this->services['foo5'] = $instance = new \stdClass(); - $a = new \stdClass($instance); + $this->services['foo5'] = $instance = new stdClass(); + $a = new stdClass($instance); $a->foo = $instance; $instance->bar = $a; return $instance; @@ -149,140 +156,140 @@ protected function getFoo5Service() /** * Gets the public 'foo6' shared service. * - * @return \stdClass + * @return stdClass */ protected function getFoo6Service() { - $this->services['foo6'] = $instance = new \stdClass(); - $instance->bar6 = ${($_ = isset($this->services['bar6']) ? $this->services['bar6'] : $this->getBar6Service()) && \false ?: '_'}; + $this->services['foo6'] = $instance = new stdClass(); + $instance->bar6 = ${($_ = isset($this->services['bar6']) ? $this->services['bar6'] : $this->getBar6Service()) && false ?: '_'}; return $instance; } /** * Gets the public 'foobar4' shared service. * - * @return \stdClass + * @return stdClass */ protected function getFoobar4Service() { - $a = new \stdClass(); - $this->services['foobar4'] = $instance = new \stdClass($a); + $a = new stdClass(); + $this->services['foobar4'] = $instance = new stdClass($a); $a->foobar = $instance; return $instance; } /** * Gets the public 'listener3' shared service. * - * @return \stdClass + * @return stdClass */ protected function getListener3Service() { - $this->services['listener3'] = $instance = new \stdClass(); - $instance->manager = ${($_ = isset($this->services['manager3']) ? $this->services['manager3'] : $this->getManager3Service()) && \false ?: '_'}; + $this->services['listener3'] = $instance = new stdClass(); + $instance->manager = ${($_ = isset($this->services['manager3']) ? $this->services['manager3'] : $this->getManager3Service()) && false ?: '_'}; return $instance; } /** * Gets the public 'listener4' shared service. * - * @return \stdClass + * @return stdClass */ protected function getListener4Service() { - $a = ${($_ = isset($this->services['manager4']) ? $this->services['manager4'] : $this->getManager4Service()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['manager4']) ? $this->services['manager4'] : $this->getManager4Service()) && false ?: '_'}; if (isset($this->services['listener4'])) { return $this->services['listener4']; } - return $this->services['listener4'] = new \stdClass($a); + return $this->services['listener4'] = new stdClass($a); } /** * Gets the public 'logger' shared service. * - * @return \stdClass + * @return stdClass */ protected function getLoggerService() { - $a = ${($_ = isset($this->services['connection']) ? $this->services['connection'] : $this->getConnectionService()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['connection']) ? $this->services['connection'] : $this->getConnectionService()) && false ?: '_'}; if (isset($this->services['logger'])) { return $this->services['logger']; } - $this->services['logger'] = $instance = new \stdClass($a); - $instance->handler = new \stdClass(${($_ = isset($this->services['manager']) ? $this->services['manager'] : $this->getManagerService()) && \false ?: '_'}); + $this->services['logger'] = $instance = new stdClass($a); + $instance->handler = new stdClass(${($_ = isset($this->services['manager']) ? $this->services['manager'] : $this->getManagerService()) && false ?: '_'}); return $instance; } /** * Gets the public 'manager' shared service. * - * @return \stdClass + * @return stdClass */ protected function getManagerService() { - $a = ${($_ = isset($this->services['connection']) ? $this->services['connection'] : $this->getConnectionService()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['connection']) ? $this->services['connection'] : $this->getConnectionService()) && false ?: '_'}; if (isset($this->services['manager'])) { return $this->services['manager']; } - return $this->services['manager'] = new \stdClass($a); + return $this->services['manager'] = new stdClass($a); } /** * Gets the public 'manager2' shared service. * - * @return \stdClass + * @return stdClass */ protected function getManager2Service() { - $a = ${($_ = isset($this->services['connection2']) ? $this->services['connection2'] : $this->getConnection2Service()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['connection2']) ? $this->services['connection2'] : $this->getConnection2Service()) && false ?: '_'}; if (isset($this->services['manager2'])) { return $this->services['manager2']; } - return $this->services['manager2'] = new \stdClass($a); + return $this->services['manager2'] = new stdClass($a); } /** * Gets the public 'manager3' shared service. * - * @return \stdClass + * @return stdClass */ - protected function getManager3Service($lazyLoad = \true) + protected function getManager3Service($lazyLoad = true) { - $a = ${($_ = isset($this->services['listener3']) ? $this->services['listener3'] : $this->getListener3Service()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['listener3']) ? $this->services['listener3'] : $this->getListener3Service()) && false ?: '_'}; if (isset($this->services['manager3'])) { return $this->services['manager3']; } - $b = new \stdClass(); + $b = new stdClass(); $b->listener = [0 => $a]; - return $this->services['manager3'] = new \stdClass($b); + return $this->services['manager3'] = new stdClass($b); } /** * Gets the public 'root' shared service. * - * @return \stdClass + * @return stdClass */ protected function getRootService() { - return $this->services['root'] = new \stdClass(${($_ = isset($this->services['level2']) ? $this->services['level2'] : $this->getLevel2Service()) && \false ?: '_'}, ${($_ = isset($this->services['multiuse1']) ? $this->services['multiuse1'] : ($this->services['multiuse1'] = new \stdClass())) && \false ?: '_'}); + return $this->services['root'] = new stdClass(${($_ = isset($this->services['level2']) ? $this->services['level2'] : $this->getLevel2Service()) && false ?: '_'}, ${($_ = isset($this->services['multiuse1']) ? $this->services['multiuse1'] : ($this->services['multiuse1'] = new stdClass())) && false ?: '_'}); } /** * Gets the public 'subscriber' shared service. * - * @return \stdClass + * @return stdClass */ protected function getSubscriberService() { - $a = ${($_ = isset($this->services['manager']) ? $this->services['manager'] : $this->getManagerService()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['manager']) ? $this->services['manager'] : $this->getManagerService()) && false ?: '_'}; if (isset($this->services['subscriber'])) { return $this->services['subscriber']; } - return $this->services['subscriber'] = new \stdClass($a); + return $this->services['subscriber'] = new stdClass($a); } /** * Gets the private 'bar6' shared service. * - * @return \stdClass + * @return stdClass */ protected function getBar6Service() { - $a = ${($_ = isset($this->services['foo6']) ? $this->services['foo6'] : $this->getFoo6Service()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['foo6']) ? $this->services['foo6'] : $this->getFoo6Service()) && false ?: '_'}; if (isset($this->services['bar6'])) { return $this->services['bar6']; } - return $this->services['bar6'] = new \stdClass($a); + return $this->services['bar6'] = new stdClass($a); } /** * Gets the private 'level2' shared service. @@ -291,40 +298,40 @@ protected function getBar6Service() */ protected function getLevel2Service() { - $this->services['level2'] = $instance = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls(); - $instance->call(${($_ = isset($this->services['level3']) ? $this->services['level3'] : $this->getLevel3Service()) && \false ?: '_'}); + $this->services['level2'] = $instance = new FooForCircularWithAddCalls(); + $instance->call(${($_ = isset($this->services['level3']) ? $this->services['level3'] : $this->getLevel3Service()) && false ?: '_'}); return $instance; } /** * Gets the private 'level3' shared service. * - * @return \stdClass + * @return stdClass */ protected function getLevel3Service() { - return $this->services['level3'] = new \stdClass(${($_ = isset($this->services['level4']) ? $this->services['level4'] : $this->getLevel4Service()) && \false ?: '_'}); + return $this->services['level3'] = new stdClass(${($_ = isset($this->services['level4']) ? $this->services['level4'] : $this->getLevel4Service()) && false ?: '_'}); } /** * Gets the private 'level4' shared service. * - * @return \stdClass + * @return stdClass */ protected function getLevel4Service() { - return $this->services['level4'] = new \stdClass(${($_ = isset($this->services['multiuse1']) ? $this->services['multiuse1'] : ($this->services['multiuse1'] = new \stdClass())) && \false ?: '_'}, ${($_ = isset($this->services['level5']) ? $this->services['level5'] : $this->getLevel5Service()) && \false ?: '_'}); + return $this->services['level4'] = new stdClass(${($_ = isset($this->services['multiuse1']) ? $this->services['multiuse1'] : ($this->services['multiuse1'] = new stdClass())) && false ?: '_'}, ${($_ = isset($this->services['level5']) ? $this->services['level5'] : $this->getLevel5Service()) && false ?: '_'}); } /** * Gets the private 'level5' shared service. * - * @return \stdClass + * @return stdClass */ protected function getLevel5Service() { - $a = ${($_ = isset($this->services['level6']) ? $this->services['level6'] : $this->getLevel6Service()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['level6']) ? $this->services['level6'] : $this->getLevel6Service()) && false ?: '_'}; if (isset($this->services['level5'])) { return $this->services['level5']; } - return $this->services['level5'] = new \stdClass($a); + return $this->services['level5'] = new stdClass($a); } /** * Gets the private 'level6' shared service. @@ -333,30 +340,30 @@ protected function getLevel5Service() */ protected function getLevel6Service() { - $this->services['level6'] = $instance = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls(); - $instance->call(${($_ = isset($this->services['level5']) ? $this->services['level5'] : $this->getLevel5Service()) && \false ?: '_'}); + $this->services['level6'] = $instance = new FooForCircularWithAddCalls(); + $instance->call(${($_ = isset($this->services['level5']) ? $this->services['level5'] : $this->getLevel5Service()) && false ?: '_'}); return $instance; } /** * Gets the private 'manager4' shared service. * - * @return \stdClass + * @return stdClass */ - protected function getManager4Service($lazyLoad = \true) + protected function getManager4Service($lazyLoad = true) { - $a = new \stdClass(); - $this->services['manager4'] = $instance = new \stdClass($a); - $a->listener = [0 => ${($_ = isset($this->services['listener4']) ? $this->services['listener4'] : $this->getListener4Service()) && \false ?: '_'}]; + $a = new stdClass(); + $this->services['manager4'] = $instance = new stdClass($a); + $a->listener = [0 => ${($_ = isset($this->services['listener4']) ? $this->services['listener4'] : $this->getListener4Service()) && false ?: '_'}]; return $instance; } /** * Gets the private 'multiuse1' shared service. * - * @return \stdClass + * @return stdClass */ protected function getMultiuse1Service() { - return $this->services['multiuse1'] = new \stdClass(); + return $this->services['multiuse1'] = new stdClass(); } } /** @@ -365,4 +372,4 @@ protected function getMultiuse1Service() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\Symfony_DI_PhpDumper_Test_Almost_Circular_Private', 'Symfony_DI_PhpDumper_Test_Almost_Circular_Private', \false); +class_alias('_PhpScoper5ea00cc67502b\\Symfony_DI_PhpDumper_Test_Almost_Circular_Private', 'Symfony_DI_PhpDumper_Test_Almost_Circular_Private', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_almost_circular_public.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_almost_circular_public.php index 2b6867779..9b92dc98d 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_almost_circular_public.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_almost_circular_public.php @@ -9,13 +9,20 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls; +use stdClass; +use function class_alias; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class Symfony_DI_PhpDumper_Test_Almost_Circular_Public extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class Symfony_DI_PhpDumper_Test_Almost_Circular_Public extends Container { private $parameters = []; private $targetDirs = []; @@ -23,25 +30,25 @@ public function __construct() { $this->services = []; $this->methodMap = ['bar' => 'getBarService', 'bar3' => 'getBar3Service', 'bar5' => 'getBar5Service', 'bar6' => 'getBar6Service', 'baz6' => 'getBaz6Service', 'connection' => 'getConnectionService', 'connection2' => 'getConnection2Service', 'connection3' => 'getConnection3Service', 'connection4' => 'getConnection4Service', 'dispatcher' => 'getDispatcherService', 'dispatcher2' => 'getDispatcher2Service', 'foo' => 'getFooService', 'foo2' => 'getFoo2Service', 'foo4' => 'getFoo4Service', 'foo5' => 'getFoo5Service', 'foo6' => 'getFoo6Service', 'foobar' => 'getFoobarService', 'foobar2' => 'getFoobar2Service', 'foobar3' => 'getFoobar3Service', 'foobar4' => 'getFoobar4Service', 'level2' => 'getLevel2Service', 'level3' => 'getLevel3Service', 'level4' => 'getLevel4Service', 'level5' => 'getLevel5Service', 'level6' => 'getLevel6Service', 'listener3' => 'getListener3Service', 'listener4' => 'getListener4Service', 'logger' => 'getLoggerService', 'manager' => 'getManagerService', 'manager2' => 'getManager2Service', 'manager3' => 'getManager3Service', 'manager4' => 'getManager4Service', 'multiuse1' => 'getMultiuse1Service', 'root' => 'getRootService', 'subscriber' => 'getSubscriberService']; - $this->privates = ['bar6' => \true, 'level2' => \true, 'level3' => \true, 'level4' => \true, 'level5' => \true, 'level6' => \true, 'manager4' => \true, 'multiuse1' => \true]; + $this->privates = ['bar6' => true, 'level2' => true, 'level3' => true, 'level4' => true, 'level5' => true, 'level6' => true, 'manager4' => true, 'multiuse1' => true]; $this->aliases = []; } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true, 'bar2' => \true, 'bar6' => \true, 'config' => \true, 'config2' => \true, 'level2' => \true, 'level3' => \true, 'level4' => \true, 'level5' => \true, 'level6' => \true, 'logger2' => \true, 'manager4' => \true, 'multiuse1' => \true, 'subscriber2' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'bar2' => true, 'bar6' => true, 'config' => true, 'config2' => true, 'level2' => true, 'level3' => true, 'level4' => true, 'level5' => true, 'level6' => true, 'logger2' => true, 'manager4' => true, 'multiuse1' => true, 'subscriber2' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } /** * Gets the public 'bar' shared service. @@ -50,8 +57,8 @@ public function isFrozen() */ protected function getBarService() { - $this->services['bar'] = $instance = new \_PhpScoper5ea00cc67502b\BarCircular(); - $instance->addFoobar(${($_ = isset($this->services['foobar']) ? $this->services['foobar'] : $this->getFoobarService()) && \false ?: '_'}); + $this->services['bar'] = $instance = new BarCircular(); + $instance->addFoobar(${($_ = isset($this->services['foobar']) ? $this->services['foobar'] : $this->getFoobarService()) && false ?: '_'}); return $instance; } /** @@ -61,113 +68,113 @@ protected function getBarService() */ protected function getBar3Service() { - $this->services['bar3'] = $instance = new \_PhpScoper5ea00cc67502b\BarCircular(); - $a = ${($_ = isset($this->services['foobar3']) ? $this->services['foobar3'] : ($this->services['foobar3'] = new \_PhpScoper5ea00cc67502b\FoobarCircular())) && \false ?: '_'}; + $this->services['bar3'] = $instance = new BarCircular(); + $a = ${($_ = isset($this->services['foobar3']) ? $this->services['foobar3'] : ($this->services['foobar3'] = new FoobarCircular())) && false ?: '_'}; $instance->addFoobar($a, $a); return $instance; } /** * Gets the public 'bar5' shared service. * - * @return \stdClass + * @return stdClass */ protected function getBar5Service() { - $a = ${($_ = isset($this->services['foo5']) ? $this->services['foo5'] : $this->getFoo5Service()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['foo5']) ? $this->services['foo5'] : $this->getFoo5Service()) && false ?: '_'}; if (isset($this->services['bar5'])) { return $this->services['bar5']; } - $this->services['bar5'] = $instance = new \stdClass($a); + $this->services['bar5'] = $instance = new stdClass($a); $instance->foo = $a; return $instance; } /** * Gets the public 'baz6' shared service. * - * @return \stdClass + * @return stdClass */ protected function getBaz6Service() { - $this->services['baz6'] = $instance = new \stdClass(); - $instance->bar6 = ${($_ = isset($this->services['bar6']) ? $this->services['bar6'] : $this->getBar6Service()) && \false ?: '_'}; + $this->services['baz6'] = $instance = new stdClass(); + $instance->bar6 = ${($_ = isset($this->services['bar6']) ? $this->services['bar6'] : $this->getBar6Service()) && false ?: '_'}; return $instance; } /** * Gets the public 'connection' shared service. * - * @return \stdClass + * @return stdClass */ protected function getConnectionService() { - $a = ${($_ = isset($this->services['dispatcher']) ? $this->services['dispatcher'] : $this->getDispatcherService()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['dispatcher']) ? $this->services['dispatcher'] : $this->getDispatcherService()) && false ?: '_'}; if (isset($this->services['connection'])) { return $this->services['connection']; } - $b = new \stdClass(); - $this->services['connection'] = $instance = new \stdClass($a, $b); - $b->logger = ${($_ = isset($this->services['logger']) ? $this->services['logger'] : $this->getLoggerService()) && \false ?: '_'}; + $b = new stdClass(); + $this->services['connection'] = $instance = new stdClass($a, $b); + $b->logger = ${($_ = isset($this->services['logger']) ? $this->services['logger'] : $this->getLoggerService()) && false ?: '_'}; return $instance; } /** * Gets the public 'connection2' shared service. * - * @return \stdClass + * @return stdClass */ protected function getConnection2Service() { - $a = ${($_ = isset($this->services['dispatcher2']) ? $this->services['dispatcher2'] : $this->getDispatcher2Service()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['dispatcher2']) ? $this->services['dispatcher2'] : $this->getDispatcher2Service()) && false ?: '_'}; if (isset($this->services['connection2'])) { return $this->services['connection2']; } - $b = new \stdClass(); - $this->services['connection2'] = $instance = new \stdClass($a, $b); - $c = new \stdClass($instance); - $c->handler2 = new \stdClass(${($_ = isset($this->services['manager2']) ? $this->services['manager2'] : $this->getManager2Service()) && \false ?: '_'}); + $b = new stdClass(); + $this->services['connection2'] = $instance = new stdClass($a, $b); + $c = new stdClass($instance); + $c->handler2 = new stdClass(${($_ = isset($this->services['manager2']) ? $this->services['manager2'] : $this->getManager2Service()) && false ?: '_'}); $b->logger2 = $c; return $instance; } /** * Gets the public 'connection3' shared service. * - * @return \stdClass + * @return stdClass */ protected function getConnection3Service() { - $this->services['connection3'] = $instance = new \stdClass(); - $instance->listener = [0 => ${($_ = isset($this->services['listener3']) ? $this->services['listener3'] : $this->getListener3Service()) && \false ?: '_'}]; + $this->services['connection3'] = $instance = new stdClass(); + $instance->listener = [0 => ${($_ = isset($this->services['listener3']) ? $this->services['listener3'] : $this->getListener3Service()) && false ?: '_'}]; return $instance; } /** * Gets the public 'connection4' shared service. * - * @return \stdClass + * @return stdClass */ protected function getConnection4Service() { - $this->services['connection4'] = $instance = new \stdClass(); - $instance->listener = [0 => ${($_ = isset($this->services['listener4']) ? $this->services['listener4'] : $this->getListener4Service()) && \false ?: '_'}]; + $this->services['connection4'] = $instance = new stdClass(); + $instance->listener = [0 => ${($_ = isset($this->services['listener4']) ? $this->services['listener4'] : $this->getListener4Service()) && false ?: '_'}]; return $instance; } /** * Gets the public 'dispatcher' shared service. * - * @return \stdClass + * @return stdClass */ - protected function getDispatcherService($lazyLoad = \true) + protected function getDispatcherService($lazyLoad = true) { - $this->services['dispatcher'] = $instance = new \stdClass(); - $instance->subscriber = ${($_ = isset($this->services['subscriber']) ? $this->services['subscriber'] : $this->getSubscriberService()) && \false ?: '_'}; + $this->services['dispatcher'] = $instance = new stdClass(); + $instance->subscriber = ${($_ = isset($this->services['subscriber']) ? $this->services['subscriber'] : $this->getSubscriberService()) && false ?: '_'}; return $instance; } /** * Gets the public 'dispatcher2' shared service. * - * @return \stdClass + * @return stdClass */ - protected function getDispatcher2Service($lazyLoad = \true) + protected function getDispatcher2Service($lazyLoad = true) { - $this->services['dispatcher2'] = $instance = new \stdClass(); - $instance->subscriber2 = new \stdClass(${($_ = isset($this->services['manager2']) ? $this->services['manager2'] : $this->getManager2Service()) && \false ?: '_'}); + $this->services['dispatcher2'] = $instance = new stdClass(); + $instance->subscriber2 = new stdClass(${($_ = isset($this->services['manager2']) ? $this->services['manager2'] : $this->getManager2Service()) && false ?: '_'}); return $instance; } /** @@ -177,11 +184,11 @@ protected function getDispatcher2Service($lazyLoad = \true) */ protected function getFooService() { - $a = ${($_ = isset($this->services['bar']) ? $this->services['bar'] : $this->getBarService()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['bar']) ? $this->services['bar'] : $this->getBarService()) && false ?: '_'}; if (isset($this->services['foo'])) { return $this->services['foo']; } - return $this->services['foo'] = new \_PhpScoper5ea00cc67502b\FooCircular($a); + return $this->services['foo'] = new FooCircular($a); } /** * Gets the public 'foo2' shared service. @@ -190,42 +197,42 @@ protected function getFooService() */ protected function getFoo2Service() { - $a = new \_PhpScoper5ea00cc67502b\BarCircular(); - $this->services['foo2'] = $instance = new \_PhpScoper5ea00cc67502b\FooCircular($a); - $a->addFoobar(${($_ = isset($this->services['foobar2']) ? $this->services['foobar2'] : $this->getFoobar2Service()) && \false ?: '_'}); + $a = new BarCircular(); + $this->services['foo2'] = $instance = new FooCircular($a); + $a->addFoobar(${($_ = isset($this->services['foobar2']) ? $this->services['foobar2'] : $this->getFoobar2Service()) && false ?: '_'}); return $instance; } /** * Gets the public 'foo4' service. * - * @return \stdClass + * @return stdClass */ protected function getFoo4Service() { - $instance = new \stdClass(); - $instance->foobar = ${($_ = isset($this->services['foobar4']) ? $this->services['foobar4'] : $this->getFoobar4Service()) && \false ?: '_'}; + $instance = new stdClass(); + $instance->foobar = ${($_ = isset($this->services['foobar4']) ? $this->services['foobar4'] : $this->getFoobar4Service()) && false ?: '_'}; return $instance; } /** * Gets the public 'foo5' shared service. * - * @return \stdClass + * @return stdClass */ protected function getFoo5Service() { - $this->services['foo5'] = $instance = new \stdClass(); - $instance->bar = ${($_ = isset($this->services['bar5']) ? $this->services['bar5'] : $this->getBar5Service()) && \false ?: '_'}; + $this->services['foo5'] = $instance = new stdClass(); + $instance->bar = ${($_ = isset($this->services['bar5']) ? $this->services['bar5'] : $this->getBar5Service()) && false ?: '_'}; return $instance; } /** * Gets the public 'foo6' shared service. * - * @return \stdClass + * @return stdClass */ protected function getFoo6Service() { - $this->services['foo6'] = $instance = new \stdClass(); - $instance->bar6 = ${($_ = isset($this->services['bar6']) ? $this->services['bar6'] : $this->getBar6Service()) && \false ?: '_'}; + $this->services['foo6'] = $instance = new stdClass(); + $instance->bar6 = ${($_ = isset($this->services['bar6']) ? $this->services['bar6'] : $this->getBar6Service()) && false ?: '_'}; return $instance; } /** @@ -235,11 +242,11 @@ protected function getFoo6Service() */ protected function getFoobarService() { - $a = ${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && false ?: '_'}; if (isset($this->services['foobar'])) { return $this->services['foobar']; } - return $this->services['foobar'] = new \_PhpScoper5ea00cc67502b\FoobarCircular($a); + return $this->services['foobar'] = new FoobarCircular($a); } /** * Gets the public 'foobar2' shared service. @@ -248,11 +255,11 @@ protected function getFoobarService() */ protected function getFoobar2Service() { - $a = ${($_ = isset($this->services['foo2']) ? $this->services['foo2'] : $this->getFoo2Service()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['foo2']) ? $this->services['foo2'] : $this->getFoo2Service()) && false ?: '_'}; if (isset($this->services['foobar2'])) { return $this->services['foobar2']; } - return $this->services['foobar2'] = new \_PhpScoper5ea00cc67502b\FoobarCircular($a); + return $this->services['foobar2'] = new FoobarCircular($a); } /** * Gets the public 'foobar3' shared service. @@ -261,132 +268,132 @@ protected function getFoobar2Service() */ protected function getFoobar3Service() { - return $this->services['foobar3'] = new \_PhpScoper5ea00cc67502b\FoobarCircular(); + return $this->services['foobar3'] = new FoobarCircular(); } /** * Gets the public 'foobar4' shared service. * - * @return \stdClass + * @return stdClass */ protected function getFoobar4Service() { - $a = new \stdClass(); - $this->services['foobar4'] = $instance = new \stdClass($a); + $a = new stdClass(); + $this->services['foobar4'] = $instance = new stdClass($a); $a->foobar = $instance; return $instance; } /** * Gets the public 'listener3' shared service. * - * @return \stdClass + * @return stdClass */ protected function getListener3Service() { - $this->services['listener3'] = $instance = new \stdClass(); - $instance->manager = ${($_ = isset($this->services['manager3']) ? $this->services['manager3'] : $this->getManager3Service()) && \false ?: '_'}; + $this->services['listener3'] = $instance = new stdClass(); + $instance->manager = ${($_ = isset($this->services['manager3']) ? $this->services['manager3'] : $this->getManager3Service()) && false ?: '_'}; return $instance; } /** * Gets the public 'listener4' shared service. * - * @return \stdClass + * @return stdClass */ protected function getListener4Service() { - $a = ${($_ = isset($this->services['manager4']) ? $this->services['manager4'] : $this->getManager4Service()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['manager4']) ? $this->services['manager4'] : $this->getManager4Service()) && false ?: '_'}; if (isset($this->services['listener4'])) { return $this->services['listener4']; } - return $this->services['listener4'] = new \stdClass($a); + return $this->services['listener4'] = new stdClass($a); } /** * Gets the public 'logger' shared service. * - * @return \stdClass + * @return stdClass */ protected function getLoggerService() { - $a = ${($_ = isset($this->services['connection']) ? $this->services['connection'] : $this->getConnectionService()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['connection']) ? $this->services['connection'] : $this->getConnectionService()) && false ?: '_'}; if (isset($this->services['logger'])) { return $this->services['logger']; } - $this->services['logger'] = $instance = new \stdClass($a); - $instance->handler = new \stdClass(${($_ = isset($this->services['manager']) ? $this->services['manager'] : $this->getManagerService()) && \false ?: '_'}); + $this->services['logger'] = $instance = new stdClass($a); + $instance->handler = new stdClass(${($_ = isset($this->services['manager']) ? $this->services['manager'] : $this->getManagerService()) && false ?: '_'}); return $instance; } /** * Gets the public 'manager' shared service. * - * @return \stdClass + * @return stdClass */ protected function getManagerService() { - $a = ${($_ = isset($this->services['connection']) ? $this->services['connection'] : $this->getConnectionService()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['connection']) ? $this->services['connection'] : $this->getConnectionService()) && false ?: '_'}; if (isset($this->services['manager'])) { return $this->services['manager']; } - return $this->services['manager'] = new \stdClass($a); + return $this->services['manager'] = new stdClass($a); } /** * Gets the public 'manager2' shared service. * - * @return \stdClass + * @return stdClass */ protected function getManager2Service() { - $a = ${($_ = isset($this->services['connection2']) ? $this->services['connection2'] : $this->getConnection2Service()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['connection2']) ? $this->services['connection2'] : $this->getConnection2Service()) && false ?: '_'}; if (isset($this->services['manager2'])) { return $this->services['manager2']; } - return $this->services['manager2'] = new \stdClass($a); + return $this->services['manager2'] = new stdClass($a); } /** * Gets the public 'manager3' shared service. * - * @return \stdClass + * @return stdClass */ - protected function getManager3Service($lazyLoad = \true) + protected function getManager3Service($lazyLoad = true) { - $a = ${($_ = isset($this->services['connection3']) ? $this->services['connection3'] : $this->getConnection3Service()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['connection3']) ? $this->services['connection3'] : $this->getConnection3Service()) && false ?: '_'}; if (isset($this->services['manager3'])) { return $this->services['manager3']; } - return $this->services['manager3'] = new \stdClass($a); + return $this->services['manager3'] = new stdClass($a); } /** * Gets the public 'root' shared service. * - * @return \stdClass + * @return stdClass */ protected function getRootService() { - return $this->services['root'] = new \stdClass(${($_ = isset($this->services['level2']) ? $this->services['level2'] : $this->getLevel2Service()) && \false ?: '_'}, ${($_ = isset($this->services['multiuse1']) ? $this->services['multiuse1'] : ($this->services['multiuse1'] = new \stdClass())) && \false ?: '_'}); + return $this->services['root'] = new stdClass(${($_ = isset($this->services['level2']) ? $this->services['level2'] : $this->getLevel2Service()) && false ?: '_'}, ${($_ = isset($this->services['multiuse1']) ? $this->services['multiuse1'] : ($this->services['multiuse1'] = new stdClass())) && false ?: '_'}); } /** * Gets the public 'subscriber' shared service. * - * @return \stdClass + * @return stdClass */ protected function getSubscriberService() { - $a = ${($_ = isset($this->services['manager']) ? $this->services['manager'] : $this->getManagerService()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['manager']) ? $this->services['manager'] : $this->getManagerService()) && false ?: '_'}; if (isset($this->services['subscriber'])) { return $this->services['subscriber']; } - return $this->services['subscriber'] = new \stdClass($a); + return $this->services['subscriber'] = new stdClass($a); } /** * Gets the private 'bar6' shared service. * - * @return \stdClass + * @return stdClass */ protected function getBar6Service() { - $a = ${($_ = isset($this->services['foo6']) ? $this->services['foo6'] : $this->getFoo6Service()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['foo6']) ? $this->services['foo6'] : $this->getFoo6Service()) && false ?: '_'}; if (isset($this->services['bar6'])) { return $this->services['bar6']; } - return $this->services['bar6'] = new \stdClass($a); + return $this->services['bar6'] = new stdClass($a); } /** * Gets the private 'level2' shared service. @@ -395,40 +402,40 @@ protected function getBar6Service() */ protected function getLevel2Service() { - $this->services['level2'] = $instance = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls(); - $instance->call(${($_ = isset($this->services['level3']) ? $this->services['level3'] : $this->getLevel3Service()) && \false ?: '_'}); + $this->services['level2'] = $instance = new FooForCircularWithAddCalls(); + $instance->call(${($_ = isset($this->services['level3']) ? $this->services['level3'] : $this->getLevel3Service()) && false ?: '_'}); return $instance; } /** * Gets the private 'level3' shared service. * - * @return \stdClass + * @return stdClass */ protected function getLevel3Service() { - return $this->services['level3'] = new \stdClass(${($_ = isset($this->services['level4']) ? $this->services['level4'] : $this->getLevel4Service()) && \false ?: '_'}); + return $this->services['level3'] = new stdClass(${($_ = isset($this->services['level4']) ? $this->services['level4'] : $this->getLevel4Service()) && false ?: '_'}); } /** * Gets the private 'level4' shared service. * - * @return \stdClass + * @return stdClass */ protected function getLevel4Service() { - return $this->services['level4'] = new \stdClass(${($_ = isset($this->services['multiuse1']) ? $this->services['multiuse1'] : ($this->services['multiuse1'] = new \stdClass())) && \false ?: '_'}, ${($_ = isset($this->services['level5']) ? $this->services['level5'] : $this->getLevel5Service()) && \false ?: '_'}); + return $this->services['level4'] = new stdClass(${($_ = isset($this->services['multiuse1']) ? $this->services['multiuse1'] : ($this->services['multiuse1'] = new stdClass())) && false ?: '_'}, ${($_ = isset($this->services['level5']) ? $this->services['level5'] : $this->getLevel5Service()) && false ?: '_'}); } /** * Gets the private 'level5' shared service. * - * @return \stdClass + * @return stdClass */ protected function getLevel5Service() { - $a = ${($_ = isset($this->services['level6']) ? $this->services['level6'] : $this->getLevel6Service()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['level6']) ? $this->services['level6'] : $this->getLevel6Service()) && false ?: '_'}; if (isset($this->services['level5'])) { return $this->services['level5']; } - return $this->services['level5'] = new \stdClass($a); + return $this->services['level5'] = new stdClass($a); } /** * Gets the private 'level6' shared service. @@ -437,31 +444,31 @@ protected function getLevel5Service() */ protected function getLevel6Service() { - $this->services['level6'] = $instance = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls(); - $instance->call(${($_ = isset($this->services['level5']) ? $this->services['level5'] : $this->getLevel5Service()) && \false ?: '_'}); + $this->services['level6'] = $instance = new FooForCircularWithAddCalls(); + $instance->call(${($_ = isset($this->services['level5']) ? $this->services['level5'] : $this->getLevel5Service()) && false ?: '_'}); return $instance; } /** * Gets the private 'manager4' shared service. * - * @return \stdClass + * @return stdClass */ - protected function getManager4Service($lazyLoad = \true) + protected function getManager4Service($lazyLoad = true) { - $a = ${($_ = isset($this->services['connection4']) ? $this->services['connection4'] : $this->getConnection4Service()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['connection4']) ? $this->services['connection4'] : $this->getConnection4Service()) && false ?: '_'}; if (isset($this->services['manager4'])) { return $this->services['manager4']; } - return $this->services['manager4'] = new \stdClass($a); + return $this->services['manager4'] = new stdClass($a); } /** * Gets the private 'multiuse1' shared service. * - * @return \stdClass + * @return stdClass */ protected function getMultiuse1Service() { - return $this->services['multiuse1'] = new \stdClass(); + return $this->services['multiuse1'] = new stdClass(); } } /** @@ -470,4 +477,4 @@ protected function getMultiuse1Service() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\Symfony_DI_PhpDumper_Test_Almost_Circular_Public', 'Symfony_DI_PhpDumper_Test_Almost_Circular_Public', \false); +class_alias('_PhpScoper5ea00cc67502b\\Symfony_DI_PhpDumper_Test_Almost_Circular_Public', 'Symfony_DI_PhpDumper_Test_Almost_Circular_Public', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_array_params.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_array_params.php index dec8f6c42..a88361c76 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_array_params.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_array_params.php @@ -9,13 +9,21 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use function array_key_exists; +use function class_alias; +use function dirname; +use function sprintf; +use function strtolower; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class ProjectServiceContainer extends Container { private $parameters = []; private $targetDirs = []; @@ -23,7 +31,7 @@ public function __construct() { $dir = __DIR__; for ($i = 1; $i <= 5; ++$i) { - $this->targetDirs[$i] = $dir = \dirname($dir); + $this->targetDirs[$i] = $dir = dirname($dir); } $this->parameters = $this->getDefaultParameters(); $this->services = []; @@ -32,20 +40,20 @@ public function __construct() } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } /** * Gets the public 'bar' shared service. @@ -54,17 +62,17 @@ public function isFrozen() */ protected function getBarService() { - $this->services['bar'] = $instance = new \_PhpScoper5ea00cc67502b\BarClass(); + $this->services['bar'] = $instance = new BarClass(); $instance->setBaz($this->parameters['array_1'], $this->getParameter('array_2'), '%array_1%', $this->parameters['array_1']); return $instance; } public function getParameter($name) { $name = (string) $name; - if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { $name = $this->normalizeParameterName($name); - if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The parameter "%s" must be defined.', $name)); + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { + throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); } } if (isset($this->loadedDynamicParameters[$name])) { @@ -76,11 +84,11 @@ public function hasParameter($name) { $name = (string) $name; $name = $this->normalizeParameterName($name); - return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters); + return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters); } public function setParameter($name, $value) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('Impossible to call set() on a frozen ParameterBag.'); + throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); } public function getParameterBag() { @@ -89,11 +97,11 @@ public function getParameterBag() foreach ($this->loadedDynamicParameters as $name => $loaded) { $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name); } - $this->parameterBag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag($parameters); + $this->parameterBag = new FrozenParameterBag($parameters); } return $this->parameterBag; } - private $loadedDynamicParameters = ['array_2' => \false]; + private $loadedDynamicParameters = ['array_2' => false]; private $dynamicParameters = []; /** * Computes a dynamic parameter. @@ -111,18 +119,18 @@ private function getDynamicParameter($name) $value = [0 => $this->targetDirs[2] . '/Dumper']; break; default: - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The dynamic parameter "%s" must be defined.', $name)); + throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } - $this->loadedDynamicParameters[$name] = \true; + $this->loadedDynamicParameters[$name] = true; return $this->dynamicParameters[$name] = $value; } private $normalizedParameterNames = []; private function normalizeParameterName($name) { - if (isset($this->normalizedParameterNames[$normalizedName = \strtolower($name)]) || isset($this->parameters[$normalizedName]) || \array_key_exists($normalizedName, $this->parameters)) { + if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) { $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName; if ((string) $name !== $normalizedName) { - @\trigger_error(\sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), \E_USER_DEPRECATED); + @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), E_USER_DEPRECATED); } } else { $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name; @@ -145,4 +153,4 @@ protected function getDefaultParameters() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', \false); +class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_base64_env.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_base64_env.php index 3b4e7540d..4cf238334 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_base64_env.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_base64_env.php @@ -9,13 +9,20 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use function array_key_exists; +use function class_alias; +use function sprintf; +use function strtolower; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class Symfony_DI_PhpDumper_Test_Base64Parameters extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class Symfony_DI_PhpDumper_Test_Base64Parameters extends Container { private $parameters = []; private $targetDirs = []; @@ -27,28 +34,28 @@ public function __construct() } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } public function getParameter($name) { $name = (string) $name; - if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { $name = $this->normalizeParameterName($name); - if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The parameter "%s" must be defined.', $name)); + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { + throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); } } if (isset($this->loadedDynamicParameters[$name])) { @@ -60,11 +67,11 @@ public function hasParameter($name) { $name = (string) $name; $name = $this->normalizeParameterName($name); - return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters); + return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters); } public function setParameter($name, $value) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('Impossible to call set() on a frozen ParameterBag.'); + throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); } public function getParameterBag() { @@ -73,11 +80,11 @@ public function getParameterBag() foreach ($this->loadedDynamicParameters as $name => $loaded) { $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name); } - $this->parameterBag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag($parameters); + $this->parameterBag = new FrozenParameterBag($parameters); } return $this->parameterBag; } - private $loadedDynamicParameters = ['hello' => \false]; + private $loadedDynamicParameters = ['hello' => false]; private $dynamicParameters = []; /** * Computes a dynamic parameter. @@ -95,18 +102,18 @@ private function getDynamicParameter($name) $value = $this->getEnv('base64:foo'); break; default: - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The dynamic parameter "%s" must be defined.', $name)); + throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } - $this->loadedDynamicParameters[$name] = \true; + $this->loadedDynamicParameters[$name] = true; return $this->dynamicParameters[$name] = $value; } private $normalizedParameterNames = []; private function normalizeParameterName($name) { - if (isset($this->normalizedParameterNames[$normalizedName = \strtolower($name)]) || isset($this->parameters[$normalizedName]) || \array_key_exists($normalizedName, $this->parameters)) { + if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) { $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName; if ((string) $name !== $normalizedName) { - @\trigger_error(\sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), \E_USER_DEPRECATED); + @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), E_USER_DEPRECATED); } } else { $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name; @@ -129,4 +136,4 @@ protected function getDefaultParameters() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\Symfony_DI_PhpDumper_Test_Base64Parameters', 'Symfony_DI_PhpDumper_Test_Base64Parameters', \false); +class_alias('_PhpScoper5ea00cc67502b\\Symfony_DI_PhpDumper_Test_Base64Parameters', 'Symfony_DI_PhpDumper_Test_Base64Parameters', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_dedup_lazy_proxy.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_dedup_lazy_proxy.php index e8e2dbfa5..e8c2104aa 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_dedup_lazy_proxy.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_dedup_lazy_proxy.php @@ -9,13 +9,20 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use Closure; +use stdClass; +use function class_alias; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class ProjectServiceContainer extends Container { private $parameters = []; private $targetDirs = []; @@ -27,44 +34,44 @@ public function __construct() } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } - protected function createProxy($class, \Closure $factory) + protected function createProxy($class, Closure $factory) { return $factory(); } /** * Gets the public 'bar' shared service. * - * @return \stdClass + * @return stdClass */ - protected function getBarService($lazyLoad = \true) + protected function getBarService($lazyLoad = true) { // lazy factory for stdClass - return new \stdClass(); + return new stdClass(); } /** * Gets the public 'foo' shared service. * - * @return \stdClass + * @return stdClass */ - protected function getFooService($lazyLoad = \true) + protected function getFooService($lazyLoad = true) { // lazy factory for stdClass - return new \stdClass(); + return new stdClass(); } } /** @@ -73,5 +80,5 @@ protected function getFooService($lazyLoad = \true) * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', \false); +class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', false); // proxy code for stdClass diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_deep_graph.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_deep_graph.php index cb0ab3e56..8053a9029 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_deep_graph.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_deep_graph.php @@ -9,13 +9,20 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Dumper\FooForDeepGraph; +use stdClass; +use function class_alias; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class Symfony_DI_PhpDumper_Test_Deep_Graph extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class Symfony_DI_PhpDumper_Test_Deep_Graph extends Container { private $parameters = []; private $targetDirs = []; @@ -27,30 +34,30 @@ public function __construct() } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } /** * Gets the public 'bar' shared service. * - * @return \stdClass + * @return stdClass */ protected function getBarService() { - $this->services['bar'] = $instance = new \stdClass(); - $instance->p5 = new \stdClass(${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && \false ?: '_'}); + $this->services['bar'] = $instance = new stdClass(); + $instance->p5 = new stdClass(${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && false ?: '_'}); return $instance; } /** @@ -60,15 +67,15 @@ protected function getBarService() */ protected function getFooService() { - $a = ${($_ = isset($this->services['bar']) ? $this->services['bar'] : $this->getBarService()) && \false ?: '_'}; + $a = ${($_ = isset($this->services['bar']) ? $this->services['bar'] : $this->getBarService()) && false ?: '_'}; if (isset($this->services['foo'])) { return $this->services['foo']; } - $b = new \stdClass(); - $c = new \stdClass(); - $c->p3 = new \stdClass(); + $b = new stdClass(); + $c = new stdClass(); + $c->p3 = new stdClass(); $b->p2 = $c; - return $this->services['foo'] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Dumper\FooForDeepGraph($a, $b); + return $this->services['foo'] = new FooForDeepGraph($a, $b); } } /** @@ -77,4 +84,4 @@ protected function getFooService() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\Symfony_DI_PhpDumper_Test_Deep_Graph', 'Symfony_DI_PhpDumper_Test_Deep_Graph', \false); +class_alias('_PhpScoper5ea00cc67502b\\Symfony_DI_PhpDumper_Test_Deep_Graph', 'Symfony_DI_PhpDumper_Test_Deep_Graph', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_env_in_id.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_env_in_id.php index 2d213ba24..4e157a53b 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_env_in_id.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_env_in_id.php @@ -9,13 +9,21 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use stdClass; +use function array_key_exists; +use function class_alias; +use function sprintf; +use function strtolower; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class ProjectServiceContainer extends Container { private $parameters = []; private $targetDirs = []; @@ -25,60 +33,60 @@ public function __construct() $this->services = []; $this->normalizedIds = ['bar_%env(bar)%' => 'bar_%env(BAR)%']; $this->methodMap = ['bar' => 'getBarService', 'bar_%env(BAR)%' => 'getBarenvBARService', 'foo' => 'getFooService']; - $this->privates = ['bar_%env(BAR)%' => \true]; + $this->privates = ['bar_%env(BAR)%' => true]; $this->aliases = []; } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true, 'bar_%env(BAR)%' => \true, 'baz_%env(BAR)%' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'bar_%env(BAR)%' => true, 'baz_%env(BAR)%' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } /** * Gets the public 'bar' shared service. * - * @return \stdClass + * @return stdClass */ protected function getBarService() { - return $this->services['bar'] = new \stdClass(${($_ = isset($this->services['bar_%env(BAR)%']) ? $this->services['bar_%env(BAR)%'] : ($this->services['bar_%env(BAR)%'] = new \stdClass())) && \false ?: '_'}); + return $this->services['bar'] = new stdClass(${($_ = isset($this->services['bar_%env(BAR)%']) ? $this->services['bar_%env(BAR)%'] : ($this->services['bar_%env(BAR)%'] = new stdClass())) && false ?: '_'}); } /** * Gets the public 'foo' shared service. * - * @return \stdClass + * @return stdClass */ protected function getFooService() { - return $this->services['foo'] = new \stdClass(${($_ = isset($this->services['bar_%env(BAR)%']) ? $this->services['bar_%env(BAR)%'] : ($this->services['bar_%env(BAR)%'] = new \stdClass())) && \false ?: '_'}, ['baz_' . $this->getEnv('string:BAR') => new \stdClass()]); + return $this->services['foo'] = new stdClass(${($_ = isset($this->services['bar_%env(BAR)%']) ? $this->services['bar_%env(BAR)%'] : ($this->services['bar_%env(BAR)%'] = new stdClass())) && false ?: '_'}, ['baz_' . $this->getEnv('string:BAR') => new stdClass()]); } /** * Gets the private 'bar_%env(BAR)%' shared service. * - * @return \stdClass + * @return stdClass */ protected function getBarenvBARService() { - return $this->services['bar_%env(BAR)%'] = new \stdClass(); + return $this->services['bar_%env(BAR)%'] = new stdClass(); } public function getParameter($name) { $name = (string) $name; - if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { $name = $this->normalizeParameterName($name); - if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The parameter "%s" must be defined.', $name)); + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { + throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); } } if (isset($this->loadedDynamicParameters[$name])) { @@ -90,11 +98,11 @@ public function hasParameter($name) { $name = (string) $name; $name = $this->normalizeParameterName($name); - return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters); + return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters); } public function setParameter($name, $value) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('Impossible to call set() on a frozen ParameterBag.'); + throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); } public function getParameterBag() { @@ -103,7 +111,7 @@ public function getParameterBag() foreach ($this->loadedDynamicParameters as $name => $loaded) { $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name); } - $this->parameterBag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag($parameters); + $this->parameterBag = new FrozenParameterBag($parameters); } return $this->parameterBag; } @@ -120,15 +128,15 @@ public function getParameterBag() */ private function getDynamicParameter($name) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The dynamic parameter "%s" must be defined.', $name)); + throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } private $normalizedParameterNames = ['env(bar)' => 'env(BAR)']; private function normalizeParameterName($name) { - if (isset($this->normalizedParameterNames[$normalizedName = \strtolower($name)]) || isset($this->parameters[$normalizedName]) || \array_key_exists($normalizedName, $this->parameters)) { + if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) { $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName; if ((string) $name !== $normalizedName) { - @\trigger_error(\sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), \E_USER_DEPRECATED); + @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), E_USER_DEPRECATED); } } else { $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name; @@ -151,4 +159,4 @@ protected function getDefaultParameters() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', \false); +class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_inline_requires.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_inline_requires.php index fba1411ad..28938a5fa 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_inline_requires.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_inline_requires.php @@ -9,13 +9,25 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C1; +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C2; +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3; +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\ParentNotExists; +use function array_key_exists; +use function class_alias; +use function dirname; +use function sprintf; +use function strtolower; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class ProjectServiceContainer extends Container { private $parameters = []; private $targetDirs = []; @@ -23,13 +35,13 @@ public function __construct() { $dir = __DIR__; for ($i = 1; $i <= 5; ++$i) { - $this->targetDirs[$i] = $dir = \dirname($dir); + $this->targetDirs[$i] = $dir = dirname($dir); } $this->parameters = $this->getDefaultParameters(); $this->services = []; $this->normalizedIds = ['_PhpScoper5ea00cc67502b\\symfony\\component\\dependencyinjection\\tests\\fixtures\\includes\\hotpath\\c1' => '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C1', '_PhpScoper5ea00cc67502b\\symfony\\component\\dependencyinjection\\tests\\fixtures\\includes\\hotpath\\c2' => '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C2', '_PhpScoper5ea00cc67502b\\symfony\\component\\dependencyinjection\\tests\\fixtures\\includes\\hotpath\\c3' => '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3', '_PhpScoper5ea00cc67502b\\symfony\\component\\dependencyinjection\\tests\\fixtures\\parentnotexists' => '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\ParentNotExists']; $this->methodMap = ['_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\ParentNotExists' => 'getParentNotExistsService', '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C1' => 'getC1Service', '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C2' => 'getC2Service', '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3' => 'getC3Service']; - $this->privates = ['_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3' => \true]; + $this->privates = ['_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3' => true]; $this->aliases = []; $this->privates['service_container'] = function () { include_once $this->targetDirs[1] . '/includes/HotPath/I1.php'; @@ -40,20 +52,20 @@ public function __construct() } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } /** * Gets the public 'Symfony\Component\DependencyInjection\Tests\Fixtures\ParentNotExists' shared service. @@ -62,7 +74,7 @@ public function isFrozen() */ protected function getParentNotExistsService() { - return $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\ParentNotExists'] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\ParentNotExists(); + return $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\ParentNotExists'] = new ParentNotExists(); } /** * Gets the public 'Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C1' shared service. @@ -71,7 +83,7 @@ protected function getParentNotExistsService() */ protected function getC1Service() { - return $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C1'] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C1(); + return $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C1'] = new C1(); } /** * Gets the public 'Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C2' shared service. @@ -82,7 +94,7 @@ protected function getC2Service() { include_once $this->targetDirs[1] . '/includes/HotPath/C2.php'; include_once $this->targetDirs[1] . '/includes/HotPath/C3.php'; - return $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C2'] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C2(${($_ = isset($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3']) ? $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3'] : ($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3'] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3())) && \false ?: '_'}); + return $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C2'] = new C2(${($_ = isset($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3']) ? $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3'] : ($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3'] = new C3())) && false ?: '_'}); } /** * Gets the private 'Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3' shared service. @@ -92,15 +104,15 @@ protected function getC2Service() protected function getC3Service() { include_once $this->targetDirs[1] . '/includes/HotPath/C3.php'; - return $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3'] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3(); + return $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3'] = new C3(); } public function getParameter($name) { $name = (string) $name; - if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { $name = $this->normalizeParameterName($name); - if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The parameter "%s" must be defined.', $name)); + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { + throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); } } if (isset($this->loadedDynamicParameters[$name])) { @@ -112,11 +124,11 @@ public function hasParameter($name) { $name = (string) $name; $name = $this->normalizeParameterName($name); - return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters); + return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters); } public function setParameter($name, $value) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('Impossible to call set() on a frozen ParameterBag.'); + throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); } public function getParameterBag() { @@ -125,7 +137,7 @@ public function getParameterBag() foreach ($this->loadedDynamicParameters as $name => $loaded) { $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name); } - $this->parameterBag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag($parameters); + $this->parameterBag = new FrozenParameterBag($parameters); } return $this->parameterBag; } @@ -142,15 +154,15 @@ public function getParameterBag() */ private function getDynamicParameter($name) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The dynamic parameter "%s" must be defined.', $name)); + throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } private $normalizedParameterNames = []; private function normalizeParameterName($name) { - if (isset($this->normalizedParameterNames[$normalizedName = \strtolower($name)]) || isset($this->parameters[$normalizedName]) || \array_key_exists($normalizedName, $this->parameters)) { + if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) { $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName; if ((string) $name !== $normalizedName) { - @\trigger_error(\sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), \E_USER_DEPRECATED); + @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), E_USER_DEPRECATED); } } else { $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name; @@ -164,7 +176,7 @@ private function normalizeParameterName($name) */ protected function getDefaultParameters() { - return ['inline_requires' => \true]; + return ['inline_requires' => true]; } } /** @@ -173,4 +185,4 @@ protected function getDefaultParameters() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', \false); +class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_inline_self_ref.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_inline_self_ref.php index 43617c670..ce65f651e 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_inline_self_ref.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_inline_self_ref.php @@ -2,6 +2,9 @@ namespace _PhpScoper5ea00cc67502b; +use _PhpScoper5ea00cc67502b\App\Bar; +use _PhpScoper5ea00cc67502b\App\Baz; +use _PhpScoper5ea00cc67502b\App\Foo; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container; @@ -9,13 +12,18 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use function class_alias; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class Symfony_DI_PhpDumper_Test_Inline_Self_Ref extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class Symfony_DI_PhpDumper_Test_Inline_Self_Ref extends Container { private $parameters = []; private $targetDirs = []; @@ -28,20 +36,20 @@ public function __construct() } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } /** * Gets the public 'App\Foo' shared service. @@ -50,10 +58,10 @@ public function isFrozen() */ protected function getFooService() { - $a = new \_PhpScoper5ea00cc67502b\App\Bar(); - $b = new \_PhpScoper5ea00cc67502b\App\Baz($a); + $a = new Bar(); + $b = new Baz($a); $b->bar = $a; - $this->services['App\\Foo'] = $instance = new \_PhpScoper5ea00cc67502b\App\Foo($b); + $this->services['App\\Foo'] = $instance = new Foo($b); $a->foo = $instance; return $instance; } @@ -64,4 +72,4 @@ protected function getFooService() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\Symfony_DI_PhpDumper_Test_Inline_Self_Ref', 'Symfony_DI_PhpDumper_Test_Inline_Self_Ref', \false); +class_alias('_PhpScoper5ea00cc67502b\\Symfony_DI_PhpDumper_Test_Inline_Self_Ref', 'Symfony_DI_PhpDumper_Test_Inline_Self_Ref', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_legacy_privates.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_legacy_privates.php index feaac7043..735087592 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_legacy_privates.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_legacy_privates.php @@ -9,13 +9,20 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use stdClass; +use function class_alias; +use function dirname; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class Symfony_DI_PhpDumper_Test_Legacy_Privates extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class Symfony_DI_PhpDumper_Test_Legacy_Privates extends Container { private $parameters = []; private $targetDirs = []; @@ -23,119 +30,119 @@ public function __construct() { $dir = __DIR__; for ($i = 1; $i <= 5; ++$i) { - $this->targetDirs[$i] = $dir = \dirname($dir); + $this->targetDirs[$i] = $dir = dirname($dir); } $this->services = []; $this->methodMap = ['bar' => 'getBarService', 'private' => 'getPrivateService', 'private_alias' => 'getPrivateAliasService', 'private_alias_decorator' => 'getPrivateAliasDecoratorService', 'private_child' => 'getPrivateChildService', 'private_decorator' => 'getPrivateDecoratorService', 'private_not_inlined' => 'getPrivateNotInlinedService', 'private_not_removed' => 'getPrivateNotRemovedService', 'private_parent' => 'getPrivateParentService', 'public_child' => 'getPublicChildService']; - $this->privates = ['decorated_private' => \true, 'decorated_private_alias' => \true, 'private' => \true, 'private_alias' => \true, 'private_child' => \true, 'private_not_inlined' => \true, 'private_not_removed' => \true, 'private_parent' => \true]; + $this->privates = ['decorated_private' => true, 'decorated_private_alias' => true, 'private' => true, 'private_alias' => true, 'private_child' => true, 'private_not_inlined' => true, 'private_not_removed' => true, 'private_parent' => true]; $this->aliases = ['alias_to_private' => 'private', 'decorated_private' => 'private_decorator', 'decorated_private_alias' => 'private_alias_decorator']; } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true, 'decorated_private' => \true, 'decorated_private_alias' => \true, 'foo' => \true, 'private' => \true, 'private_alias' => \true, 'private_alias_decorator.inner' => \true, 'private_child' => \true, 'private_decorator.inner' => \true, 'private_not_inlined' => \true, 'private_not_removed' => \true, 'private_parent' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'decorated_private' => true, 'decorated_private_alias' => true, 'foo' => true, 'private' => true, 'private_alias' => true, 'private_alias_decorator.inner' => true, 'private_child' => true, 'private_decorator.inner' => true, 'private_not_inlined' => true, 'private_not_removed' => true, 'private_parent' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } /** * Gets the public 'bar' shared service. * - * @return \stdClass + * @return stdClass */ protected function getBarService() { - return $this->services['bar'] = new \stdClass(${($_ = isset($this->services['private_not_inlined']) ? $this->services['private_not_inlined'] : ($this->services['private_not_inlined'] = new \stdClass())) && \false ?: '_'}); + return $this->services['bar'] = new stdClass(${($_ = isset($this->services['private_not_inlined']) ? $this->services['private_not_inlined'] : ($this->services['private_not_inlined'] = new stdClass())) && false ?: '_'}); } /** * Gets the public 'private_alias_decorator' shared service. * - * @return \stdClass + * @return stdClass */ protected function getPrivateAliasDecoratorService() { - return $this->services['private_alias_decorator'] = new \stdClass(); + return $this->services['private_alias_decorator'] = new stdClass(); } /** * Gets the public 'private_decorator' shared service. * - * @return \stdClass + * @return stdClass */ protected function getPrivateDecoratorService() { - return $this->services['private_decorator'] = new \stdClass(); + return $this->services['private_decorator'] = new stdClass(); } /** * Gets the public 'public_child' shared service. * - * @return \stdClass + * @return stdClass */ protected function getPublicChildService() { - return $this->services['public_child'] = new \stdClass(); + return $this->services['public_child'] = new stdClass(); } /** * Gets the private 'private' shared service. * - * @return \stdClass + * @return stdClass */ protected function getPrivateService() { - return $this->services['private'] = new \stdClass(); + return $this->services['private'] = new stdClass(); } /** * Gets the private 'private_alias' shared service. * - * @return \stdClass + * @return stdClass */ protected function getPrivateAliasService() { - return $this->services['private_alias'] = new \stdClass(); + return $this->services['private_alias'] = new stdClass(); } /** * Gets the private 'private_child' shared service. * - * @return \stdClass + * @return stdClass */ protected function getPrivateChildService() { - return $this->services['private_child'] = new \stdClass(); + return $this->services['private_child'] = new stdClass(); } /** * Gets the private 'private_not_inlined' shared service. * - * @return \stdClass + * @return stdClass */ protected function getPrivateNotInlinedService() { - return $this->services['private_not_inlined'] = new \stdClass(); + return $this->services['private_not_inlined'] = new stdClass(); } /** * Gets the private 'private_not_removed' shared service. * - * @return \stdClass + * @return stdClass */ protected function getPrivateNotRemovedService() { - return $this->services['private_not_removed'] = new \stdClass(); + return $this->services['private_not_removed'] = new stdClass(); } /** * Gets the private 'private_parent' shared service. * - * @return \stdClass + * @return stdClass */ protected function getPrivateParentService() { - return $this->services['private_parent'] = new \stdClass(); + return $this->services['private_parent'] = new stdClass(); } } /** @@ -144,4 +151,4 @@ protected function getPrivateParentService() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\Symfony_DI_PhpDumper_Test_Legacy_Privates', 'Symfony_DI_PhpDumper_Test_Legacy_Privates', \false); +class_alias('_PhpScoper5ea00cc67502b\\Symfony_DI_PhpDumper_Test_Legacy_Privates', 'Symfony_DI_PhpDumper_Test_Legacy_Privates', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_locator.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_locator.php index fa8ffa558..ae4513514 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_locator.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_locator.php @@ -9,13 +9,21 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator; +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator; +use stdClass; +use function class_alias; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class ProjectServiceContainer extends Container { private $parameters = []; private $targetDirs = []; @@ -23,34 +31,34 @@ public function __construct() { $this->services = []; $this->methodMap = ['bar_service' => 'getBarServiceService', 'baz_service' => 'getBazServiceService', 'foo_service' => 'getFooServiceService', 'translator.loader_1' => 'getTranslator_Loader1Service', 'translator.loader_2' => 'getTranslator_Loader2Service', 'translator.loader_3' => 'getTranslator_Loader3Service', 'translator_1' => 'getTranslator1Service', 'translator_2' => 'getTranslator2Service', 'translator_3' => 'getTranslator3Service']; - $this->privates = ['baz_service' => \true]; + $this->privates = ['baz_service' => true]; $this->aliases = []; } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true, 'baz_service' => \true, 'translator.loader_1_locator' => \true, 'translator.loader_2_locator' => \true, 'translator.loader_3_locator' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'baz_service' => true, 'translator.loader_1_locator' => true, 'translator.loader_2_locator' => true, 'translator.loader_3_locator' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } /** * Gets the public 'bar_service' shared service. * - * @return \stdClass + * @return stdClass */ protected function getBarServiceService() { - return $this->services['bar_service'] = new \stdClass(${($_ = isset($this->services['baz_service']) ? $this->services['baz_service'] : ($this->services['baz_service'] = new \stdClass())) && \false ?: '_'}); + return $this->services['bar_service'] = new stdClass(${($_ = isset($this->services['baz_service']) ? $this->services['baz_service'] : ($this->services['baz_service'] = new stdClass())) && false ?: '_'}); } /** * Gets the public 'foo_service' shared service. @@ -59,43 +67,43 @@ protected function getBarServiceService() */ protected function getFooServiceService() { - return $this->services['foo_service'] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator(['bar' => function () { - return ${($_ = isset($this->services['bar_service']) ? $this->services['bar_service'] : $this->getBarServiceService()) && \false ?: '_'}; + return $this->services['foo_service'] = new ServiceLocator(['bar' => function () { + return ${($_ = isset($this->services['bar_service']) ? $this->services['bar_service'] : $this->getBarServiceService()) && false ?: '_'}; }, 'baz' => function () { - $f = function (\stdClass $v) { + $f = function (stdClass $v) { return $v; }; - return $f(${($_ = isset($this->services['baz_service']) ? $this->services['baz_service'] : ($this->services['baz_service'] = new \stdClass())) && \false ?: '_'}); + return $f(${($_ = isset($this->services['baz_service']) ? $this->services['baz_service'] : ($this->services['baz_service'] = new stdClass())) && false ?: '_'}); }, 'nil' => function () { - return \NULL; + return NULL; }]); } /** * Gets the public 'translator.loader_1' shared service. * - * @return \stdClass + * @return stdClass */ protected function getTranslator_Loader1Service() { - return $this->services['translator.loader_1'] = new \stdClass(); + return $this->services['translator.loader_1'] = new stdClass(); } /** * Gets the public 'translator.loader_2' shared service. * - * @return \stdClass + * @return stdClass */ protected function getTranslator_Loader2Service() { - return $this->services['translator.loader_2'] = new \stdClass(); + return $this->services['translator.loader_2'] = new stdClass(); } /** * Gets the public 'translator.loader_3' shared service. * - * @return \stdClass + * @return stdClass */ protected function getTranslator_Loader3Service() { - return $this->services['translator.loader_3'] = new \stdClass(); + return $this->services['translator.loader_3'] = new stdClass(); } /** * Gets the public 'translator_1' shared service. @@ -104,8 +112,8 @@ protected function getTranslator_Loader3Service() */ protected function getTranslator1Service() { - return $this->services['translator_1'] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator(['translator.loader_1' => function () { - return ${($_ = isset($this->services['translator.loader_1']) ? $this->services['translator.loader_1'] : ($this->services['translator.loader_1'] = new \stdClass())) && \false ?: '_'}; + return $this->services['translator_1'] = new StubbedTranslator(new ServiceLocator(['translator.loader_1' => function () { + return ${($_ = isset($this->services['translator.loader_1']) ? $this->services['translator.loader_1'] : ($this->services['translator.loader_1'] = new stdClass())) && false ?: '_'}; }])); } /** @@ -115,10 +123,10 @@ protected function getTranslator1Service() */ protected function getTranslator2Service() { - $this->services['translator_2'] = $instance = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator(['translator.loader_2' => function () { - return ${($_ = isset($this->services['translator.loader_2']) ? $this->services['translator.loader_2'] : ($this->services['translator.loader_2'] = new \stdClass())) && \false ?: '_'}; + $this->services['translator_2'] = $instance = new StubbedTranslator(new ServiceLocator(['translator.loader_2' => function () { + return ${($_ = isset($this->services['translator.loader_2']) ? $this->services['translator.loader_2'] : ($this->services['translator.loader_2'] = new stdClass())) && false ?: '_'}; }])); - $instance->addResource('db', ${($_ = isset($this->services['translator.loader_2']) ? $this->services['translator.loader_2'] : ($this->services['translator.loader_2'] = new \stdClass())) && \false ?: '_'}, 'nl'); + $instance->addResource('db', ${($_ = isset($this->services['translator.loader_2']) ? $this->services['translator.loader_2'] : ($this->services['translator.loader_2'] = new stdClass())) && false ?: '_'}, 'nl'); return $instance; } /** @@ -128,10 +136,10 @@ protected function getTranslator2Service() */ protected function getTranslator3Service() { - $this->services['translator_3'] = $instance = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator(['translator.loader_3' => function () { - return ${($_ = isset($this->services['translator.loader_3']) ? $this->services['translator.loader_3'] : ($this->services['translator.loader_3'] = new \stdClass())) && \false ?: '_'}; + $this->services['translator_3'] = $instance = new StubbedTranslator(new ServiceLocator(['translator.loader_3' => function () { + return ${($_ = isset($this->services['translator.loader_3']) ? $this->services['translator.loader_3'] : ($this->services['translator.loader_3'] = new stdClass())) && false ?: '_'}; }])); - $a = ${($_ = isset($this->services['translator.loader_3']) ? $this->services['translator.loader_3'] : ($this->services['translator.loader_3'] = new \stdClass())) && \false ?: '_'}; + $a = ${($_ = isset($this->services['translator.loader_3']) ? $this->services['translator.loader_3'] : ($this->services['translator.loader_3'] = new stdClass())) && false ?: '_'}; $instance->addResource('db', $a, 'nl'); $instance->addResource('db', $a, 'en'); return $instance; @@ -139,11 +147,11 @@ protected function getTranslator3Service() /** * Gets the private 'baz_service' shared service. * - * @return \stdClass + * @return stdClass */ protected function getBazServiceService() { - return $this->services['baz_service'] = new \stdClass(); + return $this->services['baz_service'] = new stdClass(); } } /** @@ -152,4 +160,4 @@ protected function getBazServiceService() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', \false); +class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_non_shared_lazy.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_non_shared_lazy.php index 631760f65..7a53af148 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_non_shared_lazy.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_non_shared_lazy.php @@ -9,13 +9,20 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use Closure; +use stdClass; +use function class_alias; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class ProjectServiceContainer extends Container { private $parameters = []; private $targetDirs = []; @@ -23,48 +30,48 @@ public function __construct() { $this->services = []; $this->methodMap = ['bar' => 'getBarService', 'foo' => 'getFooService']; - $this->privates = ['bar' => \true, 'foo' => \true]; + $this->privates = ['bar' => true, 'foo' => true]; $this->aliases = []; } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true, 'bar' => \true, 'foo' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'bar' => true, 'foo' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } - protected function createProxy($class, \Closure $factory) + protected function createProxy($class, Closure $factory) { return $factory(); } /** * Gets the private 'bar' shared service. * - * @return \stdClass + * @return stdClass */ protected function getBarService() { - return $this->services['bar'] = new \stdClass(${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && \false ?: '_'}); + return $this->services['bar'] = new stdClass(${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && false ?: '_'}); } /** * Gets the private 'foo' service. * - * @return \stdClass + * @return stdClass */ - protected function getFooService($lazyLoad = \true) + protected function getFooService($lazyLoad = true) { // lazy factory for stdClass - return new \stdClass(); + return new stdClass(); } } /** @@ -73,5 +80,5 @@ protected function getFooService($lazyLoad = \true) * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', \false); +class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', false); // proxy code for stdClass diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_private_frozen.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_private_frozen.php index e89d8927c..6665560fd 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_private_frozen.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_private_frozen.php @@ -9,13 +9,19 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use stdClass; +use function class_alias; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class ProjectServiceContainer extends Container { private $parameters = []; private $targetDirs = []; @@ -23,52 +29,52 @@ public function __construct() { $this->services = []; $this->methodMap = ['bar_service' => 'getBarServiceService', 'baz_service' => 'getBazServiceService', 'foo_service' => 'getFooServiceService']; - $this->privates = ['baz_service' => \true]; + $this->privates = ['baz_service' => true]; $this->aliases = []; } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true, 'baz_service' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'baz_service' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } /** * Gets the public 'bar_service' shared service. * - * @return \stdClass + * @return stdClass */ protected function getBarServiceService() { - return $this->services['bar_service'] = new \stdClass(${($_ = isset($this->services['baz_service']) ? $this->services['baz_service'] : ($this->services['baz_service'] = new \stdClass())) && \false ?: '_'}); + return $this->services['bar_service'] = new stdClass(${($_ = isset($this->services['baz_service']) ? $this->services['baz_service'] : ($this->services['baz_service'] = new stdClass())) && false ?: '_'}); } /** * Gets the public 'foo_service' shared service. * - * @return \stdClass + * @return stdClass */ protected function getFooServiceService() { - return $this->services['foo_service'] = new \stdClass(${($_ = isset($this->services['baz_service']) ? $this->services['baz_service'] : ($this->services['baz_service'] = new \stdClass())) && \false ?: '_'}); + return $this->services['foo_service'] = new stdClass(${($_ = isset($this->services['baz_service']) ? $this->services['baz_service'] : ($this->services['baz_service'] = new stdClass())) && false ?: '_'}); } /** * Gets the private 'baz_service' shared service. * - * @return \stdClass + * @return stdClass */ protected function getBazServiceService() { - return $this->services['baz_service'] = new \stdClass(); + return $this->services['baz_service'] = new stdClass(); } } /** @@ -77,4 +83,4 @@ protected function getBazServiceService() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', \false); +class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_private_in_expression.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_private_in_expression.php index c315ec5f7..3e5602dc3 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_private_in_expression.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_private_in_expression.php @@ -9,13 +9,19 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use stdClass; +use function class_alias; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class ProjectServiceContainer extends Container { private $parameters = []; private $targetDirs = []; @@ -23,43 +29,43 @@ public function __construct() { $this->services = []; $this->methodMap = ['private_foo' => 'getPrivateFooService', 'public_foo' => 'getPublicFooService']; - $this->privates = ['private_foo' => \true]; + $this->privates = ['private_foo' => true]; $this->aliases = []; } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true, 'private_bar' => \true, 'private_foo' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'private_bar' => true, 'private_foo' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } /** * Gets the public 'public_foo' shared service. * - * @return \stdClass + * @return stdClass */ protected function getPublicFooService() { - return $this->services['public_foo'] = new \stdClass(${($_ = isset($this->services['private_foo']) ? $this->services['private_foo'] : ($this->services['private_foo'] = new \stdClass())) && \false ?: '_'}->bar); + return $this->services['public_foo'] = new stdClass(${($_ = isset($this->services['private_foo']) ? $this->services['private_foo'] : ($this->services['private_foo'] = new stdClass())) && false ?: '_'}->bar); } /** * Gets the private 'private_foo' shared service. * - * @return \stdClass + * @return stdClass */ protected function getPrivateFooService() { - return $this->services['private_foo'] = new \stdClass(); + return $this->services['private_foo'] = new stdClass(); } } /** @@ -68,4 +74,4 @@ protected function getPrivateFooService() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', \false); +class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_rot13_env.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_rot13_env.php index 6787993f6..45e9dc9a3 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_rot13_env.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_rot13_env.php @@ -9,13 +9,22 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator; +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor; +use function array_key_exists; +use function class_alias; +use function sprintf; +use function strtolower; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class Symfony_DI_PhpDumper_Test_Rot13Parameters extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class Symfony_DI_PhpDumper_Test_Rot13Parameters extends Container { private $parameters = []; private $targetDirs = []; @@ -29,20 +38,20 @@ public function __construct() } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } /** * Gets the public 'Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor' shared service. @@ -51,7 +60,7 @@ public function isFrozen() */ protected function getRot13EnvVarProcessorService() { - return $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Dumper\\Rot13EnvVarProcessor'] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor(); + return $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Dumper\\Rot13EnvVarProcessor'] = new Rot13EnvVarProcessor(); } /** * Gets the public 'container.env_var_processors_locator' shared service. @@ -60,17 +69,17 @@ protected function getRot13EnvVarProcessorService() */ protected function getContainer_EnvVarProcessorsLocatorService() { - return $this->services['container.env_var_processors_locator'] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator(['rot13' => function () { - return ${($_ = isset($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Dumper\\Rot13EnvVarProcessor']) ? $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Dumper\\Rot13EnvVarProcessor'] : ($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Dumper\\Rot13EnvVarProcessor'] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor())) && \false ?: '_'}; + return $this->services['container.env_var_processors_locator'] = new ServiceLocator(['rot13' => function () { + return ${($_ = isset($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Dumper\\Rot13EnvVarProcessor']) ? $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Dumper\\Rot13EnvVarProcessor'] : ($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Dumper\\Rot13EnvVarProcessor'] = new Rot13EnvVarProcessor())) && false ?: '_'}; }]); } public function getParameter($name) { $name = (string) $name; - if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { $name = $this->normalizeParameterName($name); - if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The parameter "%s" must be defined.', $name)); + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { + throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); } } if (isset($this->loadedDynamicParameters[$name])) { @@ -82,11 +91,11 @@ public function hasParameter($name) { $name = (string) $name; $name = $this->normalizeParameterName($name); - return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters); + return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters); } public function setParameter($name, $value) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('Impossible to call set() on a frozen ParameterBag.'); + throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); } public function getParameterBag() { @@ -95,11 +104,11 @@ public function getParameterBag() foreach ($this->loadedDynamicParameters as $name => $loaded) { $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name); } - $this->parameterBag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag($parameters); + $this->parameterBag = new FrozenParameterBag($parameters); } return $this->parameterBag; } - private $loadedDynamicParameters = ['hello' => \false]; + private $loadedDynamicParameters = ['hello' => false]; private $dynamicParameters = []; /** * Computes a dynamic parameter. @@ -117,18 +126,18 @@ private function getDynamicParameter($name) $value = $this->getEnv('rot13:foo'); break; default: - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The dynamic parameter "%s" must be defined.', $name)); + throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } - $this->loadedDynamicParameters[$name] = \true; + $this->loadedDynamicParameters[$name] = true; return $this->dynamicParameters[$name] = $value; } private $normalizedParameterNames = []; private function normalizeParameterName($name) { - if (isset($this->normalizedParameterNames[$normalizedName = \strtolower($name)]) || isset($this->parameters[$normalizedName]) || \array_key_exists($normalizedName, $this->parameters)) { + if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) { $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName; if ((string) $name !== $normalizedName) { - @\trigger_error(\sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), \E_USER_DEPRECATED); + @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), E_USER_DEPRECATED); } } else { $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name; @@ -151,4 +160,4 @@ protected function getDefaultParameters() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\Symfony_DI_PhpDumper_Test_Rot13Parameters', 'Symfony_DI_PhpDumper_Test_Rot13Parameters', \false); +class_alias('_PhpScoper5ea00cc67502b\\Symfony_DI_PhpDumper_Test_Rot13Parameters', 'Symfony_DI_PhpDumper_Test_Rot13Parameters', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_subscriber.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_subscriber.php index 9034ef6e8..3062903f0 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_subscriber.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_subscriber.php @@ -9,13 +9,21 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator; +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition; +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber; +use function class_alias; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class ProjectServiceContainer extends Container { private $parameters = []; private $targetDirs = []; @@ -24,25 +32,25 @@ public function __construct() $this->services = []; $this->normalizedIds = ['_PhpScoper5ea00cc67502b\\symfony\\component\\dependencyinjection\\tests\\fixtures\\customdefinition' => '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition', '_PhpScoper5ea00cc67502b\\symfony\\component\\dependencyinjection\\tests\\fixtures\\testservicesubscriber' => '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber']; $this->methodMap = ['_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => 'getCustomDefinitionService', '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber' => 'getTestServiceSubscriberService', 'foo_service' => 'getFooServiceService']; - $this->privates = ['_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => \true]; + $this->privates = ['_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => true]; $this->aliases = []; } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => \true, 'service_locator.jmktfsv' => \true, 'service_locator.jmktfsv.foo_service' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => true, 'service_locator.jmktfsv' => true, 'service_locator.jmktfsv.foo_service' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } /** * Gets the public 'Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber' shared service. @@ -51,7 +59,7 @@ public function isFrozen() */ protected function getTestServiceSubscriberService() { - return $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber'] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber(); + return $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber'] = new TestServiceSubscriber(); } /** * Gets the public 'foo_service' shared autowired service. @@ -60,26 +68,26 @@ protected function getTestServiceSubscriberService() */ protected function getFooServiceService() { - return $this->services['foo_service'] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber((new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator(['_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => function () { - $f = function (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition $v = null) { + return $this->services['foo_service'] = new TestServiceSubscriber((new ServiceLocator(['_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => function () { + $f = function (CustomDefinition $v = null) { return $v; }; - return $f(${($_ = isset($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition']) ? $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition'] : ($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition'] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition())) && \false ?: '_'}); + return $f(${($_ = isset($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition']) ? $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition'] : ($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition'] = new CustomDefinition())) && false ?: '_'}); }, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber' => function () { - $f = function (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber $v) { + $f = function (TestServiceSubscriber $v) { return $v; }; - return $f(${($_ = isset($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber']) ? $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber'] : ($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber'] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber())) && \false ?: '_'}); + return $f(${($_ = isset($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber']) ? $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber'] : ($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber'] = new TestServiceSubscriber())) && false ?: '_'}); }, 'bar' => function () { - $f = function (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition $v) { + $f = function (CustomDefinition $v) { return $v; }; - return $f(${($_ = isset($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber']) ? $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber'] : ($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber'] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber())) && \false ?: '_'}); + return $f(${($_ = isset($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber']) ? $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber'] : ($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber'] = new TestServiceSubscriber())) && false ?: '_'}); }, 'baz' => function () { - $f = function (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition $v = null) { + $f = function (CustomDefinition $v = null) { return $v; }; - return $f(${($_ = isset($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition']) ? $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition'] : ($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition'] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition())) && \false ?: '_'}); + return $f(${($_ = isset($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition']) ? $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition'] : ($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition'] = new CustomDefinition())) && false ?: '_'}); }]))->withContext('foo_service', $this)); } /** @@ -89,7 +97,7 @@ protected function getFooServiceService() */ protected function getCustomDefinitionService() { - return $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition'] = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition(); + return $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition'] = new CustomDefinition(); } } /** @@ -98,4 +106,4 @@ protected function getCustomDefinitionService() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', \false); +class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_tsantos.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_tsantos.php index ed4350bc4..d25489da0 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_tsantos.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_tsantos.php @@ -9,13 +9,28 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use _PhpScoper5ea00cc67502b\Symfony\Component\Stopwatch\Stopwatch; +use _PhpScoper5ea00cc67502b\TSantos\Serializer\Encoder\JsonEncoder; +use _PhpScoper5ea00cc67502b\TSantos\Serializer\EventDispatcher\EventDispatcher; +use _PhpScoper5ea00cc67502b\TSantos\Serializer\EventEmitterSerializer; +use _PhpScoper5ea00cc67502b\TSantos\Serializer\Normalizer\CollectionNormalizer; +use _PhpScoper5ea00cc67502b\TSantos\Serializer\Normalizer\JsonNormalizer; +use _PhpScoper5ea00cc67502b\TSantos\Serializer\Normalizer\ObjectNormalizer; +use _PhpScoper5ea00cc67502b\TSantos\Serializer\NormalizerRegistry; +use _PhpScoper5ea00cc67502b\TSantos\SerializerBundle\EventListener\StopwatchListener; +use _PhpScoper5ea00cc67502b\TSantos\SerializerBundle\Serializer\CircularReferenceHandler; +use function class_alias; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class ProjectServiceContainer extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class ProjectServiceContainer extends Container { private $parameters = []; private $targetDirs = []; @@ -28,20 +43,20 @@ public function __construct() } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } /** * Gets the public 'tsantos_serializer' shared service. @@ -50,15 +65,15 @@ public function isFrozen() */ protected function getTsantosSerializerService() { - $a = new \_PhpScoper5ea00cc67502b\TSantos\Serializer\NormalizerRegistry(); - $b = new \_PhpScoper5ea00cc67502b\TSantos\Serializer\Normalizer\CollectionNormalizer(); - $c = new \_PhpScoper5ea00cc67502b\TSantos\Serializer\EventDispatcher\EventDispatcher(); - $c->addSubscriber(new \_PhpScoper5ea00cc67502b\TSantos\SerializerBundle\EventListener\StopwatchListener(new \_PhpScoper5ea00cc67502b\Symfony\Component\Stopwatch\Stopwatch(\true))); - $this->services['tsantos_serializer'] = $instance = new \_PhpScoper5ea00cc67502b\TSantos\Serializer\EventEmitterSerializer(new \_PhpScoper5ea00cc67502b\TSantos\Serializer\Encoder\JsonEncoder(), $a, $c); + $a = new NormalizerRegistry(); + $b = new CollectionNormalizer(); + $c = new EventDispatcher(); + $c->addSubscriber(new StopwatchListener(new Stopwatch(true))); + $this->services['tsantos_serializer'] = $instance = new EventEmitterSerializer(new JsonEncoder(), $a, $c); $b->setSerializer($instance); - $d = new \_PhpScoper5ea00cc67502b\TSantos\Serializer\Normalizer\JsonNormalizer(); + $d = new JsonNormalizer(); $d->setSerializer($instance); - $a->add(new \_PhpScoper5ea00cc67502b\TSantos\Serializer\Normalizer\ObjectNormalizer(new \_PhpScoper5ea00cc67502b\TSantos\SerializerBundle\Serializer\CircularReferenceHandler())); + $a->add(new ObjectNormalizer(new CircularReferenceHandler())); $a->add($b); $a->add($d); return $instance; @@ -70,4 +85,4 @@ protected function getTsantosSerializerService() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', \false); +class_alias('_PhpScoper5ea00cc67502b\\ProjectServiceContainer', 'ProjectServiceContainer', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_uninitialized_ref.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_uninitialized_ref.php index 19e8d6f61..97918b74a 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_uninitialized_ref.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_uninitialized_ref.php @@ -9,13 +9,19 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use stdClass; +use function class_alias; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class Symfony_DI_PhpDumper_Test_Uninitialized_Reference extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class Symfony_DI_PhpDumper_Test_Uninitialized_Reference extends Container { private $parameters = []; private $targetDirs = []; @@ -23,87 +29,87 @@ public function __construct() { $this->services = []; $this->methodMap = ['bar' => 'getBarService', 'baz' => 'getBazService', 'foo1' => 'getFoo1Service', 'foo3' => 'getFoo3Service']; - $this->privates = ['foo3' => \true]; + $this->privates = ['foo3' => true]; $this->aliases = []; } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true, 'foo2' => \true, 'foo3' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'foo2' => true, 'foo3' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } /** * Gets the public 'bar' shared service. * - * @return \stdClass + * @return stdClass */ protected function getBarService() { - $this->services['bar'] = $instance = new \stdClass(); - $instance->foo1 = ${($_ = isset($this->services['foo1']) ? $this->services['foo1'] : null) && \false ?: '_'}; + $this->services['bar'] = $instance = new stdClass(); + $instance->foo1 = ${($_ = isset($this->services['foo1']) ? $this->services['foo1'] : null) && false ?: '_'}; $instance->foo2 = null; - $instance->foo3 = ${($_ = isset($this->services['foo3']) ? $this->services['foo3'] : null) && \false ?: '_'}; + $instance->foo3 = ${($_ = isset($this->services['foo3']) ? $this->services['foo3'] : null) && false ?: '_'}; $instance->closures = [0 => function () { - return ${($_ = isset($this->services['foo1']) ? $this->services['foo1'] : null) && \false ?: '_'}; + return ${($_ = isset($this->services['foo1']) ? $this->services['foo1'] : null) && false ?: '_'}; }, 1 => function () { return null; }, 2 => function () { - return ${($_ = isset($this->services['foo3']) ? $this->services['foo3'] : null) && \false ?: '_'}; + return ${($_ = isset($this->services['foo3']) ? $this->services['foo3'] : null) && false ?: '_'}; }]; - $instance->iter = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\RewindableGenerator(function () { + $instance->iter = new RewindableGenerator(function () { if (isset($this->services['foo1'])) { - (yield 'foo1' => ${($_ = isset($this->services['foo1']) ? $this->services['foo1'] : null) && \false ?: '_'}); + (yield 'foo1' => ${($_ = isset($this->services['foo1']) ? $this->services['foo1'] : null) && false ?: '_'}); } - if (\false) { + if (false) { (yield 'foo2' => null); } if (isset($this->services['foo3'])) { - (yield 'foo3' => ${($_ = isset($this->services['foo3']) ? $this->services['foo3'] : null) && \false ?: '_'}); + (yield 'foo3' => ${($_ = isset($this->services['foo3']) ? $this->services['foo3'] : null) && false ?: '_'}); } }, function () { - return 0 + (int) isset($this->services['foo1']) + (int) \false + (int) isset($this->services['foo3']); + return 0 + (int) isset($this->services['foo1']) + (int)false + (int) isset($this->services['foo3']); }); return $instance; } /** * Gets the public 'baz' shared service. * - * @return \stdClass + * @return stdClass */ protected function getBazService() { - $this->services['baz'] = $instance = new \stdClass(); - $instance->foo3 = ${($_ = isset($this->services['foo3']) ? $this->services['foo3'] : ($this->services['foo3'] = new \stdClass())) && \false ?: '_'}; + $this->services['baz'] = $instance = new stdClass(); + $instance->foo3 = ${($_ = isset($this->services['foo3']) ? $this->services['foo3'] : ($this->services['foo3'] = new stdClass())) && false ?: '_'}; return $instance; } /** * Gets the public 'foo1' shared service. * - * @return \stdClass + * @return stdClass */ protected function getFoo1Service() { - return $this->services['foo1'] = new \stdClass(); + return $this->services['foo1'] = new stdClass(); } /** * Gets the private 'foo3' shared service. * - * @return \stdClass + * @return stdClass */ protected function getFoo3Service() { - return $this->services['foo3'] = new \stdClass(); + return $this->services['foo3'] = new stdClass(); } } /** @@ -112,4 +118,4 @@ protected function getFoo3Service() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\Symfony_DI_PhpDumper_Test_Uninitialized_Reference', 'Symfony_DI_PhpDumper_Test_Uninitialized_Reference', \false); +class_alias('_PhpScoper5ea00cc67502b\\Symfony_DI_PhpDumper_Test_Uninitialized_Reference', 'Symfony_DI_PhpDumper_Test_Uninitialized_Reference', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_unsupported_characters.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_unsupported_characters.php index c8eef1298..695c2a979 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_unsupported_characters.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_unsupported_characters.php @@ -9,13 +9,21 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use FooClass; +use function array_key_exists; +use function class_alias; +use function sprintf; +use function strtolower; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final since Symfony 3.3 */ -class Symfony_DI_PhpDumper_Test_Unsupported_Characters extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container +class Symfony_DI_PhpDumper_Test_Unsupported_Characters extends Container { private $parameters = []; private $targetDirs = []; @@ -28,55 +36,55 @@ public function __construct() } public function getRemovedIds() { - return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => \true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => \true]; + return ['_PhpScoper5ea00cc67502b\\Psr\\Container\\ContainerInterface' => true, '_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface' => true]; } public function compile() { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('You cannot compile a dumped container that was already compiled.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled() { - return \true; + return true; } public function isFrozen() { - @\trigger_error(\sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); - return \true; + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } /** * Gets the public 'bar$' shared service. * - * @return \FooClass + * @return FooClass */ protected function getBarService() { - return $this->services['bar$'] = new \_PhpScoper5ea00cc67502b\FooClass(); + return $this->services['bar$'] = new FooClass(); } /** * Gets the public 'bar$!' shared service. * - * @return \FooClass + * @return FooClass */ protected function getBar2Service() { - return $this->services['bar$!'] = new \_PhpScoper5ea00cc67502b\FooClass(); + return $this->services['bar$!'] = new FooClass(); } /** * Gets the public 'foo oh-no' shared service. * - * @return \FooClass + * @return FooClass */ protected function getFooohnoService() { - return $this->services['foo*/oh-no'] = new \_PhpScoper5ea00cc67502b\FooClass(); + return $this->services['foo*/oh-no'] = new FooClass(); } public function getParameter($name) { $name = (string) $name; - if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { $name = $this->normalizeParameterName($name); - if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The parameter "%s" must be defined.', $name)); + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { + throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); } } if (isset($this->loadedDynamicParameters[$name])) { @@ -88,11 +96,11 @@ public function hasParameter($name) { $name = (string) $name; $name = $this->normalizeParameterName($name); - return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters); + return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters); } public function setParameter($name, $value) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\LogicException('Impossible to call set() on a frozen ParameterBag.'); + throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); } public function getParameterBag() { @@ -101,7 +109,7 @@ public function getParameterBag() foreach ($this->loadedDynamicParameters as $name => $loaded) { $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name); } - $this->parameterBag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag($parameters); + $this->parameterBag = new FrozenParameterBag($parameters); } return $this->parameterBag; } @@ -118,15 +126,15 @@ public function getParameterBag() */ private function getDynamicParameter($name) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('The dynamic parameter "%s" must be defined.', $name)); + throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } private $normalizedParameterNames = []; private function normalizeParameterName($name) { - if (isset($this->normalizedParameterNames[$normalizedName = \strtolower($name)]) || isset($this->parameters[$normalizedName]) || \array_key_exists($normalizedName, $this->parameters)) { + if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) { $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName; if ((string) $name !== $normalizedName) { - @\trigger_error(\sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), \E_USER_DEPRECATED); + @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), E_USER_DEPRECATED); } } else { $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name; @@ -149,4 +157,4 @@ protected function getDefaultParameters() * * @final since Symfony 3.3 */ -\class_alias('_PhpScoper5ea00cc67502b\\Symfony_DI_PhpDumper_Test_Unsupported_Characters', 'Symfony_DI_PhpDumper_Test_Unsupported_Characters', \false); +class_alias('_PhpScoper5ea00cc67502b\\Symfony_DI_PhpDumper_Test_Unsupported_Characters', 'Symfony_DI_PhpDumper_Test_Unsupported_Characters', false); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/xml/extension1/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/xml/extension1/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/xml/extension1/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/xml/extension2/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/xml/extension2/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/xml/extension2/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/xml/extensions/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/xml/extensions/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/xml/extensions/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/xml/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/xml/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/xml/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/bar/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/bar/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/bar/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/foo/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/foo/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/foo/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/autoconfigure_child_not_applied/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/autoconfigure_child_not_applied/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/autoconfigure_child_not_applied/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/autoconfigure_parent_child/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/autoconfigure_parent_child/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/autoconfigure_parent_child/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/autoconfigure_parent_child_tags/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/autoconfigure_parent_child_tags/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/autoconfigure_parent_child_tags/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/child_parent/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/child_parent/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/child_parent/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/defaults_child_tags/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/defaults_child_tags/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/defaults_child_tags/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/defaults_instanceof_importance/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/defaults_instanceof_importance/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/defaults_instanceof_importance/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/defaults_parent_child/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/defaults_parent_child/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/defaults_parent_child/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/instanceof_parent_child/index.php b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/instanceof_parent_child/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/integration/instanceof_parent_child/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/LazyProxy/Instantiator/RealServiceInstantiatorTest.php b/vendor/symfony/dependency-injection/Tests/LazyProxy/Instantiator/RealServiceInstantiatorTest.php index 89823c242..1d92cb995 100644 --- a/vendor/symfony/dependency-injection/Tests/LazyProxy/Instantiator/RealServiceInstantiatorTest.php +++ b/vendor/symfony/dependency-injection/Tests/LazyProxy/Instantiator/RealServiceInstantiatorTest.php @@ -13,21 +13,23 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\LazyProxy\Instantiator\RealServiceInstantiator; +use stdClass; + /** * Tests for {@see \Symfony\Component\DependencyInjection\LazyProxy\Instantiator\RealServiceInstantiator}. * * @author Marco Pivetta */ -class RealServiceInstantiatorTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class RealServiceInstantiatorTest extends TestCase { public function testInstantiateProxy() { - $instantiator = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\LazyProxy\Instantiator\RealServiceInstantiator(); - $instance = new \stdClass(); + $instantiator = new RealServiceInstantiator(); + $instance = new stdClass(); $container = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\ContainerInterface')->getMock(); $callback = function () use($instance) { return $instance; }; - $this->assertSame($instance, $instantiator->instantiateProxy($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(), 'foo', $callback)); + $this->assertSame($instance, $instantiator->instantiateProxy($container, new Definition(), 'foo', $callback)); } } diff --git a/vendor/symfony/dependency-injection/Tests/LazyProxy/Instantiator/index.php b/vendor/symfony/dependency-injection/Tests/LazyProxy/Instantiator/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/LazyProxy/Instantiator/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/LazyProxy/PhpDumper/NullDumperTest.php b/vendor/symfony/dependency-injection/Tests/LazyProxy/PhpDumper/NullDumperTest.php index debb1a85f..709dd2104 100644 --- a/vendor/symfony/dependency-injection/Tests/LazyProxy/PhpDumper/NullDumperTest.php +++ b/vendor/symfony/dependency-injection/Tests/LazyProxy/PhpDumper/NullDumperTest.php @@ -18,12 +18,12 @@ * * @author Marco Pivetta */ -class NullDumperTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class NullDumperTest extends TestCase { public function testNullDumper() { - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\NullDumper(); - $definition = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition('stdClass'); + $dumper = new NullDumper(); + $definition = new Definition('stdClass'); $this->assertFalse($dumper->isProxyCandidate($definition)); $this->assertSame('', $dumper->getProxyFactoryCode($definition, 'foo', '(false)')); $this->assertSame('', $dumper->getProxyCode($definition)); diff --git a/vendor/symfony/dependency-injection/Tests/LazyProxy/PhpDumper/index.php b/vendor/symfony/dependency-injection/Tests/LazyProxy/PhpDumper/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/LazyProxy/PhpDumper/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/LazyProxy/index.php b/vendor/symfony/dependency-injection/Tests/LazyProxy/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/LazyProxy/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/Loader/ClosureLoaderTest.php b/vendor/symfony/dependency-injection/Tests/Loader/ClosureLoaderTest.php index 6e3924c14..9f05a6727 100644 --- a/vendor/symfony/dependency-injection/Tests/Loader/ClosureLoaderTest.php +++ b/vendor/symfony/dependency-injection/Tests/Loader/ClosureLoaderTest.php @@ -13,18 +13,18 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\ClosureLoader; -class ClosureLoaderTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class ClosureLoaderTest extends TestCase { public function testSupports() { - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\ClosureLoader(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder()); + $loader = new ClosureLoader(new ContainerBuilder()); $this->assertTrue($loader->supports(function ($container) { }), '->supports() returns true if the resource is loadable'); $this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable'); } public function testLoad() { - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\ClosureLoader($container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder()); + $loader = new ClosureLoader($container = new ContainerBuilder()); $loader->load(function ($container) { $container->setParameter('foo', 'foo'); }); diff --git a/vendor/symfony/dependency-injection/Tests/Loader/DirectoryLoaderTest.php b/vendor/symfony/dependency-injection/Tests/Loader/DirectoryLoaderTest.php index f04da7e4f..9361907f9 100644 --- a/vendor/symfony/dependency-injection/Tests/Loader/DirectoryLoaderTest.php +++ b/vendor/symfony/dependency-injection/Tests/Loader/DirectoryLoaderTest.php @@ -18,21 +18,23 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\IniFileLoader; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\PhpFileLoader; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader; -class DirectoryLoaderTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use function realpath; + +class DirectoryLoaderTest extends TestCase { private static $fixturesPath; private $container; private $loader; public static function setUpBeforeClass() { - self::$fixturesPath = \realpath(__DIR__ . '/../Fixtures/'); + self::$fixturesPath = realpath(__DIR__ . '/../Fixtures/'); } protected function setUp() { - $locator = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath); - $this->container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $this->loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\DirectoryLoader($this->container, $locator); - $resolver = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\LoaderResolver([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\PhpFileLoader($this->container, $locator), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\IniFileLoader($this->container, $locator), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($this->container, $locator), $this->loader]); + $locator = new FileLocator(self::$fixturesPath); + $this->container = new ContainerBuilder(); + $this->loader = new DirectoryLoader($this->container, $locator); + $resolver = new LoaderResolver([new PhpFileLoader($this->container, $locator), new IniFileLoader($this->container, $locator), new YamlFileLoader($this->container, $locator), $this->loader]); $this->loader->setResolver($resolver); } public function testDirectoryCanBeLoadedRecursively() @@ -53,7 +55,7 @@ public function testExceptionIsRaisedWhenDirectoryDoesNotExist() } public function testSupports() { - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\DirectoryLoader(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator()); + $loader = new DirectoryLoader(new ContainerBuilder(), new FileLocator()); $this->assertTrue($loader->supports('directory/'), '->supports("directory/") returns true'); $this->assertTrue($loader->supports('directory/', 'directory'), '->supports("directory/", "directory") returns true'); $this->assertFalse($loader->supports('directory'), '->supports("directory") returns false'); diff --git a/vendor/symfony/dependency-injection/Tests/Loader/FileLoaderTest.php b/vendor/symfony/dependency-injection/Tests/Loader/FileLoaderTest.php index d853abc5e..9eb81d60f 100644 --- a/vendor/symfony/dependency-injection/Tests/Loader/FileLoaderTest.php +++ b/vendor/symfony/dependency-injection/Tests/Loader/FileLoaderTest.php @@ -31,106 +31,111 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Baz; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\Bar; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\BarInterface; -class FileLoaderTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use function array_keys; +use function realpath; +use function sprintf; +use const PHP_EOL; + +class FileLoaderTest extends TestCase { protected static $fixturesPath; public static function setUpBeforeClass() { - self::$fixturesPath = \realpath(__DIR__ . '/../'); + self::$fixturesPath = realpath(__DIR__ . '/../'); } public function testImportWithGlobPattern() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Loader\TestFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath)); - $resolver = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\LoaderResolver([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\IniFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/ini')), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\PhpFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/php')), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml'))]); + $container = new ContainerBuilder(); + $loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath)); + $resolver = new LoaderResolver([new IniFileLoader($container, new FileLocator(self::$fixturesPath . '/ini')), new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')), new PhpFileLoader($container, new FileLocator(self::$fixturesPath . '/php')), new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml'))]); $loader->setResolver($resolver); $loader->import('{F}ixtures/{xml,yaml}/services2.{yml,xml}'); $actual = $container->getParameterBag()->all(); - $expected = ['a string', 'foo' => 'bar', 'values' => [0, 'integer' => 4, 100 => null, 'true', \true, \false, 'on', 'off', 'float' => 1.3, 1000.3, 'a string', ['foo', 'bar']], 'mixedcase' => ['MixedCaseKey' => 'value'], 'constant' => \PHP_EOL, 'bar' => '%foo%', 'escape' => '@escapeme', 'foo_bar' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo_bar')]; - $this->assertEquals(\array_keys($expected), \array_keys($actual), '->load() imports and merges imported files'); + $expected = ['a string', 'foo' => 'bar', 'values' => [0, 'integer' => 4, 100 => null, 'true', true, false, 'on', 'off', 'float' => 1.3, 1000.3, 'a string', ['foo', 'bar']], 'mixedcase' => ['MixedCaseKey' => 'value'], 'constant' => PHP_EOL, 'bar' => '%foo%', 'escape' => '@escapeme', 'foo_bar' => new Reference('foo_bar')]; + $this->assertEquals(array_keys($expected), array_keys($actual), '->load() imports and merges imported files'); } public function testRegisterClasses() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->setParameter('sub_dir', 'Sub'); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Loader\TestFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/Fixtures')); - $loader->registerClasses(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(), 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Prototype\\Sub\\', 'Prototype/%sub_dir%/*'); - $this->assertEquals(['service_container', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\Bar::class], \array_keys($container->getDefinitions())); - $this->assertEquals([\_PhpScoper5ea00cc67502b\Psr\Container\ContainerInterface::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\BarInterface::class], \array_keys($container->getAliases())); + $loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath . '/Fixtures')); + $loader->registerClasses(new Definition(), 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Prototype\\Sub\\', 'Prototype/%sub_dir%/*'); + $this->assertEquals(['service_container', Bar::class], array_keys($container->getDefinitions())); + $this->assertEquals([PsrContainerInterface::class, ContainerInterface::class, BarInterface::class], array_keys($container->getAliases())); } public function testRegisterClassesWithExclude() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->setParameter('other_dir', 'OtherDir'); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Loader\TestFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/Fixtures')); + $loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath . '/Fixtures')); $loader->registerClasses( - new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(), + new Definition(), 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Prototype\\', 'Prototype/*', // load everything, except OtherDir/AnotherSub & Foo.php 'Prototype/{%other_dir%/AnotherSub,Foo.php}' ); - $this->assertTrue($container->has(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\Bar::class)); - $this->assertTrue($container->has(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Baz::class)); - $this->assertFalse($container->has(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo::class)); - $this->assertFalse($container->has(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\AnotherSub\DeeperBaz::class)); - $this->assertEquals([\_PhpScoper5ea00cc67502b\Psr\Container\ContainerInterface::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\BarInterface::class], \array_keys($container->getAliases())); - $loader->registerClasses(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(), 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Prototype\\', 'Prototype/*', 'Prototype/NotExistingDir'); + $this->assertTrue($container->has(Bar::class)); + $this->assertTrue($container->has(Baz::class)); + $this->assertFalse($container->has(Foo::class)); + $this->assertFalse($container->has(DeeperBaz::class)); + $this->assertEquals([PsrContainerInterface::class, ContainerInterface::class, BarInterface::class], array_keys($container->getAliases())); + $loader->registerClasses(new Definition(), 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Prototype\\', 'Prototype/*', 'Prototype/NotExistingDir'); } public function testNestedRegisterClasses() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Loader\TestFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/Fixtures')); - $prototype = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(); - $prototype->setPublic(\true)->setPrivate(\true); + $container = new ContainerBuilder(); + $loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath . '/Fixtures')); + $prototype = new Definition(); + $prototype->setPublic(true)->setPrivate(true); $loader->registerClasses($prototype, 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Prototype\\', 'Prototype/*'); - $this->assertTrue($container->has(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\Bar::class)); - $this->assertTrue($container->has(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Baz::class)); - $this->assertTrue($container->has(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo::class)); - $this->assertEquals([\_PhpScoper5ea00cc67502b\Psr\Container\ContainerInterface::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\FooInterface::class], \array_keys($container->getAliases())); - $alias = $container->getAlias(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\FooInterface::class); - $this->assertSame(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo::class, (string) $alias); + $this->assertTrue($container->has(Bar::class)); + $this->assertTrue($container->has(Baz::class)); + $this->assertTrue($container->has(Foo::class)); + $this->assertEquals([PsrContainerInterface::class, ContainerInterface::class, FooInterface::class], array_keys($container->getAliases())); + $alias = $container->getAlias(FooInterface::class); + $this->assertSame(Foo::class, (string) $alias); $this->assertFalse($alias->isPublic()); $this->assertFalse($alias->isPrivate()); } public function testMissingParentClass() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); + $container = new ContainerBuilder(); $container->setParameter('bad_classes_dir', 'BadClasses'); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Loader\TestFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/Fixtures')); - $loader->registerClasses((new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition())->setPublic(\false), 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Prototype\\BadClasses\\', 'Prototype/%bad_classes_dir%/*'); - $this->assertTrue($container->has(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\BadClasses\MissingParent::class)); - $this->assertRegExp('{Class "?Symfony\\\\Component\\\\DependencyInjection\\\\Tests\\\\Fixtures\\\\Prototype\\\\BadClasses\\\\MissingClass"? not found}', $container->getDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\BadClasses\MissingParent::class)->getErrors()[0]); + $loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath . '/Fixtures')); + $loader->registerClasses((new Definition())->setPublic(false), 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Prototype\\BadClasses\\', 'Prototype/%bad_classes_dir%/*'); + $this->assertTrue($container->has(MissingParent::class)); + $this->assertRegExp('{Class "?Symfony\\\\Component\\\\DependencyInjection\\\\Tests\\\\Fixtures\\\\Prototype\\\\BadClasses\\\\MissingClass"? not found}', $container->getDefinition(MissingParent::class)->getErrors()[0]); } public function testRegisterClassesWithBadPrefix() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessageRegExp('/Expected to find class "Symfony\\\\Component\\\\DependencyInjection\\\\Tests\\\\Fixtures\\\\Prototype\\\\Bar" in file ".+" while importing services from resource "Prototype\\/Sub\\/\\*", but it was not found\\! Check the namespace prefix used with the resource/'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Loader\TestFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/Fixtures')); + $container = new ContainerBuilder(); + $loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath . '/Fixtures')); // the Sub is missing from namespace prefix - $loader->registerClasses(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(), 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Prototype\\', 'Prototype/Sub/*'); + $loader->registerClasses(new Definition(), 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Prototype\\', 'Prototype/Sub/*'); } /** * @dataProvider getIncompatibleExcludeTests */ public function testRegisterClassesWithIncompatibleExclude($resourcePattern, $excludePattern) { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Loader\TestFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/Fixtures')); + $container = new ContainerBuilder(); + $loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath . '/Fixtures')); try { - $loader->registerClasses(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Definition(), 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Prototype\\', $resourcePattern, $excludePattern); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException $e) { - $this->assertEquals(\sprintf('Invalid "exclude" pattern when importing classes for "Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Prototype\\": make sure your "exclude" pattern (%s) is a subset of the "resource" pattern (%s).', $excludePattern, $resourcePattern), $e->getMessage()); + $loader->registerClasses(new Definition(), 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Prototype\\', $resourcePattern, $excludePattern); + } catch (InvalidArgumentException $e) { + $this->assertEquals(sprintf('Invalid "exclude" pattern when importing classes for "Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Prototype\\": make sure your "exclude" pattern (%s) is a subset of the "resource" pattern (%s).', $excludePattern, $resourcePattern), $e->getMessage()); } } public function getIncompatibleExcludeTests() { - (yield ['Prototype/*', 'yaml/*', \false]); - (yield ['Prototype/OtherDir/*', 'Prototype/*', \false]); + (yield ['Prototype/*', 'yaml/*', false]); + (yield ['Prototype/OtherDir/*', 'Prototype/*', false]); } } -class TestFileLoader extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\FileLoader +class TestFileLoader extends FileLoader { public function load($resource, $type = null) { @@ -138,6 +143,6 @@ public function load($resource, $type = null) } public function supports($resource, $type = null) { - return \false; + return false; } } diff --git a/vendor/symfony/dependency-injection/Tests/Loader/GlobFileLoaderTest.php b/vendor/symfony/dependency-injection/Tests/Loader/GlobFileLoaderTest.php index 4651e4007..dc6326aba 100644 --- a/vendor/symfony/dependency-injection/Tests/Loader/GlobFileLoaderTest.php +++ b/vendor/symfony/dependency-injection/Tests/Loader/GlobFileLoaderTest.php @@ -15,24 +15,24 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\GlobResource; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\GlobFileLoader; -class GlobFileLoaderTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class GlobFileLoaderTest extends TestCase { public function testSupports() { - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\GlobFileLoader(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator()); + $loader = new GlobFileLoader(new ContainerBuilder(), new FileLocator()); $this->assertTrue($loader->supports('any-path', 'glob'), '->supports() returns true if the resource has the glob type'); $this->assertFalse($loader->supports('any-path'), '->supports() returns false if the resource is not of glob type'); } public function testLoadAddsTheGlobResourceToTheContainer() { - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Loader\GlobFileLoaderWithoutImport($container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator()); + $loader = new GlobFileLoaderWithoutImport($container = new ContainerBuilder(), new FileLocator()); $loader->load(__DIR__ . '/../Fixtures/config/*'); - $this->assertEquals(new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\GlobResource(__DIR__ . '/../Fixtures/config', '/*', \false), $container->getResources()[1]); + $this->assertEquals(new GlobResource(__DIR__ . '/../Fixtures/config', '/*', false), $container->getResources()[1]); } } -class GlobFileLoaderWithoutImport extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\GlobFileLoader +class GlobFileLoaderWithoutImport extends GlobFileLoader { - public function import($resource, $type = null, $ignoreErrors = \false, $sourceResource = null) + public function import($resource, $type = null, $ignoreErrors = false, $sourceResource = null) { } } diff --git a/vendor/symfony/dependency-injection/Tests/Loader/IniFileLoaderTest.php b/vendor/symfony/dependency-injection/Tests/Loader/IniFileLoaderTest.php index c5627b4f1..5498ea904 100644 --- a/vendor/symfony/dependency-injection/Tests/Loader/IniFileLoaderTest.php +++ b/vendor/symfony/dependency-injection/Tests/Loader/IniFileLoaderTest.php @@ -14,14 +14,22 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\IniFileLoader; -class IniFileLoaderTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use function bindec; +use function defined; +use function parse_ini_file; +use function realpath; +use function sprintf; +use const INI_SCANNER_TYPED; +use const PHP_VERSION; + +class IniFileLoaderTest extends TestCase { protected $container; protected $loader; protected function setUp() { - $this->container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $this->loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\IniFileLoader($this->container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(\realpath(__DIR__ . '/../Fixtures/') . '/ini')); + $this->container = new ContainerBuilder(); + $this->loader = new IniFileLoader($this->container, new FileLocator(realpath(__DIR__ . '/../Fixtures/') . '/ini')); } public function testIniFileCanBeLoaded() { @@ -44,53 +52,53 @@ public function testTypeConversions($key, $value, $supported) */ public function testTypeConversionsWithNativePhp($key, $value, $supported) { - if (\defined('HHVM_VERSION_ID')) { + if (defined('HHVM_VERSION_ID')) { $this->markTestSkipped(); } if (!$supported) { - $this->markTestSkipped(\sprintf('Converting the value "%s" to "%s" is not supported by the IniFileLoader.', $key, $value)); + $this->markTestSkipped(sprintf('Converting the value "%s" to "%s" is not supported by the IniFileLoader.', $key, $value)); } - $expected = \parse_ini_file(__DIR__ . '/../Fixtures/ini/types.ini', \true, \INI_SCANNER_TYPED); + $expected = parse_ini_file(__DIR__ . '/../Fixtures/ini/types.ini', true, INI_SCANNER_TYPED); $this->assertSame($value, $expected['parameters'][$key], '->load() converts values to PHP types'); } public function getTypeConversions() { return [ - ['true_comment', \true, \true], - ['true', \true, \true], - ['false', \false, \true], - ['on', \true, \true], - ['off', \false, \true], - ['yes', \true, \true], - ['no', \false, \true], - ['none', \false, \true], - ['null', null, \true], - ['constant', \PHP_VERSION, \true], - ['12', 12, \true], - ['12_string', '12', \true], - ['12_quoted_number', 12, \false], + ['true_comment', true, true], + ['true', true, true], + ['false', false, true], + ['on', true, true], + ['off', false, true], + ['yes', true, true], + ['no', false, true], + ['none', false, true], + ['null', null, true], + ['constant', PHP_VERSION, true], + ['12', 12, true], + ['12_string', '12', true], + ['12_quoted_number', 12, false], // INI_SCANNER_RAW removes the double quotes - ['12_comment', 12, \true], - ['12_string_comment', '12', \true], - ['12_quoted_number_comment', 12, \false], + ['12_comment', 12, true], + ['12_string_comment', '12', true], + ['12_quoted_number_comment', 12, false], // INI_SCANNER_RAW removes the double quotes - ['-12', -12, \true], - ['1', 1, \true], - ['0', 0, \true], - ['0b0110', \bindec('0b0110'), \false], + ['-12', -12, true], + ['1', 1, true], + ['0', 0, true], + ['0b0110', bindec('0b0110'), false], // not supported by INI_SCANNER_TYPED - ['11112222333344445555', '1111,2222,3333,4444,5555', \true], - ['0777', 0777, \false], + ['11112222333344445555', '1111,2222,3333,4444,5555', true], + ['0777', 0777, false], // not supported by INI_SCANNER_TYPED - ['255', 0xff, \false], + ['255', 0xff, false], // not supported by INI_SCANNER_TYPED - ['100.0', 100.0, \false], + ['100.0', 100.0, false], // not supported by INI_SCANNER_TYPED - ['-120.0', -120.0, \false], + ['-120.0', -120.0, false], // not supported by INI_SCANNER_TYPED - ['-10100.1', -10100.1, \false], + ['-10100.1', -10100.1, false], // not supported by INI_SCANNER_TYPED - ['-10,100.1', '-10,100.1', \true], + ['-10,100.1', '-10,100.1', true], ]; } public function testExceptionIsRaisedWhenIniFileDoesNotExist() @@ -113,7 +121,7 @@ public function testExceptionIsRaisedWhenIniFileIsAlmostValid() } public function testSupports() { - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\IniFileLoader(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator()); + $loader = new IniFileLoader(new ContainerBuilder(), new FileLocator()); $this->assertTrue($loader->supports('foo.ini'), '->supports() returns true if the resource is loadable'); $this->assertFalse($loader->supports('foo.foo'), '->supports() returns false if the resource is not loadable'); $this->assertTrue($loader->supports('with_wrong_ext.yml', 'ini'), '->supports() returns true if the resource with forced type is loadable'); diff --git a/vendor/symfony/dependency-injection/Tests/Loader/LoaderResolverTest.php b/vendor/symfony/dependency-injection/Tests/Loader/LoaderResolverTest.php index bf97677e0..63db392e2 100644 --- a/vendor/symfony/dependency-injection/Tests/Loader/LoaderResolverTest.php +++ b/vendor/symfony/dependency-injection/Tests/Loader/LoaderResolverTest.php @@ -19,20 +19,22 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\PhpFileLoader; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader; -class LoaderResolverTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use function realpath; + +class LoaderResolverTest extends TestCase { private static $fixturesPath; /** @var LoaderResolver */ private $resolver; protected function setUp() { - self::$fixturesPath = \realpath(__DIR__ . '/../Fixtures/'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $this->resolver = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\LoaderResolver([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\IniFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/ini')), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\PhpFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/php')), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\ClosureLoader($container)]); + self::$fixturesPath = realpath(__DIR__ . '/../Fixtures/'); + $container = new ContainerBuilder(); + $this->resolver = new LoaderResolver([new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')), new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')), new IniFileLoader($container, new FileLocator(self::$fixturesPath . '/ini')), new PhpFileLoader($container, new FileLocator(self::$fixturesPath . '/php')), new ClosureLoader($container)]); } public function provideResourcesToLoad() { - return [['ini_with_wrong_ext.xml', 'ini', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\IniFileLoader::class], ['xml_with_wrong_ext.php', 'xml', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader::class], ['php_with_wrong_ext.yml', 'php', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\PhpFileLoader::class], ['yaml_with_wrong_ext.ini', 'yaml', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader::class]]; + return [['ini_with_wrong_ext.xml', 'ini', IniFileLoader::class], ['xml_with_wrong_ext.php', 'xml', XmlFileLoader::class], ['php_with_wrong_ext.yml', 'php', PhpFileLoader::class], ['yaml_with_wrong_ext.ini', 'yaml', YamlFileLoader::class]]; } /** * @dataProvider provideResourcesToLoad diff --git a/vendor/symfony/dependency-injection/Tests/Loader/PhpFileLoaderTest.php b/vendor/symfony/dependency-injection/Tests/Loader/PhpFileLoaderTest.php index 23e73983e..e92ef5e89 100644 --- a/vendor/symfony/dependency-injection/Tests/Loader/PhpFileLoaderTest.php +++ b/vendor/symfony/dependency-injection/Tests/Loader/PhpFileLoaderTest.php @@ -16,40 +16,45 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\YamlDumper; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\PhpFileLoader; -class PhpFileLoaderTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use function realpath; +use function str_replace; +use const DIRECTORY_SEPARATOR; +use const PHP_VERSION_ID; + +class PhpFileLoaderTest extends TestCase { public function testSupports() { - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\PhpFileLoader(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator()); + $loader = new PhpFileLoader(new ContainerBuilder(), new FileLocator()); $this->assertTrue($loader->supports('foo.php'), '->supports() returns true if the resource is loadable'); $this->assertFalse($loader->supports('foo.foo'), '->supports() returns false if the resource is not loadable'); $this->assertTrue($loader->supports('with_wrong_ext.yml', 'php'), '->supports() returns true if the resource with forced type is loadable'); } public function testLoad() { - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\PhpFileLoader($container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator()); + $loader = new PhpFileLoader($container = new ContainerBuilder(), new FileLocator()); $loader->load(__DIR__ . '/../Fixtures/php/simple.php'); $this->assertEquals('foo', $container->getParameter('foo'), '->load() loads a PHP file resource'); } public function testConfigServices() { - $fixtures = \realpath(__DIR__ . '/../Fixtures'); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\PhpFileLoader($container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator()); + $fixtures = realpath(__DIR__ . '/../Fixtures'); + $loader = new PhpFileLoader($container = new ContainerBuilder(), new FileLocator()); $loader->load($fixtures . '/config/services9.php'); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); - $this->assertStringEqualsFile($fixtures . '/php/services9_compiled.php', \str_replace(\str_replace('\\', '\\\\', $fixtures . \DIRECTORY_SEPARATOR . 'includes' . \DIRECTORY_SEPARATOR), '%path%', $dumper->dump())); + $dumper = new PhpDumper($container); + $this->assertStringEqualsFile($fixtures . '/php/services9_compiled.php', str_replace(str_replace('\\', '\\\\', $fixtures . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR), '%path%', $dumper->dump())); } /** * @dataProvider provideConfig */ public function testConfig($file) { - $fixtures = \realpath(__DIR__ . '/../Fixtures'); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\PhpFileLoader($container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator()); + $fixtures = realpath(__DIR__ . '/../Fixtures'); + $loader = new PhpFileLoader($container = new ContainerBuilder(), new FileLocator()); $loader->load($fixtures . '/config/' . $file . '.php'); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\YamlDumper($container); + $dumper = new YamlDumper($container); $this->assertStringEqualsFile($fixtures . '/config/' . $file . '.expected.yml', $dumper->dump()); } public function provideConfig() @@ -59,7 +64,7 @@ public function provideConfig() (yield ['instanceof']); (yield ['prototype']); (yield ['child']); - if (\PHP_VERSION_ID >= 70000) { + if (PHP_VERSION_ID >= 70000) { (yield ['php7']); } } @@ -67,9 +72,9 @@ public function testAutoConfigureAndChildDefinitionNotAllowed() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('The service "child_service" cannot have a "parent" and also have "autoconfigure". Try disabling autoconfiguration for the service.'); - $fixtures = \realpath(__DIR__ . '/../Fixtures'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\PhpFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator()); + $fixtures = realpath(__DIR__ . '/../Fixtures'); + $container = new ContainerBuilder(); + $loader = new PhpFileLoader($container, new FileLocator()); $loader->load($fixtures . '/config/services_autoconfigure_with_parent.php'); $container->compile(); } @@ -77,9 +82,9 @@ public function testFactoryShortNotationNotAllowed() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('Invalid factory "factory:method": the `service:method` notation is not available when using PHP-based DI configuration. Use "[ref(\'factory\'), \'method\']" instead.'); - $fixtures = \realpath(__DIR__ . '/../Fixtures'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\PhpFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator()); + $fixtures = realpath(__DIR__ . '/../Fixtures'); + $container = new ContainerBuilder(); + $loader = new PhpFileLoader($container, new FileLocator()); $loader->load($fixtures . '/config/factory_short_notation.php'); $container->compile(); } diff --git a/vendor/symfony/dependency-injection/Tests/Loader/XmlFileLoaderTest.php b/vendor/symfony/dependency-injection/Tests/Loader/XmlFileLoaderTest.php index 3a6aae5a9..a258205d8 100644 --- a/vendor/symfony/dependency-injection/Tests/Loader/XmlFileLoaderTest.php +++ b/vendor/symfony/dependency-injection/Tests/Loader/XmlFileLoaderTest.php @@ -11,6 +11,9 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Loader; use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; +use _PhpScoper5ea00cc67502b\ProjectExtension; +use _PhpScoper5ea00cc67502b\ProjectWithXsdExtension; +use _PhpScoper5ea00cc67502b\ProjectWithXsdExtensionInPhar; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\LoaderResolver; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\FileResource; @@ -28,51 +31,72 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype; +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression; -class XmlFileLoaderTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use DOMDocument; +use Exception; +use ReflectionObject; +use function array_keys; +use function array_map; +use function array_shift; +use function current; +use function defined; +use function dirname; +use function extension_loaded; +use function ini_get; +use function key; +use function libxml_disable_entity_loader; +use function realpath; +use function sort; +use function sprintf; +use function strpos; +use const DIRECTORY_SEPARATOR; +use const PHP_EOL; + +class XmlFileLoaderTest extends TestCase { protected static $fixturesPath; public static function setUpBeforeClass() { - self::$fixturesPath = \realpath(__DIR__ . '/../Fixtures/'); + self::$fixturesPath = realpath(__DIR__ . '/../Fixtures/'); require_once self::$fixturesPath . '/includes/foo.php'; require_once self::$fixturesPath . '/includes/ProjectExtension.php'; require_once self::$fixturesPath . '/includes/ProjectWithXsdExtension.php'; } public function testLoad() { - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/ini')); + $loader = new XmlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath . '/ini')); try { $loader->load('foo.xml'); $this->fail('->load() throws an InvalidArgumentException if the loaded file does not exist'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the loaded file does not exist'); $this->assertStringStartsWith('The file "foo.xml" does not exist (in:', $e->getMessage(), '->load() throws an InvalidArgumentException if the loaded file does not exist'); } } public function testParseFile() { - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/ini')); - $r = new \ReflectionObject($loader); + $loader = new XmlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath . '/ini')); + $r = new ReflectionObject($loader); $m = $r->getMethod('parseFileToDOM'); - $m->setAccessible(\true); + $m->setAccessible(true); try { $m->invoke($loader, self::$fixturesPath . '/ini/parameters.ini'); $this->fail('->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file'); - $this->assertRegExp(\sprintf('#^Unable to parse file ".+%s": .+.$#', 'parameters.ini'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file'); + $this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'parameters.ini'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file'); $e = $e->getPrevious(); $this->assertInstanceOf('InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file'); $this->assertStringStartsWith('[ERROR 4] Start tag expected, \'<\' not found (in', $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file'); } - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $loader = new XmlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath . '/xml')); try { $m->invoke($loader, self::$fixturesPath . '/xml/nonvalid.xml'); $this->fail('->parseFileToDOM() throws an InvalidArgumentException if the loaded file does not validate the XSD'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file does not validate the XSD'); - $this->assertRegExp(\sprintf('#^Unable to parse file ".+%s": .+.$#', 'nonvalid.xml'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file'); + $this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'nonvalid.xml'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file'); $e = $e->getPrevious(); $this->assertInstanceOf('InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file does not validate the XSD'); $this->assertStringStartsWith('[ERROR 1845] Element \'nonvalid\': No matching global declaration available for the validation root. (in', $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file does not validate the XSD'); @@ -82,39 +106,39 @@ public function testParseFile() } public function testLoadWithExternalEntitiesDisabled() { - $disableEntities = \libxml_disable_entity_loader(\true); - $containerBuilder = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($containerBuilder, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $disableEntities = libxml_disable_entity_loader(true); + $containerBuilder = new ContainerBuilder(); + $loader = new XmlFileLoader($containerBuilder, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('services2.xml'); - \libxml_disable_entity_loader($disableEntities); + libxml_disable_entity_loader($disableEntities); $this->assertGreaterThan(0, $containerBuilder->getParameterBag()->all(), 'Parameters can be read from the config file.'); } public function testLoadParameters() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('services2.xml'); $actual = $container->getParameterBag()->all(); - $expected = ['a string', 'foo' => 'bar', 'values' => [0, 'integer' => 4, 100 => null, 'true', \true, \false, 'on', 'off', 'float' => 1.3, 1000.3, 'a string', ['foo', 'bar']], 'mixedcase' => ['MixedCaseKey' => 'value'], 'constant' => \PHP_EOL]; + $expected = ['a string', 'foo' => 'bar', 'values' => [0, 'integer' => 4, 100 => null, 'true', true, false, 'on', 'off', 'float' => 1.3, 1000.3, 'a string', ['foo', 'bar']], 'mixedcase' => ['MixedCaseKey' => 'value'], 'constant' => PHP_EOL]; $this->assertEquals($expected, $actual, '->load() converts XML values to PHP ones'); } public function testLoadImports() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $resolver = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\LoaderResolver([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\IniFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/ini')), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yml')), $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml'))]); + $container = new ContainerBuilder(); + $resolver = new LoaderResolver([new IniFileLoader($container, new FileLocator(self::$fixturesPath . '/ini')), new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yml')), $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml'))]); $loader->setResolver($resolver); $loader->load('services4.xml'); $actual = $container->getParameterBag()->all(); - $expected = ['a string', 'foo' => 'bar', 'values' => [0, 'integer' => 4, 100 => null, 'true', \true, \false, 'on', 'off', 'float' => 1.3, 1000.3, 'a string', ['foo', 'bar']], 'mixedcase' => ['MixedCaseKey' => 'value'], 'constant' => \PHP_EOL, 'bar' => '%foo%', 'imported_from_ini' => \true, 'imported_from_yaml' => \true, 'with_wrong_ext' => 'from yaml']; - $this->assertEquals(\array_keys($expected), \array_keys($actual), '->load() imports and merges imported files'); + $expected = ['a string', 'foo' => 'bar', 'values' => [0, 'integer' => 4, 100 => null, 'true', true, false, 'on', 'off', 'float' => 1.3, 1000.3, 'a string', ['foo', 'bar']], 'mixedcase' => ['MixedCaseKey' => 'value'], 'constant' => PHP_EOL, 'bar' => '%foo%', 'imported_from_ini' => true, 'imported_from_yaml' => true, 'with_wrong_ext' => 'from yaml']; + $this->assertEquals(array_keys($expected), array_keys($actual), '->load() imports and merges imported files'); $this->assertTrue($actual['imported_from_ini']); // Bad import throws no exception due to ignore_errors value. $loader->load('services4_bad_import.xml'); } public function testLoadAnonymousServices() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('services5.xml'); $services = $container->getDefinitions(); $this->assertCount(7, $services, '->load() attributes unique ids to anonymous services'); @@ -163,23 +187,23 @@ public function testLoadAnonymousServices() */ public function testLoadAnonymousServicesWithoutId() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('services_without_id.xml'); } public function testLoadAnonymousNestedServices() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('nested_service_without_id.xml'); $this->assertTrue($container->hasDefinition('FooClass')); $arguments = $container->getDefinition('FooClass')->getArguments(); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference::class, \array_shift($arguments)); + $this->assertInstanceOf(Reference::class, array_shift($arguments)); } public function testLoadServices() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('services6.xml'); $services = $container->getDefinitions(); $this->assertArrayHasKey('foo', $services, '->load() parses elements'); @@ -187,14 +211,14 @@ public function testLoadServices() $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Definition', $services['foo'], '->load() converts element to Definition instances'); $this->assertEquals('FooClass', $services['foo']->getClass(), '->load() parses the class attribute'); $this->assertEquals('%path%/foo.php', $services['file']->getFile(), '->load() parses the file tag'); - $this->assertEquals(['foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo'), [\true, \false]], $services['arguments']->getArguments(), '->load() parses the argument tags'); + $this->assertEquals(['foo', new Reference('foo'), [true, false]], $services['arguments']->getArguments(), '->load() parses the argument tags'); $this->assertEquals('sc_configure', $services['configurator1']->getConfigurator(), '->load() parses the configurator tag'); - $this->assertEquals([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz'), 'configure'], $services['configurator2']->getConfigurator(), '->load() parses the configurator tag'); + $this->assertEquals([new Reference('baz'), 'configure'], $services['configurator2']->getConfigurator(), '->load() parses the configurator tag'); $this->assertEquals(['BazClass', 'configureStatic'], $services['configurator3']->getConfigurator(), '->load() parses the configurator tag'); - $this->assertEquals([['setBar', []], ['setBar', [new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')]]], $services['method_call1']->getMethodCalls(), '->load() parses the method_call tag'); - $this->assertEquals([['setBar', ['foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo'), [\true, \false]]]], $services['method_call2']->getMethodCalls(), '->load() parses the method_call tag'); + $this->assertEquals([['setBar', []], ['setBar', [new Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')]]], $services['method_call1']->getMethodCalls(), '->load() parses the method_call tag'); + $this->assertEquals([['setBar', ['foo', new Reference('foo'), [true, false]]]], $services['method_call2']->getMethodCalls(), '->load() parses the method_call tag'); $this->assertEquals('factory', $services['new_factory1']->getFactory(), '->load() parses the factory tag'); - $this->assertEquals([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz'), 'getClass'], $services['new_factory2']->getFactory(), '->load() parses the factory tag'); + $this->assertEquals([new Reference('baz'), 'getClass'], $services['new_factory2']->getFactory(), '->load() parses the factory tag'); $this->assertEquals(['BazClass', 'getInstance'], $services['new_factory3']->getFactory(), '->load() parses the factory tag'); $this->assertSame([null, 'getInstance'], $services['new_factory4']->getFactory(), '->load() accepts factory tag without class'); $aliases = $container->getAliases(); @@ -210,16 +234,16 @@ public function testLoadServices() } public function testParsesIteratorArgument() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('services9.xml'); $lazyDefinition = $container->getDefinition('lazy_context'); - $this->assertEquals([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument(['k1' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo.baz'), 'k2' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('service_container')]), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument([])], $lazyDefinition->getArguments(), '->load() parses lazy arguments'); + $this->assertEquals([new IteratorArgument(['k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container')]), new IteratorArgument([])], $lazyDefinition->getArguments(), '->load() parses lazy arguments'); } public function testParsesTags() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('services10.xml'); $services = $container->findTaggedServiceIds('foo_tag'); $this->assertCount(1, $services); @@ -237,22 +261,22 @@ public function testParsesTags() public function testParseTagsWithoutNameThrowsException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('tag_without_name.xml'); } public function testParseTagWithEmptyNameThrowsException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessageRegExp('/The tag name for service ".+" in .* must be a non-empty string/'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('tag_with_empty_name.xml'); } public function testDeprecated() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('services_deprecated.xml'); $this->assertTrue($container->getDefinition('foo')->isDeprecated()); $message = 'The "foo" service is deprecated. You should stop using it, as it will soon be removed.'; @@ -263,34 +287,34 @@ public function testDeprecated() } public function testConvertDomElementToArray() { - $doc = new \DOMDocument('1.0'); + $doc = new DOMDocument('1.0'); $doc->loadXML('bar'); - $this->assertEquals('bar', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \\DomElement to an array'); - $doc = new \DOMDocument('1.0'); + $this->assertEquals('bar', XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \\DomElement to an array'); + $doc = new DOMDocument('1.0'); $doc->loadXML(''); - $this->assertEquals(['foo' => 'bar'], \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \\DomElement to an array'); - $doc = new \DOMDocument('1.0'); + $this->assertEquals(['foo' => 'bar'], XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \\DomElement to an array'); + $doc = new DOMDocument('1.0'); $doc->loadXML('bar'); - $this->assertEquals(['foo' => 'bar'], \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \\DomElement to an array'); - $doc = new \DOMDocument('1.0'); + $this->assertEquals(['foo' => 'bar'], XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \\DomElement to an array'); + $doc = new DOMDocument('1.0'); $doc->loadXML('barbar'); - $this->assertEquals(['foo' => ['value' => 'bar', 'foo' => 'bar']], \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \\DomElement to an array'); - $doc = new \DOMDocument('1.0'); + $this->assertEquals(['foo' => ['value' => 'bar', 'foo' => 'bar']], XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \\DomElement to an array'); + $doc = new DOMDocument('1.0'); $doc->loadXML(''); - $this->assertEquals(['foo' => null], \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \\DomElement to an array'); - $doc = new \DOMDocument('1.0'); + $this->assertEquals(['foo' => null], XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \\DomElement to an array'); + $doc = new DOMDocument('1.0'); $doc->loadXML(''); - $this->assertEquals(['foo' => null], \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \\DomElement to an array'); - $doc = new \DOMDocument('1.0'); + $this->assertEquals(['foo' => null], XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \\DomElement to an array'); + $doc = new DOMDocument('1.0'); $doc->loadXML(''); - $this->assertEquals(['foo' => [['foo' => 'bar'], ['foo' => 'bar']]], \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \\DomElement to an array'); + $this->assertEquals(['foo' => [['foo' => 'bar'], ['foo' => 'bar']]], XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \\DomElement to an array'); } public function testExtensions() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->registerExtension(new \_PhpScoper5ea00cc67502b\ProjectExtension()); - $container->registerExtension(new \_PhpScoper5ea00cc67502b\ProjectWithXsdExtension()); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $container->registerExtension(new ProjectExtension()); + $container->registerExtension(new ProjectWithXsdExtension()); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); // extension without an XSD $loader->load('extensions/services1.xml'); $container->compile(); @@ -301,10 +325,10 @@ public function testExtensions() $this->assertEquals('BAR', $services['project.service.foo']->getClass(), '->load() parses extension elements'); $this->assertEquals('BAR', $parameters['project.parameter.foo'], '->load() parses extension elements'); // extension with an XSD - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->registerExtension(new \_PhpScoper5ea00cc67502b\ProjectExtension()); - $container->registerExtension(new \_PhpScoper5ea00cc67502b\ProjectWithXsdExtension()); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $container->registerExtension(new ProjectExtension()); + $container->registerExtension(new ProjectWithXsdExtension()); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('extensions/services2.xml'); $container->compile(); $services = $container->getDefinitions(); @@ -313,17 +337,17 @@ public function testExtensions() $this->assertArrayHasKey('project.parameter.bar', $parameters, '->load() parses extension elements'); $this->assertEquals('BAR', $services['project.service.foo']->getClass(), '->load() parses extension elements'); $this->assertEquals('BAR', $parameters['project.parameter.foo'], '->load() parses extension elements'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->registerExtension(new \_PhpScoper5ea00cc67502b\ProjectExtension()); - $container->registerExtension(new \_PhpScoper5ea00cc67502b\ProjectWithXsdExtension()); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $container->registerExtension(new ProjectExtension()); + $container->registerExtension(new ProjectWithXsdExtension()); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); // extension with an XSD (does not validate) try { $loader->load('extensions/services3.xml'); $this->fail('->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); - $this->assertRegExp(\sprintf('#^Unable to parse file ".+%s": .+.$#', 'services3.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); + $this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'services3.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); $e = $e->getPrevious(); $this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); $this->assertStringContainsString('The attribute \'bar\' is not allowed', $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); @@ -332,32 +356,32 @@ public function testExtensions() try { $loader->load('extensions/services4.xml'); $this->fail('->load() throws an InvalidArgumentException if the tag is not valid'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertInstanceOf('\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the tag is not valid'); $this->assertStringStartsWith('There is no extension able to load the configuration for "project:bar" (in', $e->getMessage(), '->load() throws an InvalidArgumentException if the tag is not valid'); } } public function testExtensionInPhar() { - if (\extension_loaded('suhosin') && \false === \strpos(\ini_get('suhosin.executor.include.whitelist'), 'phar')) { + if (extension_loaded('suhosin') && false === strpos(ini_get('suhosin.executor.include.whitelist'), 'phar')) { $this->markTestSkipped('To run this test, add "phar" to the "suhosin.executor.include.whitelist" settings in your php.ini file.'); } - if (\defined('HHVM_VERSION')) { + if (defined('HHVM_VERSION')) { $this->markTestSkipped('HHVM makes this test conflict with those run in separate processes.'); } require_once self::$fixturesPath . '/includes/ProjectWithXsdExtensionInPhar.phar'; // extension with an XSD in PHAR archive - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->registerExtension(new \_PhpScoper5ea00cc67502b\ProjectWithXsdExtensionInPhar()); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $container->registerExtension(new ProjectWithXsdExtensionInPhar()); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('extensions/services6.xml'); // extension with an XSD in PHAR archive (does not validate) try { $loader->load('extensions/services7.xml'); $this->fail('->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); - $this->assertRegExp(\sprintf('#^Unable to parse file ".+%s": .+.$#', 'services7.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); + $this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'services7.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); $e = $e->getPrevious(); $this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); $this->assertStringContainsString('The attribute \'bar\' is not allowed', $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); @@ -365,19 +389,19 @@ public function testExtensionInPhar() } public function testSupports() { - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator()); + $loader = new XmlFileLoader(new ContainerBuilder(), new FileLocator()); $this->assertTrue($loader->supports('foo.xml'), '->supports() returns true if the resource is loadable'); $this->assertFalse($loader->supports('foo.foo'), '->supports() returns false if the resource is not loadable'); $this->assertTrue($loader->supports('with_wrong_ext.yml', 'xml'), '->supports() returns true if the resource with forced type is loadable'); } public function testNoNamingConflictsForAnonymousServices() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader1 = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml/extension1')); + $container = new ContainerBuilder(); + $loader1 = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml/extension1')); $loader1->load('services.xml'); $services = $container->getDefinitions(); $this->assertCount(3, $services, '->load() attributes unique ids to anonymous services'); - $loader2 = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml/extension2')); + $loader2 = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml/extension2')); $loader2->load('services.xml'); $services = $container->getDefinitions(); $this->assertCount(5, $services, '->load() attributes unique ids to anonymous services'); @@ -391,15 +415,15 @@ public function testNoNamingConflictsForAnonymousServices() } public function testDocTypeIsNotAllowed() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); // document types are not allowed. try { $loader->load('withdoctype.xml'); $this->fail('->load() throws an InvalidArgumentException if the configuration contains a document type'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration contains a document type'); - $this->assertRegExp(\sprintf('#^Unable to parse file ".+%s": .+.$#', 'withdoctype.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration contains a document type'); + $this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'withdoctype.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration contains a document type'); $e = $e->getPrevious(); $this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration contains a document type'); $this->assertSame('Document types are not allowed.', $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration contains a document type'); @@ -407,8 +431,8 @@ public function testDocTypeIsNotAllowed() } public function testXmlNamespaces() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('namespaces.xml'); $services = $container->getDefinitions(); $this->assertArrayHasKey('foo', $services, '->load() parses elements'); @@ -417,36 +441,36 @@ public function testXmlNamespaces() } public function testLoadIndexedArguments() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('services14.xml'); $this->assertEquals(['index_0' => 'app'], $container->findDefinition('logger')->getArguments()); } public function testLoadInlinedServices() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('services21.xml'); $foo = $container->getDefinition('foo'); $fooFactory = $foo->getFactory(); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference::class, $fooFactory[0]); + $this->assertInstanceOf(Reference::class, $fooFactory[0]); $this->assertTrue($container->has((string) $fooFactory[0])); $fooFactoryDefinition = $container->getDefinition((string) $fooFactory[0]); $this->assertSame('FooFactory', $fooFactoryDefinition->getClass()); $this->assertSame('createFoo', $fooFactory[1]); $fooFactoryFactory = $fooFactoryDefinition->getFactory(); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference::class, $fooFactoryFactory[0]); + $this->assertInstanceOf(Reference::class, $fooFactoryFactory[0]); $this->assertTrue($container->has((string) $fooFactoryFactory[0])); $this->assertSame('Foobar', $container->getDefinition((string) $fooFactoryFactory[0])->getClass()); $this->assertSame('createFooFactory', $fooFactoryFactory[1]); $fooConfigurator = $foo->getConfigurator(); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference::class, $fooConfigurator[0]); + $this->assertInstanceOf(Reference::class, $fooConfigurator[0]); $this->assertTrue($container->has((string) $fooConfigurator[0])); $fooConfiguratorDefinition = $container->getDefinition((string) $fooConfigurator[0]); $this->assertSame('Bar', $fooConfiguratorDefinition->getClass()); $this->assertSame('configureFoo', $fooConfigurator[1]); $barConfigurator = $fooConfiguratorDefinition->getConfigurator(); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference::class, $barConfigurator[0]); + $this->assertInstanceOf(Reference::class, $barConfigurator[0]); $this->assertSame('Baz', $container->getDefinition((string) $barConfigurator[0])->getClass()); $this->assertSame('configureBar', $barConfigurator[1]); } @@ -455,39 +479,39 @@ public function testLoadInlinedServices() */ public function testType() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('services22.xml'); $this->assertEquals(['Bar', 'Baz'], $container->getDefinition('foo')->getAutowiringTypes()); } public function testAutowire() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('services23.xml'); $this->assertTrue($container->getDefinition('bar')->isAutowired()); } public function testClassFromId() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('class_from_id.xml'); $container->compile(); - $this->assertEquals(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass::class, $container->getDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass::class)->getClass()); + $this->assertEquals(CaseSensitiveClass::class, $container->getDefinition(CaseSensitiveClass::class)->getClass()); } public function testPrototype() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('services_prototype.xml'); - $ids = \array_keys($container->getDefinitions()); - \sort($ids); - $this->assertSame([\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\Bar::class, 'service_container'], $ids); + $ids = array_keys($container->getDefinitions()); + sort($ids); + $this->assertSame([Foo::class, Prototype\Sub\Bar::class, 'service_container'], $ids); $resources = $container->getResources(); - $fixturesDir = \dirname(__DIR__) . \DIRECTORY_SEPARATOR . 'Fixtures' . \DIRECTORY_SEPARATOR; - $resources = \array_map('strval', $resources); - $this->assertContains((string) new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\FileResource($fixturesDir . 'xml' . \DIRECTORY_SEPARATOR . 'services_prototype.xml'), $resources); - $this->assertContains((string) new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\GlobResource($fixturesDir . 'Prototype', '/*', \true), $resources); + $fixturesDir = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR; + $resources = array_map('strval', $resources); + $this->assertContains((string) new FileResource($fixturesDir . 'xml' . DIRECTORY_SEPARATOR . 'services_prototype.xml'), $resources); + $this->assertContains((string) new GlobResource($fixturesDir . 'Prototype', '/*', true), $resources); $this->assertContains('_PhpScoper5ea00cc67502b\\reflection.Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Prototype\\Foo', $resources); $this->assertContains('_PhpScoper5ea00cc67502b\\reflection.Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Prototype\\Sub\\Bar', $resources); } @@ -499,22 +523,22 @@ public function testPrototype() */ public function testAliasDefinitionContainsUnsupportedElements() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('legacy_invalid_alias_definition.xml'); $this->assertTrue($container->has('bar')); } public function testArgumentWithKeyOutsideCollection() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('with_key_outside_collection.xml'); $this->assertSame(['type' => 'foo', 'bar'], $container->getDefinition('foo')->getArguments()); } public function testDefaults() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('services28.xml'); $this->assertFalse($container->getDefinition('with_defaults')->isPublic()); $this->assertSame(['foo' => [[]]], $container->getDefinition('with_defaults')->getTags()); @@ -529,31 +553,31 @@ public function testDefaults() $this->assertSame(['foo' => [[]]], $container->getDefinition('child_def')->getTags()); $this->assertFalse($container->getDefinition('child_def')->isAutowired()); $definitions = $container->getDefinitions(); - $this->assertSame('service_container', \key($definitions)); - \array_shift($definitions); - $anonymous = \current($definitions); - $this->assertSame('bar', \key($definitions)); + $this->assertSame('service_container', key($definitions)); + array_shift($definitions); + $anonymous = current($definitions); + $this->assertSame('bar', key($definitions)); $this->assertTrue($anonymous->isPublic()); $this->assertTrue($anonymous->isAutowired()); $this->assertSame(['foo' => [[]]], $anonymous->getTags()); } public function testNamedArguments() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('services_named_args.xml'); - $this->assertEquals(['$apiKey' => 'ABCD', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass::class => null], $container->getDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy::class)->getArguments()); + $this->assertEquals(['$apiKey' => 'ABCD', CaseSensitiveClass::class => null], $container->getDefinition(NamedArgumentsDummy::class)->getArguments()); $container->compile(); - $this->assertEquals([null, 'ABCD'], $container->getDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy::class)->getArguments()); - $this->assertEquals([['setApiKey', ['123']]], $container->getDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy::class)->getMethodCalls()); + $this->assertEquals([null, 'ABCD'], $container->getDefinition(NamedArgumentsDummy::class)->getArguments()); + $this->assertEquals([['setApiKey', ['123']]], $container->getDefinition(NamedArgumentsDummy::class)->getMethodCalls()); } public function testInstanceof() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('services_instanceof.xml'); $container->compile(); - $definition = $container->getDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Bar::class); + $definition = $container->getDefinition(Bar::class); $this->assertTrue($definition->isAutowired()); $this->assertTrue($definition->isLazy()); $this->assertSame(['foo' => [[]], 'bar' => [[]]], $definition->getTags()); @@ -562,8 +586,8 @@ public function testInstanceOfAndChildDefinitionNotAllowed() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('The service "child_service" cannot use the "parent" option in the same file where "instanceof" configuration is defined as using both is not supported. Move your child definitions to a separate file.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('services_instanceof_with_parent.xml'); $container->compile(); } @@ -571,8 +595,8 @@ public function testAutoConfigureAndChildDefinitionNotAllowed() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('The service "child_service" cannot have a "parent" and also have "autoconfigure". Try setting autoconfigure="false" for the service.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('services_autoconfigure_with_parent.xml'); $container->compile(); } @@ -580,43 +604,43 @@ public function testDefaultsAndChildDefinitionNotAllowed() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('Attribute "autowire" on service "child_service" cannot be inherited from "defaults" when a "parent" is set. Move your child definitions to a separate file or define this attribute explicitly.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('services_defaults_with_parent.xml'); $container->compile(); } public function testAutoConfigureInstanceof() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('services_autoconfigure.xml'); $this->assertTrue($container->getDefinition('use_defaults_settings')->isAutoconfigured()); $this->assertFalse($container->getDefinition('override_defaults_settings_to_false')->isAutoconfigured()); } public function testBindings() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('services_bindings.xml'); $container->compile(); $definition = $container->getDefinition('bar'); - $this->assertEquals(['NonExistent' => null, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\BarInterface::class => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Bar::class), '$foo' => [null], '$quz' => 'quz', '$factory' => 'factory'], \array_map(function ($v) { + $this->assertEquals(['NonExistent' => null, BarInterface::class => new Reference(Bar::class), '$foo' => [null], '$quz' => 'quz', '$factory' => 'factory'], array_map(function ($v) { return $v->getValues()[0]; }, $definition->getBindings())); - $this->assertEquals(['quz', null, new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Bar::class), [null]], $definition->getArguments()); - $definition = $container->getDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Bar::class); + $this->assertEquals(['quz', null, new Reference(Bar::class), [null]], $definition->getArguments()); + $definition = $container->getDefinition(Bar::class); $this->assertEquals([null, 'factory'], $definition->getArguments()); - $this->assertEquals(['NonExistent' => null, '$quz' => 'quz', '$factory' => 'factory'], \array_map(function ($v) { + $this->assertEquals(['NonExistent' => null, '$quz' => 'quz', '$factory' => 'factory'], array_map(function ($v) { return $v->getValues()[0]; }, $definition->getBindings())); } public function testTsantosContainer() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('services_tsantos.xml'); $container->compile(); - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container); + $dumper = new PhpDumper($container); $this->assertStringEqualsFile(self::$fixturesPath . '/php/services_tsantos.php', $dumper->dump()); } /** @@ -624,11 +648,11 @@ public function testTsantosContainer() */ public function testOverriddenDefaultsBindings() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')); + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')); $loader->load('defaults_bindings.xml'); $loader->load('defaults_bindings2.xml'); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveBindingsPass())->process($container); + (new ResolveBindingsPass())->process($container); $this->assertSame('overridden', $container->get('bar')->quz); } } diff --git a/vendor/symfony/dependency-injection/Tests/Loader/YamlFileLoaderTest.php b/vendor/symfony/dependency-injection/Tests/Loader/YamlFileLoaderTest.php index 705604e5d..7e98d0d46 100644 --- a/vendor/symfony/dependency-injection/Tests/Loader/YamlFileLoaderTest.php +++ b/vendor/symfony/dependency-injection/Tests/Loader/YamlFileLoaderTest.php @@ -11,6 +11,7 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Loader; use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; +use _PhpScoper5ea00cc67502b\ProjectExtension; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\LoaderResolver; use _PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\FileResource; @@ -28,13 +29,28 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype; +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo; +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Component1\Dir1\Service1; +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Component1\Dir2\Service2; +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Component2\Dir1\Service4; +use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Component2\Dir2\Service5; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression; -class YamlFileLoaderTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use Exception; +use ReflectionObject; +use function array_keys; +use function array_map; +use function dirname; +use function realpath; +use function sort; +use const DIRECTORY_SEPARATOR; +use const PHP_INT_MAX; + +class YamlFileLoaderTest extends TestCase { protected static $fixturesPath; public static function setUpBeforeClass() { - self::$fixturesPath = \realpath(__DIR__ . '/../Fixtures/'); + self::$fixturesPath = realpath(__DIR__ . '/../Fixtures/'); require_once self::$fixturesPath . '/includes/foo.php'; require_once self::$fixturesPath . '/includes/ProjectExtension.php'; } @@ -42,10 +58,10 @@ public function testLoadUnExistFile() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessageRegExp('/The file ".+" does not exist./'); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/ini')); - $r = new \ReflectionObject($loader); + $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath . '/ini')); + $r = new ReflectionObject($loader); $m = $r->getMethod('loadFile'); - $m->setAccessible(\true); + $m->setAccessible(true); $m->invoke($loader, 'foo.yml'); } public function testLoadInvalidYamlFile() @@ -53,10 +69,10 @@ public function testLoadInvalidYamlFile() $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessageRegExp('/The file ".+" does not contain valid YAML./'); $path = self::$fixturesPath . '/ini'; - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator($path)); - $r = new \ReflectionObject($loader); + $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator($path)); + $r = new ReflectionObject($loader); $m = $r->getMethod('loadFile'); - $m->setAccessible(\true); + $m->setAccessible(true); $m->invoke($loader, $path . '/parameters.ini'); } /** @@ -65,7 +81,7 @@ public function testLoadInvalidYamlFile() public function testLoadInvalidFile($file) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath . '/yaml')); $loader->load($file . '.yml'); } public function provideInvalidFiles() @@ -74,28 +90,28 @@ public function provideInvalidFiles() } public function testLoadParameters() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services2.yml'); - $this->assertEquals(['foo' => 'bar', 'mixedcase' => ['MixedCaseKey' => 'value'], 'values' => [\true, \false, 0, 1000.3, \PHP_INT_MAX], 'bar' => 'foo', 'escape' => '@escapeme', 'foo_bar' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo_bar')], $container->getParameterBag()->all(), '->load() converts YAML keys to lowercase'); + $this->assertEquals(['foo' => 'bar', 'mixedcase' => ['MixedCaseKey' => 'value'], 'values' => [true, false, 0, 1000.3, PHP_INT_MAX], 'bar' => 'foo', 'escape' => '@escapeme', 'foo_bar' => new Reference('foo_bar')], $container->getParameterBag()->all(), '->load() converts YAML keys to lowercase'); } public function testLoadImports() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $resolver = new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Loader\LoaderResolver([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\IniFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/ini')), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\XmlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/xml')), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\PhpFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/php')), $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml'))]); + $container = new ContainerBuilder(); + $resolver = new LoaderResolver([new IniFileLoader($container, new FileLocator(self::$fixturesPath . '/ini')), new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml')), new PhpFileLoader($container, new FileLocator(self::$fixturesPath . '/php')), $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml'))]); $loader->setResolver($resolver); $loader->load('services4.yml'); $actual = $container->getParameterBag()->all(); - $expected = ['foo' => 'bar', 'values' => [\true, \false, \PHP_INT_MAX], 'bar' => '%foo%', 'escape' => '@escapeme', 'foo_bar' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo_bar'), 'mixedcase' => ['MixedCaseKey' => 'value'], 'imported_from_ini' => \true, 'imported_from_xml' => \true, 'with_wrong_ext' => 'from yaml']; - $this->assertEquals(\array_keys($expected), \array_keys($actual), '->load() imports and merges imported files'); + $expected = ['foo' => 'bar', 'values' => [true, false, PHP_INT_MAX], 'bar' => '%foo%', 'escape' => '@escapeme', 'foo_bar' => new Reference('foo_bar'), 'mixedcase' => ['MixedCaseKey' => 'value'], 'imported_from_ini' => true, 'imported_from_xml' => true, 'with_wrong_ext' => 'from yaml']; + $this->assertEquals(array_keys($expected), array_keys($actual), '->load() imports and merges imported files'); $this->assertTrue($actual['imported_from_ini']); // Bad import throws no exception due to ignore_errors value. $loader->load('services4_bad_import.yml'); } public function testLoadServices() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services6.yml'); $services = $container->getDefinitions(); $this->assertArrayHasKey('foo', $services, '->load() parses service elements'); @@ -103,17 +119,17 @@ public function testLoadServices() $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Definition', $services['foo'], '->load() converts service element to Definition instances'); $this->assertEquals('FooClass', $services['foo']->getClass(), '->load() parses the class attribute'); $this->assertEquals('%path%/foo.php', $services['file']->getFile(), '->load() parses the file tag'); - $this->assertEquals(['foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo'), [\true, \false]], $services['arguments']->getArguments(), '->load() parses the argument tags'); + $this->assertEquals(['foo', new Reference('foo'), [true, false]], $services['arguments']->getArguments(), '->load() parses the argument tags'); $this->assertEquals('sc_configure', $services['configurator1']->getConfigurator(), '->load() parses the configurator tag'); - $this->assertEquals([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz'), 'configure'], $services['configurator2']->getConfigurator(), '->load() parses the configurator tag'); + $this->assertEquals([new Reference('baz'), 'configure'], $services['configurator2']->getConfigurator(), '->load() parses the configurator tag'); $this->assertEquals(['BazClass', 'configureStatic'], $services['configurator3']->getConfigurator(), '->load() parses the configurator tag'); - $this->assertEquals([['setBar', []], ['setBar', []], ['setBar', [new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')]]], $services['method_call1']->getMethodCalls(), '->load() parses the method_call tag'); - $this->assertEquals([['setBar', ['foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo'), [\true, \false]]]], $services['method_call2']->getMethodCalls(), '->load() parses the method_call tag'); + $this->assertEquals([['setBar', []], ['setBar', []], ['setBar', [new Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')]]], $services['method_call1']->getMethodCalls(), '->load() parses the method_call tag'); + $this->assertEquals([['setBar', ['foo', new Reference('foo'), [true, false]]]], $services['method_call2']->getMethodCalls(), '->load() parses the method_call tag'); $this->assertEquals('factory', $services['new_factory1']->getFactory(), '->load() parses the factory tag'); - $this->assertEquals([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz'), 'getClass'], $services['new_factory2']->getFactory(), '->load() parses the factory tag'); + $this->assertEquals([new Reference('baz'), 'getClass'], $services['new_factory2']->getFactory(), '->load() parses the factory tag'); $this->assertEquals(['BazClass', 'getInstance'], $services['new_factory3']->getFactory(), '->load() parses the factory tag'); $this->assertSame([null, 'getInstance'], $services['new_factory4']->getFactory(), '->load() accepts factory tag without class'); - $this->assertEquals(['foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz')], $services['Acme\\WithShortCutArgs']->getArguments(), '->load() parses short service definition'); + $this->assertEquals(['foo', new Reference('baz')], $services['Acme\\WithShortCutArgs']->getArguments(), '->load() parses short service definition'); $aliases = $container->getAliases(); $this->assertArrayHasKey('alias_for_foo', $aliases, '->load() parses aliases'); $this->assertEquals('foo', (string) $aliases['alias_for_foo'], '->load() parses aliases'); @@ -130,27 +146,27 @@ public function testLoadServices() } public function testLoadFactoryShortSyntax() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services14.yml'); $services = $container->getDefinitions(); - $this->assertEquals([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('baz'), 'getClass'], $services['factory']->getFactory(), '->load() parses the factory tag with service:method'); + $this->assertEquals([new Reference('baz'), 'getClass'], $services['factory']->getFactory(), '->load() parses the factory tag with service:method'); $this->assertEquals(['FooBacFactory', 'createFooBar'], $services['factory_with_static_call']->getFactory(), '->load() parses the factory tag with Class::method'); } public function testLoadConfiguratorShortSyntax() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services_configurator_short_syntax.yml'); $services = $container->getDefinitions(); - $this->assertEquals([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo_bar_configurator'), 'configure'], $services['foo_bar']->getConfigurator(), '->load() parses the configurator tag with service:method'); + $this->assertEquals([new Reference('foo_bar_configurator'), 'configure'], $services['foo_bar']->getConfigurator(), '->load() parses the configurator tag with service:method'); $this->assertEquals(['FooBarConfigurator', 'configureFooBar'], $services['foo_bar_with_static_call']->getConfigurator(), '->load() parses the configurator tag with Class::method'); } public function testExtensions() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->registerExtension(new \_PhpScoper5ea00cc67502b\ProjectExtension()); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $container->registerExtension(new ProjectExtension()); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services10.yml'); $container->compile(); $services = $container->getDefinitions(); @@ -162,23 +178,23 @@ public function testExtensions() try { $loader->load('services11.yml'); $this->fail('->load() throws an InvalidArgumentException if the tag is not valid'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertInstanceOf('\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the tag is not valid'); $this->assertStringStartsWith('There is no extension able to load the configuration for "foobarfoobar" (in', $e->getMessage(), '->load() throws an InvalidArgumentException if the tag is not valid'); } } public function testExtensionWithNullConfig() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $container->registerExtension(new \_PhpScoper5ea00cc67502b\ProjectExtension()); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $container->registerExtension(new ProjectExtension()); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('null_config.yml'); $container->compile(); $this->assertSame([null], $container->getParameter('project.configs')); } public function testSupports() { - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator()); + $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator()); $this->assertTrue($loader->supports('foo.yml'), '->supports() returns true if the resource is loadable'); $this->assertTrue($loader->supports('foo.yaml'), '->supports() returns true if the resource is loadable'); $this->assertFalse($loader->supports('foo.foo'), '->supports() returns false if the resource is not loadable'); @@ -187,78 +203,78 @@ public function testSupports() } public function testNonArrayTagsThrowsException() { - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath . '/yaml')); try { $loader->load('badtag1.yml'); $this->fail('->load() should throw an exception when the tags key of a service is not an array'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the tags key is not an array'); $this->assertStringStartsWith('Parameter "tags" must be an array for service', $e->getMessage(), '->load() throws an InvalidArgumentException if the tags key is not an array'); } } public function testTagWithoutNameThrowsException() { - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath . '/yaml')); try { $loader->load('badtag2.yml'); $this->fail('->load() should throw an exception when a tag is missing the name key'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if a tag is missing the name key'); $this->assertStringStartsWith('A "tags" entry is missing a "name" key for service ', $e->getMessage(), '->load() throws an InvalidArgumentException if a tag is missing the name key'); } } public function testNameOnlyTagsAreAllowedAsString() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('tag_name_only.yml'); $this->assertCount(1, $container->getDefinition('foo_service')->getTag('foo')); } public function testTagWithAttributeArrayThrowsException() { - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath . '/yaml')); try { $loader->load('badtag3.yml'); $this->fail('->load() should throw an exception when a tag-attribute is not a scalar'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if a tag-attribute is not a scalar'); $this->assertStringStartsWith('A "tags" attribute must be of a scalar-type for service "foo_service", tag "foo", attribute "bar"', $e->getMessage(), '->load() throws an InvalidArgumentException if a tag-attribute is not a scalar'); } } public function testLoadYamlOnlyWithKeys() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services21.yml'); $definition = $container->getDefinition('manager'); - $this->assertEquals([['setLogger', [new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('logger')]], ['setClass', ['User']]], $definition->getMethodCalls()); - $this->assertEquals([\true], $definition->getArguments()); + $this->assertEquals([['setLogger', [new Reference('logger')]], ['setClass', ['User']]], $definition->getMethodCalls()); + $this->assertEquals([true], $definition->getArguments()); $this->assertEquals(['manager' => [['alias' => 'user']]], $definition->getTags()); } public function testTagWithEmptyNameThrowsException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessageRegExp('/The tag name for service ".+" in .+ must be a non-empty string/'); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('tag_name_empty_string.yml'); } public function testTagWithNonStringNameThrowsException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessageRegExp('/The tag name for service ".+" in .+ must be a non-empty string/'); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('tag_name_no_string.yml'); } public function testTypesNotArray() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('bad_types1.yml'); } public function testTypeNotString() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('bad_types2.yml'); } /** @@ -266,82 +282,82 @@ public function testTypeNotString() */ public function testTypes() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services22.yml'); $this->assertEquals(['Foo', 'Bar'], $container->getDefinition('foo_service')->getAutowiringTypes()); $this->assertEquals(['Foo'], $container->getDefinition('baz_service')->getAutowiringTypes()); } public function testParsesIteratorArgument() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services9.yml'); $lazyDefinition = $container->getDefinition('lazy_context'); - $this->assertEquals([new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument(['k1' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo.baz'), 'k2' => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('service_container')]), new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Argument\IteratorArgument([])], $lazyDefinition->getArguments(), '->load() parses lazy arguments'); + $this->assertEquals([new IteratorArgument(['k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container')]), new IteratorArgument([])], $lazyDefinition->getArguments(), '->load() parses lazy arguments'); $message = 'The "deprecated_service" service is deprecated. You should stop using it, as it will soon be removed.'; $this->assertSame($message, $container->getDefinition('deprecated_service')->getDeprecationMessage('deprecated_service')); } public function testAutowire() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services23.yml'); $this->assertTrue($container->getDefinition('bar_service')->isAutowired()); } public function testClassFromId() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('class_from_id.yml'); $container->compile(); - $this->assertEquals(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass::class, $container->getDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass::class)->getClass()); + $this->assertEquals(CaseSensitiveClass::class, $container->getDefinition(CaseSensitiveClass::class)->getClass()); } public function testPrototype() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services_prototype.yml'); - $ids = \array_keys($container->getDefinitions()); - \sort($ids); - $this->assertSame([\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\Bar::class, 'service_container'], $ids); + $ids = array_keys($container->getDefinitions()); + sort($ids); + $this->assertSame([Foo::class, Prototype\Sub\Bar::class, 'service_container'], $ids); $resources = $container->getResources(); - $fixturesDir = \dirname(__DIR__) . \DIRECTORY_SEPARATOR . 'Fixtures' . \DIRECTORY_SEPARATOR; - $resources = \array_map('strval', $resources); - $this->assertContains((string) new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\FileResource($fixturesDir . 'yaml' . \DIRECTORY_SEPARATOR . 'services_prototype.yml'), $resources); - $this->assertContains((string) new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\Resource\GlobResource($fixturesDir . 'Prototype', '', \true), $resources); + $fixturesDir = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR; + $resources = array_map('strval', $resources); + $this->assertContains((string) new FileResource($fixturesDir . 'yaml' . DIRECTORY_SEPARATOR . 'services_prototype.yml'), $resources); + $this->assertContains((string) new GlobResource($fixturesDir . 'Prototype', '', true), $resources); $this->assertContains('_PhpScoper5ea00cc67502b\\reflection.Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Prototype\\Foo', $resources); $this->assertContains('_PhpScoper5ea00cc67502b\\reflection.Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Prototype\\Sub\\Bar', $resources); } public function testPrototypeWithNamespace() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services_prototype_namespace.yml'); - $ids = \array_keys($container->getDefinitions()); - \sort($ids); - $this->assertSame([\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Component1\Dir1\Service1::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Component1\Dir2\Service2::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Component2\Dir1\Service4::class, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Component2\Dir2\Service5::class, 'service_container'], $ids); - $this->assertTrue($container->getDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Component1\Dir1\Service1::class)->hasTag('foo')); - $this->assertTrue($container->getDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Component2\Dir1\Service4::class)->hasTag('foo')); - $this->assertFalse($container->getDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Component1\Dir1\Service1::class)->hasTag('bar')); - $this->assertFalse($container->getDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Component2\Dir1\Service4::class)->hasTag('bar')); - $this->assertTrue($container->getDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Component1\Dir2\Service2::class)->hasTag('bar')); - $this->assertTrue($container->getDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Component2\Dir2\Service5::class)->hasTag('bar')); - $this->assertFalse($container->getDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Component1\Dir2\Service2::class)->hasTag('foo')); - $this->assertFalse($container->getDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Component2\Dir2\Service5::class)->hasTag('foo')); + $ids = array_keys($container->getDefinitions()); + sort($ids); + $this->assertSame([Service1::class, Service2::class, Service4::class, Service5::class, 'service_container'], $ids); + $this->assertTrue($container->getDefinition(Service1::class)->hasTag('foo')); + $this->assertTrue($container->getDefinition(Service4::class)->hasTag('foo')); + $this->assertFalse($container->getDefinition(Service1::class)->hasTag('bar')); + $this->assertFalse($container->getDefinition(Service4::class)->hasTag('bar')); + $this->assertTrue($container->getDefinition(Service2::class)->hasTag('bar')); + $this->assertTrue($container->getDefinition(Service5::class)->hasTag('bar')); + $this->assertFalse($container->getDefinition(Service2::class)->hasTag('foo')); + $this->assertFalse($container->getDefinition(Service5::class)->hasTag('foo')); } public function testPrototypeWithNamespaceAndNoResource() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessageRegExp('/A "resource" attribute must be set when the "namespace" attribute is set for service ".+" in .+/'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services_prototype_namespace_without_resource.yml'); } public function testDefaults() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services28.yml'); $this->assertFalse($container->getDefinition('with_defaults')->isPublic()); $this->assertSame(['foo' => [[]]], $container->getDefinition('with_defaults')->getTags()); @@ -367,23 +383,23 @@ public function testDefaults() } public function testNamedArguments() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services_named_args.yml'); - $this->assertEquals([null, '$apiKey' => 'ABCD'], $container->getDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy::class)->getArguments()); - $this->assertEquals(['$apiKey' => 'ABCD', \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass::class => null], $container->getDefinition('another_one')->getArguments()); + $this->assertEquals([null, '$apiKey' => 'ABCD'], $container->getDefinition(NamedArgumentsDummy::class)->getArguments()); + $this->assertEquals(['$apiKey' => 'ABCD', CaseSensitiveClass::class => null], $container->getDefinition('another_one')->getArguments()); $container->compile(); - $this->assertEquals([null, 'ABCD'], $container->getDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy::class)->getArguments()); + $this->assertEquals([null, 'ABCD'], $container->getDefinition(NamedArgumentsDummy::class)->getArguments()); $this->assertEquals([null, 'ABCD'], $container->getDefinition('another_one')->getArguments()); $this->assertEquals([['setApiKey', ['123']]], $container->getDefinition('another_one')->getMethodCalls()); } public function testInstanceof() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services_instanceof.yml'); $container->compile(); - $definition = $container->getDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Bar::class); + $definition = $container->getDefinition(Bar::class); $this->assertTrue($definition->isAutowired()); $this->assertTrue($definition->isLazy()); $this->assertSame(['foo' => [[]], 'bar' => [[]]], $definition->getTags()); @@ -392,8 +408,8 @@ public function testInstanceOfAndChildDefinitionNotAllowed() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('The service "child_service" cannot use the "parent" option in the same file where "_instanceof" configuration is defined as using both is not supported. Move your child definitions to a separate file.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services_instanceof_with_parent.yml'); $container->compile(); } @@ -401,8 +417,8 @@ public function testAutoConfigureAndChildDefinitionNotAllowed() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('The service "child_service" cannot have a "parent" and also have "autoconfigure". Try setting "autoconfigure: false" for the service.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services_autoconfigure_with_parent.yml'); $container->compile(); } @@ -410,8 +426,8 @@ public function testDefaultsAndChildDefinitionNotAllowed() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('Attribute "autowire" on service "child_service" cannot be inherited from "_defaults" when a "parent" is set. Move your child definitions to a separate file or define this attribute explicitly.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services_defaults_with_parent.yml'); $container->compile(); } @@ -419,14 +435,14 @@ public function testDecoratedServicesWithWrongSyntaxThrowsException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessage('The value of the "decorates" option for the "bar" service must be the id of the service without the "@" prefix (replace "@foo" with "foo").'); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('bad_decorates.yml'); } public function testInvalidTagsWithDefaults() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessageRegExp('/Parameter "tags" must be an array for service "Foo\\\\Bar" in ".+services31_invalid_tags\\.yml"\\. Check your YAML syntax./'); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader(new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(), new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services31_invalid_tags.yml'); } /** @@ -435,21 +451,21 @@ public function testInvalidTagsWithDefaults() */ public function testUnderscoreServiceId() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services_underscore.yml'); } public function testAnonymousServices() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('anonymous_services.yml'); $definition = $container->getDefinition('Foo'); $this->assertTrue($definition->isAutowired()); // Anonymous service in an argument $args = $definition->getArguments(); $this->assertCount(1, $args); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference::class, $args[0]); + $this->assertInstanceOf(Reference::class, $args[0]); $this->assertTrue($container->has((string) $args[0])); $this->assertRegExp('/^\\d+_Bar~[._A-Za-z0-9]{7}$/', (string) $args[0]); $anonymous = $container->getDefinition((string) $args[0]); @@ -459,7 +475,7 @@ public function testAnonymousServices() // Anonymous service in a callable $factory = $definition->getFactory(); $this->assertIsArray($factory); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference::class, $factory[0]); + $this->assertInstanceOf(Reference::class, $factory[0]); $this->assertTrue($container->has((string) $factory[0])); $this->assertRegExp('/^\\d+_Quz~[._A-Za-z0-9]{7}$/', (string) $factory[0]); $this->assertEquals('constructFoo', $factory[1]); @@ -470,17 +486,17 @@ public function testAnonymousServices() } public function testAnonymousServicesInDifferentFilesWithSameNameDoNotConflict() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml/foo')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml/foo')); $loader->load('services.yml'); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml/bar')); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml/bar')); $loader->load('services.yml'); $this->assertCount(5, $container->getDefinitions()); } public function testAnonymousServicesInInstanceof() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('anonymous_services_in_instanceof.yml'); $definition = $container->getDefinition('Dummy'); $instanceof = $definition->getInstanceofConditionals(); @@ -488,7 +504,7 @@ public function testAnonymousServicesInInstanceof() $this->assertArrayHasKey('DummyInterface', $instanceof); $args = $instanceof['DummyInterface']->getProperties(); $this->assertCount(1, $args); - $this->assertInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference::class, $args['foo']); + $this->assertInstanceOf(Reference::class, $args['foo']); $this->assertTrue($container->has((string) $args['foo'])); $anonymous = $container->getDefinition((string) $args['foo']); $this->assertEquals('Anonymous', $anonymous->getClass()); @@ -500,22 +516,22 @@ public function testAnonymousServicesWithAliases() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessageRegExp('/Creating an alias using the tag "!service" is not allowed in ".+anonymous_services_alias\\.yml"\\./'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('anonymous_services_alias.yml'); } public function testAnonymousServicesInParameters() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessageRegExp('/Using an anonymous service in a parameter is not allowed in ".+anonymous_services_in_parameters\\.yml"\\./'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('anonymous_services_in_parameters.yml'); } public function testAutoConfigureInstanceof() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services_autoconfigure.yml'); $this->assertTrue($container->getDefinition('use_defaults_settings')->isAutoconfigured()); $this->assertFalse($container->getDefinition('override_defaults_settings_to_false')->isAutoconfigured()); @@ -524,32 +540,32 @@ public function testEmptyDefaultsThrowsClearException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessageRegExp('/Service "_defaults" key must be an array, "NULL" given in ".+bad_empty_defaults\\.yml"\\./'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('bad_empty_defaults.yml'); } public function testEmptyInstanceofThrowsClearException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); $this->expectExceptionMessageRegExp('/Service "_instanceof" key must be an array, "NULL" given in ".+bad_empty_instanceof\\.yml"\\./'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('bad_empty_instanceof.yml'); } public function testBindings() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('services_bindings.yml'); $container->compile(); $definition = $container->getDefinition('bar'); - $this->assertEquals(['NonExistent' => null, \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\BarInterface::class => new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Bar::class), '$foo' => [null], '$quz' => 'quz', '$factory' => 'factory'], \array_map(function ($v) { + $this->assertEquals(['NonExistent' => null, BarInterface::class => new Reference(Bar::class), '$foo' => [null], '$quz' => 'quz', '$factory' => 'factory'], array_map(function ($v) { return $v->getValues()[0]; }, $definition->getBindings())); - $this->assertEquals(['quz', null, new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Bar::class), [null]], $definition->getArguments()); - $definition = $container->getDefinition(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\Fixtures\Bar::class); + $this->assertEquals(['quz', null, new Reference(Bar::class), [null]], $definition->getArguments()); + $definition = $container->getDefinition(Bar::class); $this->assertEquals([null, 'factory'], $definition->getArguments()); - $this->assertEquals(['NonExistent' => null, '$quz' => 'quz', '$factory' => 'factory'], \array_map(function ($v) { + $this->assertEquals(['NonExistent' => null, '$quz' => 'quz', '$factory' => 'factory'], array_map(function ($v) { return $v->getValues()[0]; }, $definition->getBindings())); } @@ -558,11 +574,11 @@ public function testBindings() */ public function testOverriddenDefaultsBindings() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('defaults_bindings.yml'); $loader->load('defaults_bindings2.yml'); - (new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Compiler\ResolveBindingsPass())->process($container); + (new ResolveBindingsPass())->process($container); $this->assertSame('overridden', $container->get('bar')->quz); } /** @@ -572,8 +588,8 @@ public function testOverriddenDefaultsBindings() */ public function testAliasDefinitionContainsUnsupportedElements() { - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerBuilder(); - $loader = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \_PhpScoper5ea00cc67502b\Symfony\Component\Config\FileLocator(self::$fixturesPath . '/yaml')); + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')); $loader->load('legacy_invalid_alias_definition.yml'); $this->assertTrue($container->has('foo')); } diff --git a/vendor/symfony/dependency-injection/Tests/Loader/index.php b/vendor/symfony/dependency-injection/Tests/Loader/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Loader/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php b/vendor/symfony/dependency-injection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php index bcc311931..e5f27dd29 100644 --- a/vendor/symfony/dependency-injection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php +++ b/vendor/symfony/dependency-injection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php @@ -12,26 +12,29 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag; -class EnvPlaceholderParameterBagTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use function array_values; +use function sprintf; + +class EnvPlaceholderParameterBagTest extends TestCase { public function testGetThrowsInvalidArgumentExceptionIfEnvNameContainsNonWordCharacters() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException'); - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag(); + $bag = new EnvPlaceholderParameterBag(); $bag->get('env(%foo%)'); } public function testMergeWillNotDuplicateIdenticalParameters() { $envVariableName = 'DB_HOST'; - $parameter = \sprintf('env(%s)', $envVariableName); - $firstBag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag(); + $parameter = sprintf('env(%s)', $envVariableName); + $firstBag = new EnvPlaceholderParameterBag(); // initialize placeholders $firstBag->get($parameter); $secondBag = clone $firstBag; $firstBag->mergeEnvPlaceholders($secondBag); $mergedPlaceholders = $firstBag->getEnvPlaceholders(); $placeholderForVariable = $mergedPlaceholders[$envVariableName]; - $placeholder = \array_values($placeholderForVariable)[0]; + $placeholder = array_values($placeholderForVariable)[0]; $this->assertCount(1, $placeholderForVariable); $this->assertIsString($placeholder); $this->assertStringContainsString($envVariableName, $placeholder); @@ -39,16 +42,16 @@ public function testMergeWillNotDuplicateIdenticalParameters() public function testMergeWhereFirstBagIsEmptyWillWork() { $envVariableName = 'DB_HOST'; - $parameter = \sprintf('env(%s)', $envVariableName); - $firstBag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag(); - $secondBag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag(); + $parameter = sprintf('env(%s)', $envVariableName); + $firstBag = new EnvPlaceholderParameterBag(); + $secondBag = new EnvPlaceholderParameterBag(); // initialize placeholder only in second bag $secondBag->get($parameter); $this->assertEmpty($firstBag->getEnvPlaceholders()); $firstBag->mergeEnvPlaceholders($secondBag); $mergedPlaceholders = $firstBag->getEnvPlaceholders(); $placeholderForVariable = $mergedPlaceholders[$envVariableName]; - $placeholder = \array_values($placeholderForVariable)[0]; + $placeholder = array_values($placeholderForVariable)[0]; $this->assertCount(1, $placeholderForVariable); $this->assertIsString($placeholder); $this->assertStringContainsString($envVariableName, $placeholder); @@ -57,9 +60,9 @@ public function testMergeWherePlaceholderOnlyExistsInSecond() { $uniqueEnvName = 'DB_HOST'; $commonEnvName = 'DB_USER'; - $uniqueParamName = \sprintf('env(%s)', $uniqueEnvName); - $commonParamName = \sprintf('env(%s)', $commonEnvName); - $firstBag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag(); + $uniqueParamName = sprintf('env(%s)', $uniqueEnvName); + $commonParamName = sprintf('env(%s)', $commonEnvName); + $firstBag = new EnvPlaceholderParameterBag(); // initialize common placeholder $firstBag->get($commonParamName); $secondBag = clone $firstBag; @@ -74,9 +77,9 @@ public function testMergeWherePlaceholderOnlyExistsInSecond() public function testMergeWithDifferentIdentifiersForPlaceholders() { $envName = 'DB_USER'; - $paramName = \sprintf('env(%s)', $envName); - $firstBag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag(); - $secondBag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag(); + $paramName = sprintf('env(%s)', $envName); + $firstBag = new EnvPlaceholderParameterBag(); + $secondBag = new EnvPlaceholderParameterBag(); // initialize placeholders $firstPlaceholder = $firstBag->get($paramName); $secondPlaceholder = $secondBag->get($paramName); @@ -87,7 +90,7 @@ public function testMergeWithDifferentIdentifiersForPlaceholders() } public function testResolveEnvCastsIntToString() { - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag(); + $bag = new EnvPlaceholderParameterBag(); $bag->get('env(INT_VAR)'); $bag->set('env(INT_VAR)', 2); $bag->resolve(); @@ -95,7 +98,7 @@ public function testResolveEnvCastsIntToString() } public function testResolveEnvAllowsNull() { - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag(); + $bag = new EnvPlaceholderParameterBag(); $bag->get('env(NULL_VAR)'); $bag->set('env(NULL_VAR)', null); $bag->resolve(); @@ -105,14 +108,14 @@ public function testResolveThrowsOnBadDefaultValue() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); $this->expectExceptionMessage('The default value of env parameter "ARRAY_VAR" must be scalar or null, "array" given.'); - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag(); + $bag = new EnvPlaceholderParameterBag(); $bag->get('env(ARRAY_VAR)'); $bag->set('env(ARRAY_VAR)', []); $bag->resolve(); } public function testGetEnvAllowsNull() { - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag(); + $bag = new EnvPlaceholderParameterBag(); $bag->set('env(NULL_VAR)', null); $bag->get('env(NULL_VAR)'); $bag->resolve(); @@ -122,7 +125,7 @@ public function testGetThrowsOnBadDefaultValue() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException'); $this->expectExceptionMessage('The default value of an env() parameter must be scalar or null, but "array" given to "env(ARRAY_VAR)".'); - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag(); + $bag = new EnvPlaceholderParameterBag(); $bag->set('env(ARRAY_VAR)', []); $bag->get('env(ARRAY_VAR)'); $bag->resolve(); diff --git a/vendor/symfony/dependency-injection/Tests/ParameterBag/FrozenParameterBagTest.php b/vendor/symfony/dependency-injection/Tests/ParameterBag/FrozenParameterBagTest.php index 7b034c985..a89413c4b 100644 --- a/vendor/symfony/dependency-injection/Tests/ParameterBag/FrozenParameterBagTest.php +++ b/vendor/symfony/dependency-injection/Tests/ParameterBag/FrozenParameterBagTest.php @@ -12,36 +12,36 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; -class FrozenParameterBagTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class FrozenParameterBagTest extends TestCase { public function testConstructor() { $parameters = ['foo' => 'foo', 'bar' => 'bar']; - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag($parameters); + $bag = new FrozenParameterBag($parameters); $this->assertEquals($parameters, $bag->all(), '__construct() takes an array of parameters as its first argument'); } public function testClear() { $this->expectException('LogicException'); - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag([]); + $bag = new FrozenParameterBag([]); $bag->clear(); } public function testSet() { $this->expectException('LogicException'); - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag([]); + $bag = new FrozenParameterBag([]); $bag->set('foo', 'bar'); } public function testAdd() { $this->expectException('LogicException'); - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag([]); + $bag = new FrozenParameterBag([]); $bag->add([]); } public function testRemove() { $this->expectException('LogicException'); - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag(['foo' => 'bar']); + $bag = new FrozenParameterBag(['foo' => 'bar']); $bag->remove('foo'); } } diff --git a/vendor/symfony/dependency-injection/Tests/ParameterBag/ParameterBagTest.php b/vendor/symfony/dependency-injection/Tests/ParameterBag/ParameterBagTest.php index fee97f6ee..f01e495e5 100644 --- a/vendor/symfony/dependency-injection/Tests/ParameterBag/ParameterBagTest.php +++ b/vendor/symfony/dependency-injection/Tests/ParameterBag/ParameterBagTest.php @@ -15,28 +15,31 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; -class ParameterBagTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use Exception; +use function sprintf; + +class ParameterBagTest extends TestCase { public function testConstructor() { - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag($parameters = ['foo' => 'foo', 'bar' => 'bar']); + $bag = new ParameterBag($parameters = ['foo' => 'foo', 'bar' => 'bar']); $this->assertEquals($parameters, $bag->all(), '__construct() takes an array of parameters as its first argument'); } public function testClear() { - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag($parameters = ['foo' => 'foo', 'bar' => 'bar']); + $bag = new ParameterBag($parameters = ['foo' => 'foo', 'bar' => 'bar']); $bag->clear(); $this->assertEquals([], $bag->all(), '->clear() removes all parameters'); } public function testRemove() { - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => 'foo', 'bar' => 'bar']); + $bag = new ParameterBag(['foo' => 'foo', 'bar' => 'bar']); $bag->remove('foo'); $this->assertEquals(['bar' => 'bar'], $bag->all(), '->remove() removes a parameter'); } public function testGetSet() { - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => 'bar']); + $bag = new ParameterBag(['foo' => 'bar']); $bag->set('bar', 'foo'); $this->assertEquals('foo', $bag->get('bar'), '->set() sets the value of a new parameter'); $bag->set('foo', 'baz'); @@ -44,7 +47,7 @@ public function testGetSet() try { $bag->get('baba'); $this->fail('->get() throws an Symfony\\Component\\DependencyInjection\\Exception\\ParameterNotFoundException if the key does not exist'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\ParameterNotFoundException', $e, '->get() throws an Symfony\\Component\\DependencyInjection\\Exception\\ParameterNotFoundException if the key does not exist'); $this->assertEquals('You have requested a non-existent parameter "baba".', $e->getMessage(), '->get() throws an Symfony\\Component\\DependencyInjection\\Exception\\ParameterNotFoundException if the key does not exist'); } @@ -54,8 +57,8 @@ public function testGetSet() */ public function testGetThrowParameterNotFoundException($parameterKey, $exceptionMessage) { - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz', 'fiz' => ['bar' => ['boo' => 12]]]); - $this->expectException(\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException::class); + $bag = new ParameterBag(['foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz', 'fiz' => ['bar' => ['boo' => 12]]]); + $this->expectException(ParameterNotFoundException::class); $this->expectExceptionMessage($exceptionMessage); $bag->get($parameterKey); } @@ -65,7 +68,7 @@ public function provideGetThrowParameterNotFoundExceptionData() } public function testHas() { - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => 'bar']); + $bag = new ParameterBag(['foo' => 'bar']); $this->assertTrue($bag->has('foo'), '->has() returns true if a parameter is defined'); $this->assertFalse($bag->has('bar'), '->has() returns false if a parameter is not defined'); } @@ -78,7 +81,7 @@ public function testHas() */ public function testMixedCase() { - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => 'foo', 'bar' => 'bar']); + $bag = new ParameterBag(['foo' => 'foo', 'bar' => 'bar']); $bag->remove('BAR'); $this->assertEquals(['foo' => 'foo'], $bag->all(), '->remove() converts key to lowercase before removing'); $bag->set('Foo', 'baz1'); @@ -88,85 +91,85 @@ public function testMixedCase() } public function testResolveValue() { - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag([]); + $bag = new ParameterBag([]); $this->assertEquals('foo', $bag->resolveValue('foo'), '->resolveValue() returns its argument unmodified if no placeholders are found'); - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => 'bar']); + $bag = new ParameterBag(['foo' => 'bar']); $this->assertEquals('I\'m a bar', $bag->resolveValue('I\'m a %foo%'), '->resolveValue() replaces placeholders by their values'); $this->assertEquals(['bar' => 'bar'], $bag->resolveValue(['%foo%' => '%foo%']), '->resolveValue() replaces placeholders in keys and values of arrays'); $this->assertEquals(['bar' => ['bar' => ['bar' => 'bar']]], $bag->resolveValue(['%foo%' => ['%foo%' => ['%foo%' => '%foo%']]]), '->resolveValue() replaces placeholders in nested arrays'); $this->assertEquals('I\'m a %%foo%%', $bag->resolveValue('I\'m a %%foo%%'), '->resolveValue() supports % escaping by doubling it'); $this->assertEquals('I\'m a bar %%foo bar', $bag->resolveValue('I\'m a %foo% %%foo %foo%'), '->resolveValue() supports % escaping by doubling it'); $this->assertEquals(['foo' => ['bar' => ['ding' => 'I\'m a bar %%foo %%bar']]], $bag->resolveValue(['foo' => ['bar' => ['ding' => 'I\'m a bar %%foo %%bar']]]), '->resolveValue() supports % escaping by doubling it'); - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => \true]); + $bag = new ParameterBag(['foo' => true]); $this->assertTrue($bag->resolveValue('%foo%'), '->resolveValue() replaces arguments that are just a placeholder by their value without casting them to strings'); - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => null]); + $bag = new ParameterBag(['foo' => null]); $this->assertNull($bag->resolveValue('%foo%'), '->resolveValue() replaces arguments that are just a placeholder by their value without casting them to strings'); - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => 'bar', 'baz' => '%%%foo% %foo%%% %%foo%% %%%foo%%%']); + $bag = new ParameterBag(['foo' => 'bar', 'baz' => '%%%foo% %foo%%% %%foo%% %%%foo%%%']); $this->assertEquals('%%bar bar%% %%foo%% %%bar%%', $bag->resolveValue('%baz%'), '->resolveValue() replaces params placed besides escaped %'); - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['baz' => '%%s?%%s']); + $bag = new ParameterBag(['baz' => '%%s?%%s']); $this->assertEquals('%%s?%%s', $bag->resolveValue('%baz%'), '->resolveValue() is not replacing greedily'); - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag([]); + $bag = new ParameterBag([]); try { $bag->resolveValue('%foobar%'); $this->fail('->resolveValue() throws an InvalidArgumentException if a placeholder references a non-existent parameter'); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException $e) { + } catch (ParameterNotFoundException $e) { $this->assertEquals('You have requested a non-existent parameter "foobar".', $e->getMessage(), '->resolveValue() throws a ParameterNotFoundException if a placeholder references a non-existent parameter'); } try { $bag->resolveValue('foo %foobar% bar'); $this->fail('->resolveValue() throws a ParameterNotFoundException if a placeholder references a non-existent parameter'); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException $e) { + } catch (ParameterNotFoundException $e) { $this->assertEquals('You have requested a non-existent parameter "foobar".', $e->getMessage(), '->resolveValue() throws a ParameterNotFoundException if a placeholder references a non-existent parameter'); } - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => 'a %bar%', 'bar' => []]); + $bag = new ParameterBag(['foo' => 'a %bar%', 'bar' => []]); try { $bag->resolveValue('%foo%'); $this->fail('->resolveValue() throws a RuntimeException when a parameter embeds another non-string parameter'); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\RuntimeException $e) { + } catch (RuntimeException $e) { $this->assertEquals('A string value must be composed of strings and/or numbers, but found parameter "bar" of type "array" inside string value "a %bar%".', $e->getMessage(), '->resolveValue() throws a RuntimeException when a parameter embeds another non-string parameter'); } - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => '%bar%', 'bar' => '%foobar%', 'foobar' => '%foo%']); + $bag = new ParameterBag(['foo' => '%bar%', 'bar' => '%foobar%', 'foobar' => '%foo%']); try { $bag->resolveValue('%foo%'); $this->fail('->resolveValue() throws a ParameterCircularReferenceException when a parameter has a circular reference'); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException $e) { + } catch (ParameterCircularReferenceException $e) { $this->assertEquals('Circular reference detected for parameter "foo" ("foo" > "bar" > "foobar" > "foo").', $e->getMessage(), '->resolveValue() throws a ParameterCircularReferenceException when a parameter has a circular reference'); } - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => 'a %bar%', 'bar' => 'a %foobar%', 'foobar' => 'a %foo%']); + $bag = new ParameterBag(['foo' => 'a %bar%', 'bar' => 'a %foobar%', 'foobar' => 'a %foo%']); try { $bag->resolveValue('%foo%'); $this->fail('->resolveValue() throws a ParameterCircularReferenceException when a parameter has a circular reference'); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException $e) { + } catch (ParameterCircularReferenceException $e) { $this->assertEquals('Circular reference detected for parameter "foo" ("foo" > "bar" > "foobar" > "foo").', $e->getMessage(), '->resolveValue() throws a ParameterCircularReferenceException when a parameter has a circular reference'); } - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['host' => 'foo.bar', 'port' => 1337]); + $bag = new ParameterBag(['host' => 'foo.bar', 'port' => 1337]); $this->assertEquals('foo.bar:1337', $bag->resolveValue('%host%:%port%')); } public function testResolveIndicatesWhyAParameterIsNeeded() { - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => '%bar%']); + $bag = new ParameterBag(['foo' => '%bar%']); try { $bag->resolve(); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException $e) { + } catch (ParameterNotFoundException $e) { $this->assertEquals('The parameter "foo" has a dependency on a non-existent parameter "bar".', $e->getMessage()); } - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => '%bar%']); + $bag = new ParameterBag(['foo' => '%bar%']); try { $bag->resolve(); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException $e) { + } catch (ParameterNotFoundException $e) { $this->assertEquals('The parameter "foo" has a dependency on a non-existent parameter "bar".', $e->getMessage()); } } public function testResolveUnescapesValue() { - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => ['bar' => ['ding' => 'I\'m a bar %%foo %%bar']], 'bar' => 'I\'m a %%foo%%']); + $bag = new ParameterBag(['foo' => ['bar' => ['ding' => 'I\'m a bar %%foo %%bar']], 'bar' => 'I\'m a %%foo%%']); $bag->resolve(); $this->assertEquals('I\'m a %foo%', $bag->get('bar'), '->resolveValue() supports % escaping by doubling it'); $this->assertEquals(['bar' => ['ding' => 'I\'m a bar %foo %bar']], $bag->get('foo'), '->resolveValue() supports % escaping by doubling it'); } public function testEscapeValue() { - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(); + $bag = new ParameterBag(); $bag->add(['foo' => $bag->escapeValue(['bar' => ['ding' => 'I\'m a bar %foo %bar', 'zero' => null]]), 'bar' => $bag->escapeValue('I\'m a %foo%')]); $this->assertEquals('I\'m a %%foo%%', $bag->get('bar'), '->escapeValue() escapes % by doubling it'); $this->assertEquals(['bar' => ['ding' => 'I\'m a bar %%foo %%bar', 'zero' => null]], $bag->get('foo'), '->escapeValue() escapes % by doubling it'); @@ -176,11 +179,11 @@ public function testEscapeValue() */ public function testResolveStringWithSpacesReturnsString($expected, $test, $description) { - $bag = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(['foo' => 'bar']); + $bag = new ParameterBag(['foo' => 'bar']); try { $this->assertEquals($expected, $bag->resolveString($test), $description); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException $e) { - $this->fail(\sprintf('%s - "%s"', $description, $expected)); + } catch (ParameterNotFoundException $e) { + $this->fail(sprintf('%s - "%s"', $description, $expected)); } } public function stringsWithSpacesProvider() diff --git a/vendor/symfony/dependency-injection/Tests/ParameterBag/index.php b/vendor/symfony/dependency-injection/Tests/ParameterBag/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/ParameterBag/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/Tests/ParameterTest.php b/vendor/symfony/dependency-injection/Tests/ParameterTest.php index 669e9bae9..f1c0de5c3 100644 --- a/vendor/symfony/dependency-injection/Tests/ParameterTest.php +++ b/vendor/symfony/dependency-injection/Tests/ParameterTest.php @@ -12,11 +12,11 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Parameter; -class ParameterTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class ParameterTest extends TestCase { public function testConstructor() { - $ref = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Parameter('foo'); + $ref = new Parameter('foo'); $this->assertEquals('foo', (string) $ref, '__construct() sets the id of the parameter, which is used for the __toString() method'); } } diff --git a/vendor/symfony/dependency-injection/Tests/ReferenceTest.php b/vendor/symfony/dependency-injection/Tests/ReferenceTest.php index 94ebd0108..de4336313 100644 --- a/vendor/symfony/dependency-injection/Tests/ReferenceTest.php +++ b/vendor/symfony/dependency-injection/Tests/ReferenceTest.php @@ -12,11 +12,11 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference; -class ReferenceTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class ReferenceTest extends TestCase { public function testConstructor() { - $ref = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference('foo'); + $ref = new Reference('foo'); $this->assertEquals('foo', (string) $ref, '__construct() sets the id of the reference, which is used for the __toString() method'); } } diff --git a/vendor/symfony/dependency-injection/Tests/ServiceLocatorTest.php b/vendor/symfony/dependency-injection/Tests/ServiceLocatorTest.php index 45abab8bc..b061067ba 100644 --- a/vendor/symfony/dependency-injection/Tests/ServiceLocatorTest.php +++ b/vendor/symfony/dependency-injection/Tests/ServiceLocatorTest.php @@ -14,11 +14,13 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator; use _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceSubscriberInterface; -class ServiceLocatorTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use stdClass; + +class ServiceLocatorTest extends TestCase { public function testHas() { - $locator = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator(['foo' => function () { + $locator = new ServiceLocator(['foo' => function () { return 'bar'; }, 'bar' => function () { return 'baz'; @@ -31,7 +33,7 @@ public function testHas() } public function testGet() { - $locator = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator(['foo' => function () { + $locator = new ServiceLocator(['foo' => function () { return 'bar'; }, 'bar' => function () { return 'baz'; @@ -42,7 +44,7 @@ public function testGet() public function testGetDoesNotMemoize() { $i = 0; - $locator = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator(['foo' => function () use(&$i) { + $locator = new ServiceLocator(['foo' => function () use(&$i) { ++$i; return 'bar'; }]); @@ -54,7 +56,7 @@ public function testGetThrowsOnUndefinedService() { $this->expectException('_PhpScoper5ea00cc67502b\\Psr\\Container\\NotFoundExceptionInterface'); $this->expectExceptionMessage('Service "dummy" not found: the container inside "Symfony\\Component\\DependencyInjection\\Tests\\ServiceLocatorTest" is a smaller service locator that only knows about the "foo" and "bar" services.'); - $locator = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator(['foo' => function () { + $locator = new ServiceLocator(['foo' => function () { return 'bar'; }, 'bar' => function () { return 'baz'; @@ -65,7 +67,7 @@ public function testThrowsOnUndefinedInternalService() { $this->expectException('_PhpScoper5ea00cc67502b\\Psr\\Container\\NotFoundExceptionInterface'); $this->expectExceptionMessage('The service "foo" has a dependency on a non-existent service "bar". This locator only knows about the "foo" service.'); - $locator = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator(['foo' => function () use(&$locator) { + $locator = new ServiceLocator(['foo' => function () use(&$locator) { return $locator->get('bar'); }]); $locator->get('foo'); @@ -74,7 +76,7 @@ public function testThrowsOnCircularReference() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\ServiceCircularReferenceException'); $this->expectExceptionMessage('Circular reference detected for service "bar", path: "bar -> baz -> bar".'); - $locator = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator(['foo' => function () use(&$locator) { + $locator = new ServiceLocator(['foo' => function () use(&$locator) { return $locator->get('bar'); }, 'bar' => function () use(&$locator) { return $locator->get('baz'); @@ -87,10 +89,10 @@ public function testThrowsInServiceSubscriber() { $this->expectException('_PhpScoper5ea00cc67502b\\Psr\\Container\\NotFoundExceptionInterface'); $this->expectExceptionMessage('Service "foo" not found: even though it exists in the app\'s container, the container inside "caller" is a smaller service locator that only knows about the "bar" service. Unless you need extra laziness, try using dependency injection instead. Otherwise, you need to declare it using "SomeServiceSubscriber::getSubscribedServices()".'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container(); - $container->set('foo', new \stdClass()); - $subscriber = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Tests\SomeServiceSubscriber(); - $subscriber->container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator(['bar' => function () { + $container = new Container(); + $container->set('foo', new stdClass()); + $subscriber = new SomeServiceSubscriber(); + $subscriber->container = new ServiceLocator(['bar' => function () { }]); $subscriber->container = $subscriber->container->withContext('caller', $container); $subscriber->getFoo(); @@ -99,15 +101,15 @@ public function testGetThrowsServiceNotFoundException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException'); $this->expectExceptionMessage('Service "foo" not found: even though it exists in the app\'s container, the container inside "foo" is a smaller service locator that is empty... Try using dependency injection instead.'); - $container = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Container(); - $container->set('foo', new \stdClass()); - $locator = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator([]); + $container = new Container(); + $container->set('foo', new stdClass()); + $locator = new ServiceLocator([]); $locator = $locator->withContext('foo', $container); $locator->get('foo'); } public function testInvoke() { - $locator = new \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceLocator(['foo' => function () { + $locator = new ServiceLocator(['foo' => function () { return 'bar'; }, 'bar' => function () { return 'baz'; @@ -117,7 +119,7 @@ public function testInvoke() $this->assertNull($locator('dummy'), '->__invoke() should return null on invalid service'); } } -class SomeServiceSubscriber implements \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ServiceSubscriberInterface +class SomeServiceSubscriber implements ServiceSubscriberInterface { public $container; public function getFoo() diff --git a/vendor/symfony/dependency-injection/Tests/index.php b/vendor/symfony/dependency-injection/Tests/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/dependency-injection/TypedReference.php b/vendor/symfony/dependency-injection/TypedReference.php index ca4a288ad..8c075f6cb 100644 --- a/vendor/symfony/dependency-injection/TypedReference.php +++ b/vendor/symfony/dependency-injection/TypedReference.php @@ -10,12 +10,15 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection; +use function strncasecmp; +use function strpos; + /** * Represents a PHP type-hinted service reference. * * @author Nicolas Grekas */ -class TypedReference extends \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\Reference +class TypedReference extends Reference { private $type; private $requiringClass; @@ -25,7 +28,7 @@ class TypedReference extends \_PhpScoper5ea00cc67502b\Symfony\Component\Dependen * @param string $requiringClass The class of the service that requires the referenced type * @param int $invalidBehavior The behavior when the service does not exist */ - public function __construct($id, $type, $requiringClass = '', $invalidBehavior = \_PhpScoper5ea00cc67502b\Symfony\Component\DependencyInjection\ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) + public function __construct($id, $type, $requiringClass = '', $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) { parent::__construct($id, $invalidBehavior); $this->type = $type; @@ -41,6 +44,6 @@ public function getRequiringClass() } public function canBeAutoregistered() { - return $this->requiringClass && \false !== ($i = \strpos($this->type, '\\')) && 0 === \strncasecmp($this->type, $this->requiringClass, 1 + $i); + return $this->requiringClass && false !== ($i = strpos($this->type, '\\')) && 0 === strncasecmp($this->type, $this->requiringClass, 1 + $i); } } diff --git a/vendor/symfony/dependency-injection/index.php b/vendor/symfony/dependency-injection/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/dependency-injection/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/expression-language/Compiler.php b/vendor/symfony/expression-language/Compiler.php index 42150ec2a..0e2ef1ed9 100644 --- a/vendor/symfony/expression-language/Compiler.php +++ b/vendor/symfony/expression-language/Compiler.php @@ -10,6 +10,16 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage; +use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node; +use function addcslashes; +use function is_array; +use function is_bool; +use function is_float; +use function is_int; +use function setlocale; +use function sprintf; +use const LC_NUMERIC; + /** * Compiles a node to PHP code. * @@ -46,12 +56,12 @@ public function reset() * * @return $this */ - public function compile(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node $node) + public function compile(Node $node) { $node->compile($this); return $this; } - public function subcompile(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node $node) + public function subcompile(Node $node) { $current = $this->source; $this->source = ''; @@ -81,7 +91,7 @@ public function raw($string) */ public function string($value) { - $this->source .= \sprintf('"%s"', \addcslashes($value, "\0\t\"\$\\")); + $this->source .= sprintf('"%s"', addcslashes($value, "\0\t\"\$\\")); return $this; } /** @@ -93,26 +103,26 @@ public function string($value) */ public function repr($value) { - if (\is_int($value) || \is_float($value)) { - if (\false !== ($locale = \setlocale(\LC_NUMERIC, 0))) { - \setlocale(\LC_NUMERIC, 'C'); + if (is_int($value) || is_float($value)) { + if (false !== ($locale = setlocale(LC_NUMERIC, 0))) { + setlocale(LC_NUMERIC, 'C'); } $this->raw($value); - if (\false !== $locale) { - \setlocale(\LC_NUMERIC, $locale); + if (false !== $locale) { + setlocale(LC_NUMERIC, $locale); } } elseif (null === $value) { $this->raw('null'); - } elseif (\is_bool($value)) { + } elseif (is_bool($value)) { $this->raw($value ? 'true' : 'false'); - } elseif (\is_array($value)) { + } elseif (is_array($value)) { $this->raw('['); - $first = \true; + $first = true; foreach ($value as $key => $value) { if (!$first) { $this->raw(', '); } - $first = \false; + $first = false; $this->repr($key); $this->raw(' => '); $this->repr($value); diff --git a/vendor/symfony/expression-language/ExpressionFunction.php b/vendor/symfony/expression-language/ExpressionFunction.php index 774cee130..3c0463987 100644 --- a/vendor/symfony/expression-language/ExpressionFunction.php +++ b/vendor/symfony/expression-language/ExpressionFunction.php @@ -10,6 +10,18 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage; +use InvalidArgumentException; +use function array_splice; +use function call_user_func_array; +use function count; +use function end; +use function explode; +use function func_get_args; +use function function_exists; +use function implode; +use function ltrim; +use function sprintf; + /** * Represents a function that can be used in an expression. * @@ -63,27 +75,27 @@ public function getEvaluator() * * @return self * - * @throws \InvalidArgumentException if given PHP function name does not exist - * @throws \InvalidArgumentException if given PHP function name is in namespace + * @throws InvalidArgumentException if given PHP function name does not exist + * @throws InvalidArgumentException if given PHP function name is in namespace * and expression function name is not defined */ public static function fromPhp($phpFunctionName, $expressionFunctionName = null) { - $phpFunctionName = \ltrim($phpFunctionName, '\\'); - if (!\function_exists($phpFunctionName)) { - throw new \InvalidArgumentException(\sprintf('PHP function "%s" does not exist.', $phpFunctionName)); + $phpFunctionName = ltrim($phpFunctionName, '\\'); + if (!function_exists($phpFunctionName)) { + throw new InvalidArgumentException(sprintf('PHP function "%s" does not exist.', $phpFunctionName)); } - $parts = \explode('\\', $phpFunctionName); - if (!$expressionFunctionName && \count($parts) > 1) { - throw new \InvalidArgumentException(\sprintf('An expression function name must be defined when PHP function "%s" is namespaced.', $phpFunctionName)); + $parts = explode('\\', $phpFunctionName); + if (!$expressionFunctionName && count($parts) > 1) { + throw new InvalidArgumentException(sprintf('An expression function name must be defined when PHP function "%s" is namespaced.', $phpFunctionName)); } $compiler = function () use($phpFunctionName) { - return \sprintf('\\%s(%s)', $phpFunctionName, \implode(', ', \func_get_args())); + return sprintf('\\%s(%s)', $phpFunctionName, implode(', ', func_get_args())); }; $evaluator = function () use($phpFunctionName) { - $args = \func_get_args(); - return \call_user_func_array($phpFunctionName, \array_splice($args, 1)); + $args = func_get_args(); + return call_user_func_array($phpFunctionName, array_splice($args, 1)); }; - return new self($expressionFunctionName ?: \end($parts), $compiler, $evaluator); + return new self($expressionFunctionName ?: end($parts), $compiler, $evaluator); } } diff --git a/vendor/symfony/expression-language/ExpressionLanguage.php b/vendor/symfony/expression-language/ExpressionLanguage.php index 5365c7450..630879c66 100644 --- a/vendor/symfony/expression-language/ExpressionLanguage.php +++ b/vendor/symfony/expression-language/ExpressionLanguage.php @@ -14,6 +14,17 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ArrayAdapter; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheAdapter; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface; +use InvalidArgumentException; +use LogicException; +use function array_keys; +use function asort; +use function implode; +use function is_int; +use function rawurlencode; +use function sprintf; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * Allows to compile and evaluate expressions written in your own DSL. * @@ -33,14 +44,14 @@ class ExpressionLanguage public function __construct($cache = null, array $providers = []) { if (null !== $cache) { - if ($cache instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface) { - @\trigger_error(\sprintf('Passing an instance of %s as constructor argument for %s is deprecated as of 3.2 and will be removed in 4.0. Pass an instance of %s instead.', \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface::class, self::class, \_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemPoolInterface::class), \E_USER_DEPRECATED); - $cache = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheAdapter($cache); - } elseif (!$cache instanceof \_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemPoolInterface) { - throw new \InvalidArgumentException(\sprintf('Cache argument has to implement "%s".', \_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemPoolInterface::class)); + if ($cache instanceof ParserCacheInterface) { + @trigger_error(sprintf('Passing an instance of %s as constructor argument for %s is deprecated as of 3.2 and will be removed in 4.0. Pass an instance of %s instead.', ParserCacheInterface::class, self::class, CacheItemPoolInterface::class), E_USER_DEPRECATED); + $cache = new ParserCacheAdapter($cache); + } elseif (!$cache instanceof CacheItemPoolInterface) { + throw new InvalidArgumentException(sprintf('Cache argument has to implement "%s".', CacheItemPoolInterface::class)); } } - $this->cache = $cache ?: new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\Adapter\ArrayAdapter(); + $this->cache = $cache ?: new ArrayAdapter(); $this->registerFunctions(); foreach ($providers as $provider) { $this->registerProvider($provider); @@ -68,7 +79,7 @@ public function compile($expression, $names = []) */ public function evaluate($expression, $values = []) { - return $this->parse($expression, \array_keys($values))->getNodes()->evaluate($this->functions, $values); + return $this->parse($expression, array_keys($values))->getNodes()->evaluate($this->functions, $values); } /** * Parses an expression. @@ -80,18 +91,18 @@ public function evaluate($expression, $values = []) */ public function parse($expression, $names) { - if ($expression instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParsedExpression) { + if ($expression instanceof ParsedExpression) { return $expression; } - \asort($names); + asort($names); $cacheKeyItems = []; foreach ($names as $nameKey => $name) { - $cacheKeyItems[] = \is_int($nameKey) ? $name : $nameKey . ':' . $name; + $cacheKeyItems[] = is_int($nameKey) ? $name : $nameKey . ':' . $name; } - $cacheItem = $this->cache->getItem(\rawurlencode($expression . '//' . \implode('|', $cacheKeyItems))); + $cacheItem = $this->cache->getItem(rawurlencode($expression . '//' . implode('|', $cacheKeyItems))); if (null === ($parsedExpression = $cacheItem->get())) { $nodes = $this->getParser()->parse($this->getLexer()->tokenize((string) $expression), $names); - $parsedExpression = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParsedExpression((string) $expression, $nodes); + $parsedExpression = new ParsedExpression((string) $expression, $nodes); $cacheItem->set($parsedExpression); $this->cache->save($cacheItem); } @@ -104,22 +115,22 @@ public function parse($expression, $names) * @param callable $compiler A callable able to compile the function * @param callable $evaluator A callable able to evaluate the function * - * @throws \LogicException when registering a function after calling evaluate(), compile() or parse() + * @throws LogicException when registering a function after calling evaluate(), compile() or parse() * * @see ExpressionFunction */ public function register($name, callable $compiler, callable $evaluator) { if (null !== $this->parser) { - throw new \LogicException('Registering functions after calling evaluate(), compile() or parse() is not supported.'); + throw new LogicException('Registering functions after calling evaluate(), compile() or parse() is not supported.'); } $this->functions[$name] = ['compiler' => $compiler, 'evaluator' => $evaluator]; } - public function addFunction(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionFunction $function) + public function addFunction(ExpressionFunction $function) { $this->register($function->getName(), $function->getCompiler(), $function->getEvaluator()); } - public function registerProvider(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface $provider) + public function registerProvider(ExpressionFunctionProviderInterface $provider) { foreach ($provider->getFunctions() as $function) { $this->addFunction($function); @@ -127,26 +138,26 @@ public function registerProvider(\_PhpScoper5ea00cc67502b\Symfony\Component\Expr } protected function registerFunctions() { - $this->addFunction(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionFunction::fromPhp('constant')); + $this->addFunction(ExpressionFunction::fromPhp('constant')); } private function getLexer() { if (null === $this->lexer) { - $this->lexer = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Lexer(); + $this->lexer = new Lexer(); } return $this->lexer; } private function getParser() { if (null === $this->parser) { - $this->parser = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Parser($this->functions); + $this->parser = new Parser($this->functions); } return $this->parser; } private function getCompiler() { if (null === $this->compiler) { - $this->compiler = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Compiler($this->functions); + $this->compiler = new Compiler($this->functions); } return $this->compiler->reset(); } diff --git a/vendor/symfony/expression-language/Lexer.php b/vendor/symfony/expression-language/Lexer.php index 1e9937a75..27f4b4dca 100644 --- a/vendor/symfony/expression-language/Lexer.php +++ b/vendor/symfony/expression-language/Lexer.php @@ -10,6 +10,17 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage; +use function array_pop; +use function preg_match; +use function sprintf; +use function str_replace; +use function stripcslashes; +use function strlen; +use function strpos; +use function strtr; +use function substr; +use const PHP_INT_MAX; + /** * Lexes an expression. * @@ -28,68 +39,68 @@ class Lexer */ public function tokenize($expression) { - $expression = \str_replace(["\r", "\n", "\t", "\v", "\f"], ' ', $expression); + $expression = str_replace(["\r", "\n", "\t", "\v", "\f"], ' ', $expression); $cursor = 0; $tokens = []; $brackets = []; - $end = \strlen($expression); + $end = strlen($expression); while ($cursor < $end) { if (' ' == $expression[$cursor]) { ++$cursor; continue; } - if (\preg_match('/[0-9]+(?:\\.[0-9]+)?/A', $expression, $match, 0, $cursor)) { + if (preg_match('/[0-9]+(?:\\.[0-9]+)?/A', $expression, $match, 0, $cursor)) { // numbers $number = (float) $match[0]; // floats - if (\preg_match('/^[0-9]+$/', $match[0]) && $number <= \PHP_INT_MAX) { + if (preg_match('/^[0-9]+$/', $match[0]) && $number <= PHP_INT_MAX) { $number = (int) $match[0]; // integers lower than the maximum } - $tokens[] = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::NUMBER_TYPE, $number, $cursor + 1); - $cursor += \strlen($match[0]); - } elseif (\false !== \strpos('([{', $expression[$cursor])) { + $tokens[] = new Token(Token::NUMBER_TYPE, $number, $cursor + 1); + $cursor += strlen($match[0]); + } elseif (false !== strpos('([{', $expression[$cursor])) { // opening bracket $brackets[] = [$expression[$cursor], $cursor]; - $tokens[] = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, $expression[$cursor], $cursor + 1); + $tokens[] = new Token(Token::PUNCTUATION_TYPE, $expression[$cursor], $cursor + 1); ++$cursor; - } elseif (\false !== \strpos(')]}', $expression[$cursor])) { + } elseif (false !== strpos(')]}', $expression[$cursor])) { // closing bracket if (empty($brackets)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\SyntaxError(\sprintf('Unexpected "%s".', $expression[$cursor]), $cursor, $expression); + throw new SyntaxError(sprintf('Unexpected "%s".', $expression[$cursor]), $cursor, $expression); } - list($expect, $cur) = \array_pop($brackets); - if ($expression[$cursor] != \strtr($expect, '([{', ')]}')) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\SyntaxError(\sprintf('Unclosed "%s".', $expect), $cur, $expression); + [$expect, $cur] = array_pop($brackets); + if ($expression[$cursor] != strtr($expect, '([{', ')]}')) { + throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $cur, $expression); } - $tokens[] = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, $expression[$cursor], $cursor + 1); + $tokens[] = new Token(Token::PUNCTUATION_TYPE, $expression[$cursor], $cursor + 1); ++$cursor; - } elseif (\preg_match('/"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/As', $expression, $match, 0, $cursor)) { + } elseif (preg_match('/"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/As', $expression, $match, 0, $cursor)) { // strings - $tokens[] = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::STRING_TYPE, \stripcslashes(\substr($match[0], 1, -1)), $cursor + 1); - $cursor += \strlen($match[0]); - } elseif (\preg_match('/(?<=^|[\\s(])not in(?=[\\s(])|\\!\\=\\=|(?<=^|[\\s(])not(?=[\\s(])|(?<=^|[\\s(])and(?=[\\s(])|\\=\\=\\=|\\>\\=|(?<=^|[\\s(])or(?=[\\s(])|\\<\\=|\\*\\*|\\.\\.|(?<=^|[\\s(])in(?=[\\s(])|&&|\\|\\||(?<=^|[\\s(])matches|\\=\\=|\\!\\=|\\*|~|%|\\/|\\>|\\||\\!|\\^|&|\\+|\\<|\\-/A', $expression, $match, 0, $cursor)) { + $tokens[] = new Token(Token::STRING_TYPE, stripcslashes(substr($match[0], 1, -1)), $cursor + 1); + $cursor += strlen($match[0]); + } elseif (preg_match('/(?<=^|[\\s(])not in(?=[\\s(])|\\!\\=\\=|(?<=^|[\\s(])not(?=[\\s(])|(?<=^|[\\s(])and(?=[\\s(])|\\=\\=\\=|\\>\\=|(?<=^|[\\s(])or(?=[\\s(])|\\<\\=|\\*\\*|\\.\\.|(?<=^|[\\s(])in(?=[\\s(])|&&|\\|\\||(?<=^|[\\s(])matches|\\=\\=|\\!\\=|\\*|~|%|\\/|\\>|\\||\\!|\\^|&|\\+|\\<|\\-/A', $expression, $match, 0, $cursor)) { // operators - $tokens[] = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::OPERATOR_TYPE, $match[0], $cursor + 1); - $cursor += \strlen($match[0]); - } elseif (\false !== \strpos('.,?:', $expression[$cursor])) { + $tokens[] = new Token(Token::OPERATOR_TYPE, $match[0], $cursor + 1); + $cursor += strlen($match[0]); + } elseif (false !== strpos('.,?:', $expression[$cursor])) { // punctuation - $tokens[] = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, $expression[$cursor], $cursor + 1); + $tokens[] = new Token(Token::PUNCTUATION_TYPE, $expression[$cursor], $cursor + 1); ++$cursor; - } elseif (\preg_match('/[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*/A', $expression, $match, 0, $cursor)) { + } elseif (preg_match('/[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*/A', $expression, $match, 0, $cursor)) { // names - $tokens[] = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::NAME_TYPE, $match[0], $cursor + 1); - $cursor += \strlen($match[0]); + $tokens[] = new Token(Token::NAME_TYPE, $match[0], $cursor + 1); + $cursor += strlen($match[0]); } else { // unlexable - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\SyntaxError(\sprintf('Unexpected character "%s".', $expression[$cursor]), $cursor, $expression); + throw new SyntaxError(sprintf('Unexpected character "%s".', $expression[$cursor]), $cursor, $expression); } } - $tokens[] = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::EOF_TYPE, null, $cursor + 1); + $tokens[] = new Token(Token::EOF_TYPE, null, $cursor + 1); if (!empty($brackets)) { - list($expect, $cur) = \array_pop($brackets); - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\SyntaxError(\sprintf('Unclosed "%s".', $expect), $cur, $expression); + [$expect, $cur] = array_pop($brackets); + throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $cur, $expression); } - return new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\TokenStream($tokens, $expression); + return new TokenStream($tokens, $expression); } } diff --git a/vendor/symfony/expression-language/Node/ArgumentsNode.php b/vendor/symfony/expression-language/Node/ArgumentsNode.php index a19b00333..3d40ed060 100644 --- a/vendor/symfony/expression-language/Node/ArgumentsNode.php +++ b/vendor/symfony/expression-language/Node/ArgumentsNode.php @@ -11,16 +11,18 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Compiler; +use function array_pop; + /** * @author Fabien Potencier * * @internal */ -class ArgumentsNode extends \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArrayNode +class ArgumentsNode extends ArrayNode { - public function compile(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Compiler $compiler) + public function compile(Compiler $compiler) { - $this->compileArguments($compiler, \false); + $this->compileArguments($compiler, false); } public function toArray() { @@ -29,7 +31,7 @@ public function toArray() $array[] = $pair['value']; $array[] = ', '; } - \array_pop($array); + array_pop($array); return $array; } } diff --git a/vendor/symfony/expression-language/Node/ArrayNode.php b/vendor/symfony/expression-language/Node/ArrayNode.php index 1241a0b6f..90a1249c4 100644 --- a/vendor/symfony/expression-language/Node/ArrayNode.php +++ b/vendor/symfony/expression-language/Node/ArrayNode.php @@ -11,29 +11,32 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Compiler; +use function array_chunk; +use function array_push; + /** * @author Fabien Potencier * * @internal */ -class ArrayNode extends \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node +class ArrayNode extends Node { protected $index; public function __construct() { $this->index = -1; } - public function addElement(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node $value, \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node $key = null) + public function addElement(Node $value, Node $key = null) { if (null === $key) { - $key = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(++$this->index); + $key = new ConstantNode(++$this->index); } - \array_push($this->nodes, $key, $value); + array_push($this->nodes, $key, $value); } /** * Compiles the node to PHP. */ - public function compile(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Compiler $compiler) + public function compile(Compiler $compiler) { $compiler->raw('['); $this->compileArguments($compiler); @@ -57,7 +60,7 @@ public function toArray() if ($this->isHash($value)) { foreach ($value as $k => $v) { $array[] = ', '; - $array[] = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode($k); + $array[] = new ConstantNode($k); $array[] = ': '; $array[] = $v; } @@ -76,19 +79,19 @@ public function toArray() protected function getKeyValuePairs() { $pairs = []; - foreach (\array_chunk($this->nodes, 2) as $pair) { + foreach (array_chunk($this->nodes, 2) as $pair) { $pairs[] = ['key' => $pair[0], 'value' => $pair[1]]; } return $pairs; } - protected function compileArguments(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Compiler $compiler, $withKeys = \true) + protected function compileArguments(Compiler $compiler, $withKeys = true) { - $first = \true; + $first = true; foreach ($this->getKeyValuePairs() as $pair) { if (!$first) { $compiler->raw(', '); } - $first = \false; + $first = false; if ($withKeys) { $compiler->compile($pair['key'])->raw(' => '); } diff --git a/vendor/symfony/expression-language/Node/BinaryNode.php b/vendor/symfony/expression-language/Node/BinaryNode.php index 3148b308c..9af8160ea 100644 --- a/vendor/symfony/expression-language/Node/BinaryNode.php +++ b/vendor/symfony/expression-language/Node/BinaryNode.php @@ -11,20 +11,25 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Compiler; +use DivisionByZeroError; +use function in_array; +use function preg_match; +use function sprintf; + /** * @author Fabien Potencier * * @internal */ -class BinaryNode extends \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node +class BinaryNode extends Node { private static $operators = ['~' => '.', 'and' => '&&', 'or' => '||']; private static $functions = ['**' => 'pow', '..' => 'range', 'in' => 'in_array', 'not in' => '!in_array']; - public function __construct($operator, \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node $left, \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node $right) + public function __construct($operator, Node $left, Node $right) { parent::__construct(['left' => $left, 'right' => $right], ['operator' => $operator]); } - public function compile(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Compiler $compiler) + public function compile(Compiler $compiler) { $operator = $this->attributes['operator']; if ('matches' == $operator) { @@ -32,7 +37,7 @@ public function compile(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLan return; } if (isset(self::$functions[$operator])) { - $compiler->raw(\sprintf('%s(', self::$functions[$operator]))->compile($this->nodes['left'])->raw(', ')->compile($this->nodes['right'])->raw(')'); + $compiler->raw(sprintf('%s(', self::$functions[$operator]))->compile($this->nodes['left'])->raw(', ')->compile($this->nodes['right'])->raw(')'); return; } if (isset(self::$operators[$operator])) { @@ -47,7 +52,7 @@ public function evaluate($functions, $values) if (isset(self::$functions[$operator])) { $right = $this->nodes['right']->evaluate($functions, $values); if ('not in' === $operator) { - return !\in_array($left, $right); + return !in_array($left, $right); } $f = self::$functions[$operator]; return $f($left, $right); @@ -85,9 +90,9 @@ public function evaluate($functions, $values) case '<=': return $left <= $right; case 'not in': - return !\in_array($left, $right); + return !in_array($left, $right); case 'in': - return \in_array($left, $right); + return in_array($left, $right); case '+': return $left + $right; case '-': @@ -98,16 +103,16 @@ public function evaluate($functions, $values) return $left * $right; case '/': if (0 == $right) { - throw new \DivisionByZeroError('Division by zero.'); + throw new DivisionByZeroError('Division by zero.'); } return $left / $right; case '%': if (0 == $right) { - throw new \DivisionByZeroError('Modulo by zero.'); + throw new DivisionByZeroError('Modulo by zero.'); } return $left % $right; case 'matches': - return \preg_match($right, $left); + return preg_match($right, $left); } } public function toArray() diff --git a/vendor/symfony/expression-language/Node/ConditionalNode.php b/vendor/symfony/expression-language/Node/ConditionalNode.php index 029f15673..19fe49c72 100644 --- a/vendor/symfony/expression-language/Node/ConditionalNode.php +++ b/vendor/symfony/expression-language/Node/ConditionalNode.php @@ -16,13 +16,13 @@ * * @internal */ -class ConditionalNode extends \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node +class ConditionalNode extends Node { - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node $expr1, \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node $expr2, \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node $expr3) + public function __construct(Node $expr1, Node $expr2, Node $expr3) { parent::__construct(['expr1' => $expr1, 'expr2' => $expr2, 'expr3' => $expr3]); } - public function compile(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Compiler $compiler) + public function compile(Compiler $compiler) { $compiler->raw('((')->compile($this->nodes['expr1'])->raw(') ? (')->compile($this->nodes['expr2'])->raw(') : (')->compile($this->nodes['expr3'])->raw('))'); } diff --git a/vendor/symfony/expression-language/Node/ConstantNode.php b/vendor/symfony/expression-language/Node/ConstantNode.php index ba1f87653..907dcd494 100644 --- a/vendor/symfony/expression-language/Node/ConstantNode.php +++ b/vendor/symfony/expression-language/Node/ConstantNode.php @@ -11,20 +11,23 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Compiler; +use function is_array; +use function is_numeric; + /** * @author Fabien Potencier * * @internal */ -class ConstantNode extends \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node +class ConstantNode extends Node { private $isIdentifier; - public function __construct($value, $isIdentifier = \false) + public function __construct($value, $isIdentifier = false) { $this->isIdentifier = $isIdentifier; parent::__construct([], ['value' => $value]); } - public function compile(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Compiler $compiler) + public function compile(Compiler $compiler) { $compiler->repr($this->attributes['value']); } @@ -38,15 +41,15 @@ public function toArray() $value = $this->attributes['value']; if ($this->isIdentifier) { $array[] = $value; - } elseif (\true === $value) { + } elseif (true === $value) { $array[] = 'true'; - } elseif (\false === $value) { + } elseif (false === $value) { $array[] = 'false'; } elseif (null === $value) { $array[] = 'null'; - } elseif (\is_numeric($value)) { + } elseif (is_numeric($value)) { $array[] = $value; - } elseif (!\is_array($value)) { + } elseif (!is_array($value)) { $array[] = $this->dumpString($value); } elseif ($this->isHash($value)) { foreach ($value as $k => $v) { diff --git a/vendor/symfony/expression-language/Node/FunctionNode.php b/vendor/symfony/expression-language/Node/FunctionNode.php index 40c4fc39d..a8e68651a 100644 --- a/vendor/symfony/expression-language/Node/FunctionNode.php +++ b/vendor/symfony/expression-language/Node/FunctionNode.php @@ -11,25 +11,27 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Compiler; +use function call_user_func_array; + /** * @author Fabien Potencier * * @internal */ -class FunctionNode extends \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node +class FunctionNode extends Node { - public function __construct($name, \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node $arguments) + public function __construct($name, Node $arguments) { parent::__construct(['arguments' => $arguments], ['name' => $name]); } - public function compile(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Compiler $compiler) + public function compile(Compiler $compiler) { $arguments = []; foreach ($this->nodes['arguments']->nodes as $node) { $arguments[] = $compiler->subcompile($node); } $function = $compiler->getFunction($this->attributes['name']); - $compiler->raw(\call_user_func_array($function['compiler'], $arguments)); + $compiler->raw(call_user_func_array($function['compiler'], $arguments)); } public function evaluate($functions, $values) { @@ -37,7 +39,7 @@ public function evaluate($functions, $values) foreach ($this->nodes['arguments']->nodes as $node) { $arguments[] = $node->evaluate($functions, $values); } - return \call_user_func_array($functions[$this->attributes['name']]['evaluator'], $arguments); + return call_user_func_array($functions[$this->attributes['name']]['evaluator'], $arguments); } public function toArray() { diff --git a/vendor/symfony/expression-language/Node/GetAttrNode.php b/vendor/symfony/expression-language/Node/GetAttrNode.php index 60a34e36d..da1ad0994 100644 --- a/vendor/symfony/expression-language/Node/GetAttrNode.php +++ b/vendor/symfony/expression-language/Node/GetAttrNode.php @@ -11,21 +11,30 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Compiler; +use ArrayAccess; +use RuntimeException; +use function call_user_func_array; +use function get_class; +use function is_array; +use function is_callable; +use function is_object; +use function sprintf; + /** * @author Fabien Potencier * * @internal */ -class GetAttrNode extends \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node +class GetAttrNode extends Node { const PROPERTY_CALL = 1; const METHOD_CALL = 2; const ARRAY_CALL = 3; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node $node, \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node $attribute, \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArrayNode $arguments, $type) + public function __construct(Node $node, Node $attribute, ArrayNode $arguments, $type) { parent::__construct(['node' => $node, 'attribute' => $attribute, 'arguments' => $arguments], ['type' => $type]); } - public function compile(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Compiler $compiler) + public function compile(Compiler $compiler) { switch ($this->attributes['type']) { case self::PROPERTY_CALL: @@ -44,24 +53,24 @@ public function evaluate($functions, $values) switch ($this->attributes['type']) { case self::PROPERTY_CALL: $obj = $this->nodes['node']->evaluate($functions, $values); - if (!\is_object($obj)) { - throw new \RuntimeException('Unable to get a property on a non-object.'); + if (!is_object($obj)) { + throw new RuntimeException('Unable to get a property on a non-object.'); } $property = $this->nodes['attribute']->attributes['value']; return $obj->{$property}; case self::METHOD_CALL: $obj = $this->nodes['node']->evaluate($functions, $values); - if (!\is_object($obj)) { - throw new \RuntimeException('Unable to get a property on a non-object.'); + if (!is_object($obj)) { + throw new RuntimeException('Unable to get a property on a non-object.'); } - if (!\is_callable($toCall = [$obj, $this->nodes['attribute']->attributes['value']])) { - throw new \RuntimeException(\sprintf('Unable to call method "%s" of object "%s".', $this->nodes['attribute']->attributes['value'], \get_class($obj))); + if (!is_callable($toCall = [$obj, $this->nodes['attribute']->attributes['value']])) { + throw new RuntimeException(sprintf('Unable to call method "%s" of object "%s".', $this->nodes['attribute']->attributes['value'], get_class($obj))); } - return \call_user_func_array($toCall, $this->nodes['arguments']->evaluate($functions, $values)); + return call_user_func_array($toCall, $this->nodes['arguments']->evaluate($functions, $values)); case self::ARRAY_CALL: $array = $this->nodes['node']->evaluate($functions, $values); - if (!\is_array($array) && !$array instanceof \ArrayAccess) { - throw new \RuntimeException('Unable to get an item on a non-array.'); + if (!is_array($array) && !$array instanceof ArrayAccess) { + throw new RuntimeException('Unable to get an item on a non-array.'); } return $array[$this->nodes['attribute']->evaluate($functions, $values)]; } diff --git a/vendor/symfony/expression-language/Node/NameNode.php b/vendor/symfony/expression-language/Node/NameNode.php index 2a5ec927b..a93be6ac6 100644 --- a/vendor/symfony/expression-language/Node/NameNode.php +++ b/vendor/symfony/expression-language/Node/NameNode.php @@ -16,13 +16,13 @@ * * @internal */ -class NameNode extends \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node +class NameNode extends Node { public function __construct($name) { parent::__construct([], ['name' => $name]); } - public function compile(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Compiler $compiler) + public function compile(Compiler $compiler) { $compiler->raw('$' . $this->attributes['name']); } diff --git a/vendor/symfony/expression-language/Node/Node.php b/vendor/symfony/expression-language/Node/Node.php index ae2c90c34..3dea04c56 100644 --- a/vendor/symfony/expression-language/Node/Node.php +++ b/vendor/symfony/expression-language/Node/Node.php @@ -11,6 +11,16 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Compiler; +use BadMethodCallException; +use function addcslashes; +use function count; +use function explode; +use function implode; +use function is_scalar; +use function sprintf; +use function str_replace; +use function var_export; + /** * Represents a node in the AST. * @@ -33,12 +43,12 @@ public function __toString() { $attributes = []; foreach ($this->attributes as $name => $value) { - $attributes[] = \sprintf('%s: %s', $name, \str_replace("\n", '', \var_export($value, \true))); + $attributes[] = sprintf('%s: %s', $name, str_replace("\n", '', var_export($value, true))); } - $repr = [\str_replace('Symfony\\Component\\ExpressionLanguage\\Node\\', '', static::class) . '(' . \implode(', ', $attributes)]; - if (\count($this->nodes)) { + $repr = [str_replace('Symfony\\Component\\ExpressionLanguage\\Node\\', '', static::class) . '(' . implode(', ', $attributes)]; + if (count($this->nodes)) { foreach ($this->nodes as $node) { - foreach (\explode("\n", (string) $node) as $line) { + foreach (explode("\n", (string) $node) as $line) { $repr[] = ' ' . $line; } } @@ -46,9 +56,9 @@ public function __toString() } else { $repr[0] .= ')'; } - return \implode("\n", $repr); + return implode("\n", $repr); } - public function compile(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Compiler $compiler) + public function compile(Compiler $compiler) { foreach ($this->nodes as $node) { $node->compile($compiler); @@ -64,28 +74,28 @@ public function evaluate($functions, $values) } public function toArray() { - throw new \BadMethodCallException(\sprintf('Dumping a "%s" instance is not supported yet.', static::class)); + throw new BadMethodCallException(sprintf('Dumping a "%s" instance is not supported yet.', static::class)); } public function dump() { $dump = ''; foreach ($this->toArray() as $v) { - $dump .= \is_scalar($v) ? $v : $v->dump(); + $dump .= is_scalar($v) ? $v : $v->dump(); } return $dump; } protected function dumpString($value) { - return \sprintf('"%s"', \addcslashes($value, "\0\t\"\\")); + return sprintf('"%s"', addcslashes($value, "\0\t\"\\")); } protected function isHash(array $value) { $expectedKey = 0; foreach ($value as $key => $val) { if ($key !== $expectedKey++) { - return \true; + return true; } } - return \false; + return false; } } diff --git a/vendor/symfony/expression-language/Node/UnaryNode.php b/vendor/symfony/expression-language/Node/UnaryNode.php index 8d66eba28..6f72c2bc9 100644 --- a/vendor/symfony/expression-language/Node/UnaryNode.php +++ b/vendor/symfony/expression-language/Node/UnaryNode.php @@ -16,14 +16,14 @@ * * @internal */ -class UnaryNode extends \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node +class UnaryNode extends Node { private static $operators = ['!' => '!', 'not' => '!', '+' => '+', '-' => '-']; - public function __construct($operator, \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node $node) + public function __construct($operator, Node $node) { parent::__construct(['node' => $node], ['operator' => $operator]); } - public function compile(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Compiler $compiler) + public function compile(Compiler $compiler) { $compiler->raw('(')->raw(self::$operators[$this->attributes['operator']])->compile($this->nodes['node'])->raw(')'); } diff --git a/vendor/symfony/expression-language/Node/index.php b/vendor/symfony/expression-language/Node/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/expression-language/Node/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/expression-language/ParsedExpression.php b/vendor/symfony/expression-language/ParsedExpression.php index 70fb11f9c..b4e1496b6 100644 --- a/vendor/symfony/expression-language/ParsedExpression.php +++ b/vendor/symfony/expression-language/ParsedExpression.php @@ -16,14 +16,14 @@ * * @author Fabien Potencier */ -class ParsedExpression extends \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression +class ParsedExpression extends Expression { private $nodes; /** * @param string $expression An expression * @param Node $nodes A Node representing the expression */ - public function __construct($expression, \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node $nodes) + public function __construct($expression, Node $nodes) { parent::__construct($expression); $this->nodes = $nodes; diff --git a/vendor/symfony/expression-language/Parser.php b/vendor/symfony/expression-language/Parser.php index 082c93715..08babb95b 100644 --- a/vendor/symfony/expression-language/Parser.php +++ b/vendor/symfony/expression-language/Parser.php @@ -10,6 +10,23 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage; +use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArgumentsNode; +use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArrayNode; +use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode; +use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConditionalNode; +use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode; +use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\FunctionNode; +use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode; +use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode; +use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node; +use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\UnaryNode; +use function array_keys; +use function array_search; +use function in_array; +use function is_int; +use function preg_match; +use function sprintf; + /** * Parsers a token stream. * @@ -55,13 +72,13 @@ public function __construct(array $functions) * * @throws SyntaxError */ - public function parse(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\TokenStream $stream, $names = []) + public function parse(TokenStream $stream, $names = []) { $this->stream = $stream; $this->names = $names; $node = $this->parseExpression(); if (!$stream->isEOF()) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\SyntaxError(\sprintf('Unexpected token "%s" of value "%s".', $stream->current->type, $stream->current->value), $stream->current->cursor, $stream->getExpression()); + throw new SyntaxError(sprintf('Unexpected token "%s" of value "%s".', $stream->current->type, $stream->current->value), $stream->current->cursor, $stream->getExpression()); } return $node; } @@ -69,11 +86,11 @@ public function parseExpression($precedence = 0) { $expr = $this->getPrimary(); $token = $this->stream->current; - while ($token->test(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::OPERATOR_TYPE) && isset($this->binaryOperators[$token->value]) && $this->binaryOperators[$token->value]['precedence'] >= $precedence) { + while ($token->test(Token::OPERATOR_TYPE) && isset($this->binaryOperators[$token->value]) && $this->binaryOperators[$token->value]['precedence'] >= $precedence) { $op = $this->binaryOperators[$token->value]; $this->stream->next(); $expr1 = $this->parseExpression(self::OPERATOR_LEFT === $op['associativity'] ? $op['precedence'] + 1 : $op['precedence']); - $expr = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode($token->value, $expr, $expr1); + $expr = new BinaryNode($token->value, $expr, $expr1); $token = $this->stream->current; } if (0 === $precedence) { @@ -84,38 +101,38 @@ public function parseExpression($precedence = 0) protected function getPrimary() { $token = $this->stream->current; - if ($token->test(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::OPERATOR_TYPE) && isset($this->unaryOperators[$token->value])) { + if ($token->test(Token::OPERATOR_TYPE) && isset($this->unaryOperators[$token->value])) { $operator = $this->unaryOperators[$token->value]; $this->stream->next(); $expr = $this->parseExpression($operator['precedence']); - return $this->parsePostfixExpression(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\UnaryNode($token->value, $expr)); + return $this->parsePostfixExpression(new UnaryNode($token->value, $expr)); } - if ($token->test(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, '(')) { + if ($token->test(Token::PUNCTUATION_TYPE, '(')) { $this->stream->next(); $expr = $this->parseExpression(); - $this->stream->expect(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, ')', 'An opened parenthesis is not properly closed'); + $this->stream->expect(Token::PUNCTUATION_TYPE, ')', 'An opened parenthesis is not properly closed'); return $this->parsePostfixExpression($expr); } return $this->parsePrimaryExpression(); } protected function parseConditionalExpression($expr) { - while ($this->stream->current->test(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, '?')) { + while ($this->stream->current->test(Token::PUNCTUATION_TYPE, '?')) { $this->stream->next(); - if (!$this->stream->current->test(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, ':')) { + if (!$this->stream->current->test(Token::PUNCTUATION_TYPE, ':')) { $expr2 = $this->parseExpression(); - if ($this->stream->current->test(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, ':')) { + if ($this->stream->current->test(Token::PUNCTUATION_TYPE, ':')) { $this->stream->next(); $expr3 = $this->parseExpression(); } else { - $expr3 = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(null); + $expr3 = new ConstantNode(null); } } else { $this->stream->next(); $expr2 = $expr; $expr3 = $this->parseExpression(); } - $expr = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConditionalNode($expr, $expr2, $expr3); + $expr = new ConditionalNode($expr, $expr2, $expr3); } return $expr; } @@ -123,134 +140,134 @@ public function parsePrimaryExpression() { $token = $this->stream->current; switch ($token->type) { - case \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::NAME_TYPE: + case Token::NAME_TYPE: $this->stream->next(); switch ($token->value) { case 'true': case 'TRUE': - return new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true); + return new ConstantNode(true); case 'false': case 'FALSE': - return new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\false); + return new ConstantNode(false); case 'null': case 'NULL': - return new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(null); + return new ConstantNode(null); default: if ('(' === $this->stream->current->value) { - if (\false === isset($this->functions[$token->value])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\SyntaxError(\sprintf('The function "%s" does not exist.', $token->value), $token->cursor, $this->stream->getExpression(), $token->value, \array_keys($this->functions)); + if (false === isset($this->functions[$token->value])) { + throw new SyntaxError(sprintf('The function "%s" does not exist.', $token->value), $token->cursor, $this->stream->getExpression(), $token->value, array_keys($this->functions)); } - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\FunctionNode($token->value, $this->parseArguments()); + $node = new FunctionNode($token->value, $this->parseArguments()); } else { - if (!\in_array($token->value, $this->names, \true)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\SyntaxError(\sprintf('Variable "%s" is not valid.', $token->value), $token->cursor, $this->stream->getExpression(), $token->value, $this->names); + if (!in_array($token->value, $this->names, true)) { + throw new SyntaxError(sprintf('Variable "%s" is not valid.', $token->value), $token->cursor, $this->stream->getExpression(), $token->value, $this->names); } // is the name used in the compiled code different // from the name used in the expression? - if (\is_int($name = \array_search($token->value, $this->names))) { + if (is_int($name = array_search($token->value, $this->names))) { $name = $token->value; } - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode($name); + $node = new NameNode($name); } } break; - case \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::NUMBER_TYPE: - case \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::STRING_TYPE: + case Token::NUMBER_TYPE: + case Token::STRING_TYPE: $this->stream->next(); - return new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode($token->value); + return new ConstantNode($token->value); default: - if ($token->test(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, '[')) { + if ($token->test(Token::PUNCTUATION_TYPE, '[')) { $node = $this->parseArrayExpression(); - } elseif ($token->test(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, '{')) { + } elseif ($token->test(Token::PUNCTUATION_TYPE, '{')) { $node = $this->parseHashExpression(); } else { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\SyntaxError(\sprintf('Unexpected token "%s" of value "%s".', $token->type, $token->value), $token->cursor, $this->stream->getExpression()); + throw new SyntaxError(sprintf('Unexpected token "%s" of value "%s".', $token->type, $token->value), $token->cursor, $this->stream->getExpression()); } } return $this->parsePostfixExpression($node); } public function parseArrayExpression() { - $this->stream->expect(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, '[', 'An array element was expected'); - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArrayNode(); - $first = \true; - while (!$this->stream->current->test(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, ']')) { + $this->stream->expect(Token::PUNCTUATION_TYPE, '[', 'An array element was expected'); + $node = new ArrayNode(); + $first = true; + while (!$this->stream->current->test(Token::PUNCTUATION_TYPE, ']')) { if (!$first) { - $this->stream->expect(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, ',', 'An array element must be followed by a comma'); + $this->stream->expect(Token::PUNCTUATION_TYPE, ',', 'An array element must be followed by a comma'); // trailing ,? - if ($this->stream->current->test(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, ']')) { + if ($this->stream->current->test(Token::PUNCTUATION_TYPE, ']')) { break; } } - $first = \false; + $first = false; $node->addElement($this->parseExpression()); } - $this->stream->expect(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, ']', 'An opened array is not properly closed'); + $this->stream->expect(Token::PUNCTUATION_TYPE, ']', 'An opened array is not properly closed'); return $node; } public function parseHashExpression() { - $this->stream->expect(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, '{', 'A hash element was expected'); - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArrayNode(); - $first = \true; - while (!$this->stream->current->test(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, '}')) { + $this->stream->expect(Token::PUNCTUATION_TYPE, '{', 'A hash element was expected'); + $node = new ArrayNode(); + $first = true; + while (!$this->stream->current->test(Token::PUNCTUATION_TYPE, '}')) { if (!$first) { - $this->stream->expect(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, ',', 'A hash value must be followed by a comma'); + $this->stream->expect(Token::PUNCTUATION_TYPE, ',', 'A hash value must be followed by a comma'); // trailing ,? - if ($this->stream->current->test(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, '}')) { + if ($this->stream->current->test(Token::PUNCTUATION_TYPE, '}')) { break; } } - $first = \false; + $first = false; // a hash key can be: // // * a number -- 12 // * a string -- 'a' // * a name, which is equivalent to a string -- a // * an expression, which must be enclosed in parentheses -- (1 + 2) - if ($this->stream->current->test(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::STRING_TYPE) || $this->stream->current->test(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::NAME_TYPE) || $this->stream->current->test(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::NUMBER_TYPE)) { - $key = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode($this->stream->current->value); + if ($this->stream->current->test(Token::STRING_TYPE) || $this->stream->current->test(Token::NAME_TYPE) || $this->stream->current->test(Token::NUMBER_TYPE)) { + $key = new ConstantNode($this->stream->current->value); $this->stream->next(); - } elseif ($this->stream->current->test(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, '(')) { + } elseif ($this->stream->current->test(Token::PUNCTUATION_TYPE, '(')) { $key = $this->parseExpression(); } else { $current = $this->stream->current; - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\SyntaxError(\sprintf('A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "%s" of value "%s".', $current->type, $current->value), $current->cursor, $this->stream->getExpression()); + throw new SyntaxError(sprintf('A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "%s" of value "%s".', $current->type, $current->value), $current->cursor, $this->stream->getExpression()); } - $this->stream->expect(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, ':', 'A hash key must be followed by a colon (:)'); + $this->stream->expect(Token::PUNCTUATION_TYPE, ':', 'A hash key must be followed by a colon (:)'); $value = $this->parseExpression(); $node->addElement($value, $key); } - $this->stream->expect(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, '}', 'An opened hash is not properly closed'); + $this->stream->expect(Token::PUNCTUATION_TYPE, '}', 'An opened hash is not properly closed'); return $node; } public function parsePostfixExpression($node) { $token = $this->stream->current; - while (\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE == $token->type) { + while (Token::PUNCTUATION_TYPE == $token->type) { if ('.' === $token->value) { $this->stream->next(); $token = $this->stream->current; $this->stream->next(); - if (\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::NAME_TYPE !== $token->type && (\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::OPERATOR_TYPE !== $token->type || !\preg_match('/[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*/A', $token->value))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\SyntaxError('Expected name.', $token->cursor, $this->stream->getExpression()); + if (Token::NAME_TYPE !== $token->type && (Token::OPERATOR_TYPE !== $token->type || !preg_match('/[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*/A', $token->value))) { + throw new SyntaxError('Expected name.', $token->cursor, $this->stream->getExpression()); } - $arg = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode($token->value, \true); - $arguments = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArgumentsNode(); - if ($this->stream->current->test(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, '(')) { - $type = \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::METHOD_CALL; + $arg = new ConstantNode($token->value, true); + $arguments = new ArgumentsNode(); + if ($this->stream->current->test(Token::PUNCTUATION_TYPE, '(')) { + $type = GetAttrNode::METHOD_CALL; foreach ($this->parseArguments()->nodes as $n) { $arguments->addElement($n); } } else { - $type = \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::PROPERTY_CALL; + $type = GetAttrNode::PROPERTY_CALL; } - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode($node, $arg, $arguments, $type); + $node = new GetAttrNode($node, $arg, $arguments, $type); } elseif ('[' === $token->value) { $this->stream->next(); $arg = $this->parseExpression(); - $this->stream->expect(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, ']'); - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode($node, $arg, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArgumentsNode(), \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::ARRAY_CALL); + $this->stream->expect(Token::PUNCTUATION_TYPE, ']'); + $node = new GetAttrNode($node, $arg, new ArgumentsNode(), GetAttrNode::ARRAY_CALL); } else { break; } @@ -264,14 +281,14 @@ public function parsePostfixExpression($node) public function parseArguments() { $args = []; - $this->stream->expect(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, '(', 'A list of arguments must begin with an opening parenthesis'); - while (!$this->stream->current->test(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, ')')) { + $this->stream->expect(Token::PUNCTUATION_TYPE, '(', 'A list of arguments must begin with an opening parenthesis'); + while (!$this->stream->current->test(Token::PUNCTUATION_TYPE, ')')) { if (!empty($args)) { - $this->stream->expect(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, ',', 'Arguments must be separated by a comma'); + $this->stream->expect(Token::PUNCTUATION_TYPE, ',', 'Arguments must be separated by a comma'); } $args[] = $this->parseExpression(); } - $this->stream->expect(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::PUNCTUATION_TYPE, ')', 'A list of arguments must be closed by a parenthesis'); - return new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node($args); + $this->stream->expect(Token::PUNCTUATION_TYPE, ')', 'A list of arguments must be closed by a parenthesis'); + return new Node($args); } } diff --git a/vendor/symfony/expression-language/ParserCache/ArrayParserCache.php b/vendor/symfony/expression-language/ParserCache/ArrayParserCache.php index e73c1beda..5da8fd3aa 100644 --- a/vendor/symfony/expression-language/ParserCache/ArrayParserCache.php +++ b/vendor/symfony/expression-language/ParserCache/ArrayParserCache.php @@ -10,14 +10,17 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParserCache; -@\trigger_error('The ' . __NAMESPACE__ . '\\ArrayParserCache class is deprecated since Symfony 3.2 and will be removed in 4.0. Use the Symfony\\Component\\Cache\\Adapter\\ArrayAdapter class instead.', \E_USER_DEPRECATED); +@trigger_error('The ' . __NAMESPACE__ . '\\ArrayParserCache class is deprecated since Symfony 3.2 and will be removed in 4.0. Use the Symfony\\Component\\Cache\\Adapter\\ArrayAdapter class instead.', E_USER_DEPRECATED); use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParsedExpression; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * @author Adrien Brault * * @deprecated ArrayParserCache class is deprecated since version 3.2 and will be removed in 4.0. Use the Symfony\Component\Cache\Adapter\ArrayAdapter class instead. */ -class ArrayParserCache implements \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface +class ArrayParserCache implements ParserCacheInterface { private $cache = []; /** @@ -30,7 +33,7 @@ public function fetch($key) /** * {@inheritdoc} */ - public function save($key, \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParsedExpression $expression) + public function save($key, ParsedExpression $expression) { $this->cache[$key] = $expression; } diff --git a/vendor/symfony/expression-language/ParserCache/ParserCacheAdapter.php b/vendor/symfony/expression-language/ParserCache/ParserCacheAdapter.php index ec638982e..55776da31 100644 --- a/vendor/symfony/expression-language/ParserCache/ParserCacheAdapter.php +++ b/vendor/symfony/expression-language/ParserCache/ParserCacheAdapter.php @@ -13,25 +13,28 @@ use _PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface; use _PhpScoper5ea00cc67502b\Psr\Cache\CacheItemPoolInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem; +use BadMethodCallException; +use Closure; + /** * @author Alexandre GESLIN * * @internal and will be removed in Symfony 4.0. */ -class ParserCacheAdapter implements \_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemPoolInterface +class ParserCacheAdapter implements CacheItemPoolInterface { private $pool; private $createCacheItem; - public function __construct(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface $pool) + public function __construct(ParserCacheInterface $pool) { $this->pool = $pool; - $this->createCacheItem = \Closure::bind(static function ($key, $value, $isHit) { - $item = new \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem(); + $this->createCacheItem = Closure::bind(static function ($key, $value, $isHit) { + $item = new CacheItem(); $item->key = $key; $item->value = $value; $item->isHit = $isHit; return $item; - }, null, \_PhpScoper5ea00cc67502b\Symfony\Component\Cache\CacheItem::class); + }, null, CacheItem::class); } /** * {@inheritdoc} @@ -45,7 +48,7 @@ public function getItem($key) /** * {@inheritdoc} */ - public function save(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item) + public function save(CacheItemInterface $item) { $this->pool->save($item->getKey(), $item->get()); } @@ -54,48 +57,48 @@ public function save(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item */ public function getItems(array $keys = []) { - throw new \BadMethodCallException('Not implemented.'); + throw new BadMethodCallException('Not implemented.'); } /** * {@inheritdoc} */ public function hasItem($key) { - throw new \BadMethodCallException('Not implemented.'); + throw new BadMethodCallException('Not implemented.'); } /** * {@inheritdoc} */ public function clear() { - throw new \BadMethodCallException('Not implemented.'); + throw new BadMethodCallException('Not implemented.'); } /** * {@inheritdoc} */ public function deleteItem($key) { - throw new \BadMethodCallException('Not implemented.'); + throw new BadMethodCallException('Not implemented.'); } /** * {@inheritdoc} */ public function deleteItems(array $keys) { - throw new \BadMethodCallException('Not implemented.'); + throw new BadMethodCallException('Not implemented.'); } /** * {@inheritdoc} */ - public function saveDeferred(\_PhpScoper5ea00cc67502b\Psr\Cache\CacheItemInterface $item) + public function saveDeferred(CacheItemInterface $item) { - throw new \BadMethodCallException('Not implemented.'); + throw new BadMethodCallException('Not implemented.'); } /** * {@inheritdoc} */ public function commit() { - throw new \BadMethodCallException('Not implemented.'); + throw new BadMethodCallException('Not implemented.'); } } diff --git a/vendor/symfony/expression-language/ParserCache/ParserCacheInterface.php b/vendor/symfony/expression-language/ParserCache/ParserCacheInterface.php index 2e72ba023..b0e8c6838 100644 --- a/vendor/symfony/expression-language/ParserCache/ParserCacheInterface.php +++ b/vendor/symfony/expression-language/ParserCache/ParserCacheInterface.php @@ -10,8 +10,11 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParserCache; -@\trigger_error('The ' . __NAMESPACE__ . '\\ParserCacheInterface interface is deprecated since Symfony 3.2 and will be removed in 4.0. Use Psr\\Cache\\CacheItemPoolInterface instead.', \E_USER_DEPRECATED); +@trigger_error('The ' . __NAMESPACE__ . '\\ParserCacheInterface interface is deprecated since Symfony 3.2 and will be removed in 4.0. Use Psr\\Cache\\CacheItemPoolInterface instead.', E_USER_DEPRECATED); use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParsedExpression; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * @author Adrien Brault * @@ -25,7 +28,7 @@ interface ParserCacheInterface * @param string $key The cache key * @param ParsedExpression $expression A ParsedExpression instance to store in the cache */ - public function save($key, \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParsedExpression $expression); + public function save($key, ParsedExpression $expression); /** * Fetches an expression from the cache. * diff --git a/vendor/symfony/expression-language/ParserCache/index.php b/vendor/symfony/expression-language/ParserCache/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/expression-language/ParserCache/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/expression-language/Resources/bin/generate_operator_regex.php b/vendor/symfony/expression-language/Resources/bin/generate_operator_regex.php index 280451388..d949f390d 100644 --- a/vendor/symfony/expression-language/Resources/bin/generate_operator_regex.php +++ b/vendor/symfony/expression-language/Resources/bin/generate_operator_regex.php @@ -10,14 +10,21 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + +use function array_combine; +use function array_map; +use function arsort; +use function implode; +use function preg_quote; + $operators = ['not', '!', 'or', '||', '&&', 'and', '|', '^', '&', '==', '===', '!=', '!==', '<', '>', '>=', '<=', 'not in', 'in', '..', '+', '-', '~', '*', '/', '%', 'matches', '**']; -$operators = \array_combine($operators, \array_map('strlen', $operators)); -\arsort($operators); +$operators = array_combine($operators, array_map('strlen', $operators)); +arsort($operators); $regex = []; foreach ($operators as $operator => $length) { // Collisions of character operators: // - an operator that begins with a character must have a space or a parenthesis before or starting at the beginning of a string // - an operator that ends with a character must be followed by a whitespace or a parenthesis - $regex[] = (\ctype_alpha($operator[0]) ? '(?<=^|[\\s(])' : '') . \preg_quote($operator, '/') . (\ctype_alpha($operator[$length - 1]) ? '(?=[\\s(])' : ''); + $regex[] = (\ctype_alpha($operator[0]) ? '(?<=^|[\\s(])' : '') . preg_quote($operator, '/') . (\ctype_alpha($operator[$length - 1]) ? '(?=[\\s(])' : ''); } -echo '/' . \implode('|', $regex) . '/A'; +echo '/' . implode('|', $regex) . '/A'; diff --git a/vendor/symfony/expression-language/Resources/bin/index.php b/vendor/symfony/expression-language/Resources/bin/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/expression-language/Resources/bin/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/expression-language/Resources/index.php b/vendor/symfony/expression-language/Resources/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/expression-language/Resources/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/expression-language/SerializedParsedExpression.php b/vendor/symfony/expression-language/SerializedParsedExpression.php index 15930dd24..1e7166079 100644 --- a/vendor/symfony/expression-language/SerializedParsedExpression.php +++ b/vendor/symfony/expression-language/SerializedParsedExpression.php @@ -10,12 +10,14 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage; +use function unserialize; + /** * Represents an already parsed expression. * * @author Fabien Potencier */ -class SerializedParsedExpression extends \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParsedExpression +class SerializedParsedExpression extends ParsedExpression { private $nodes; /** @@ -29,6 +31,6 @@ public function __construct($expression, $nodes) } public function getNodes() { - return \unserialize($this->nodes); + return unserialize($this->nodes); } } diff --git a/vendor/symfony/expression-language/SyntaxError.php b/vendor/symfony/expression-language/SyntaxError.php index 8c2cf73f7..141fdb653 100644 --- a/vendor/symfony/expression-language/SyntaxError.php +++ b/vendor/symfony/expression-language/SyntaxError.php @@ -10,26 +10,32 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage; -class SyntaxError extends \LogicException +use LogicException; +use function levenshtein; +use function rtrim; +use function sprintf; +use const INF; + +class SyntaxError extends LogicException { public function __construct($message, $cursor = 0, $expression = '', $subject = null, array $proposals = null) { - $message = \sprintf('%s around position %d', \rtrim($message, '.'), $cursor); + $message = sprintf('%s around position %d', rtrim($message, '.'), $cursor); if ($expression) { - $message = \sprintf('%s for expression `%s`', $message, $expression); + $message = sprintf('%s for expression `%s`', $message, $expression); } $message .= '.'; if (null !== $subject && null !== $proposals) { - $minScore = \INF; + $minScore = INF; foreach ($proposals as $proposal) { - $distance = \levenshtein($subject, $proposal); + $distance = levenshtein($subject, $proposal); if ($distance < $minScore) { $guess = $proposal; $minScore = $distance; } } if (isset($guess) && $minScore < 3) { - $message .= \sprintf(' Did you mean "%s"?', $guess); + $message .= sprintf(' Did you mean "%s"?', $guess); } } parent::__construct($message); diff --git a/vendor/symfony/expression-language/Tests/ExpressionFunctionTest.php b/vendor/symfony/expression-language/Tests/ExpressionFunctionTest.php index d806a27e3..f693ef954 100644 --- a/vendor/symfony/expression-language/Tests/ExpressionFunctionTest.php +++ b/vendor/symfony/expression-language/Tests/ExpressionFunctionTest.php @@ -17,19 +17,19 @@ * * @author Dany Maillard */ -class ExpressionFunctionTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class ExpressionFunctionTest extends TestCase { public function testFunctionDoesNotExist() { $this->expectException('InvalidArgumentException'); $this->expectExceptionMessage('PHP function "fn_does_not_exist" does not exist.'); - \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionFunction::fromPhp('fn_does_not_exist'); + ExpressionFunction::fromPhp('fn_does_not_exist'); } public function testFunctionNamespaced() { $this->expectException('InvalidArgumentException'); $this->expectExceptionMessage('An expression function name must be defined when PHP function "Symfony\\Component\\ExpressionLanguage\\Tests\\fn_namespaced" is namespaced.'); - \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionFunction::fromPhp('_PhpScoper5ea00cc67502b\\Symfony\\Component\\ExpressionLanguage\\Tests\\fn_namespaced'); + ExpressionFunction::fromPhp('_PhpScoper5ea00cc67502b\\Symfony\\Component\\ExpressionLanguage\\Tests\\fn_namespaced'); } } function fn_namespaced() diff --git a/vendor/symfony/expression-language/Tests/ExpressionLanguageTest.php b/vendor/symfony/expression-language/Tests/ExpressionLanguageTest.php index 09185b93c..1c6ec040e 100644 --- a/vendor/symfony/expression-language/Tests/ExpressionLanguageTest.php +++ b/vendor/symfony/expression-language/Tests/ExpressionLanguageTest.php @@ -15,19 +15,23 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionLanguage; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParsedExpression; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Tests\Fixtures\TestProvider; -class ExpressionLanguageTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use stdClass; +use function sprintf; +use const PHP_VERSION; + +class ExpressionLanguageTest extends TestCase { public function testCachedParse() { $cacheMock = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Psr\\Cache\\CacheItemPoolInterface')->getMock(); $cacheItemMock = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Psr\\Cache\\CacheItemInterface')->getMock(); $savedParsedExpression = null; - $expressionLanguage = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionLanguage($cacheMock); + $expressionLanguage = new ExpressionLanguage($cacheMock); $cacheMock->expects($this->exactly(2))->method('getItem')->with('1%20%2B%201%2F%2F')->willReturn($cacheItemMock); $cacheItemMock->expects($this->exactly(2))->method('get')->willReturnCallback(function () use(&$savedParsedExpression) { return $savedParsedExpression; }); - $cacheItemMock->expects($this->exactly(1))->method('set')->with($this->isInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParsedExpression::class))->willReturnCallback(function ($parsedExpression) use(&$savedParsedExpression) { + $cacheItemMock->expects($this->exactly(1))->method('set')->with($this->isInstanceOf(ParsedExpression::class))->willReturnCallback(function ($parsedExpression) use(&$savedParsedExpression) { $savedParsedExpression = $parsedExpression; }); $cacheMock->expects($this->exactly(1))->method('save')->with($cacheItemMock); @@ -43,9 +47,9 @@ public function testCachedParseWithDeprecatedParserCacheInterface() { $cacheMock = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\ExpressionLanguage\\ParserCache\\ParserCacheInterface')->getMock(); $savedParsedExpression = null; - $expressionLanguage = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionLanguage($cacheMock); + $expressionLanguage = new ExpressionLanguage($cacheMock); $cacheMock->expects($this->exactly(1))->method('fetch')->with('1%20%2B%201%2F%2F')->willReturn($savedParsedExpression); - $cacheMock->expects($this->exactly(1))->method('save')->with('1%20%2B%201%2F%2F', $this->isInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParsedExpression::class))->willReturnCallback(function ($key, $expression) use(&$savedParsedExpression) { + $cacheMock->expects($this->exactly(1))->method('save')->with('1%20%2B%201%2F%2F', $this->isInstanceOf(ParsedExpression::class))->willReturnCallback(function ($key, $expression) use(&$savedParsedExpression) { $savedParsedExpression = $expression; }); $parsedExpression = $expressionLanguage->parse('1 + 1', []); @@ -56,18 +60,18 @@ public function testWrongCacheImplementation() $this->expectException('InvalidArgumentException'); $this->expectExceptionMessage('Cache argument has to implement "Psr\\Cache\\CacheItemPoolInterface".'); $cacheMock = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Psr\\Cache\\CacheItemSpoolInterface')->getMock(); - new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionLanguage($cacheMock); + new ExpressionLanguage($cacheMock); } public function testConstantFunction() { - $expressionLanguage = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionLanguage(); - $this->assertEquals(\PHP_VERSION, $expressionLanguage->evaluate('constant("PHP_VERSION")')); - $expressionLanguage = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionLanguage(); + $expressionLanguage = new ExpressionLanguage(); + $this->assertEquals(PHP_VERSION, $expressionLanguage->evaluate('constant("PHP_VERSION")')); + $expressionLanguage = new ExpressionLanguage(); $this->assertEquals('\\constant("PHP_VERSION")', $expressionLanguage->compile('constant("PHP_VERSION")')); } public function testProviders() { - $expressionLanguage = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionLanguage(null, [new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Tests\Fixtures\TestProvider()]); + $expressionLanguage = new ExpressionLanguage(null, [new TestProvider()]); $this->assertEquals('foo', $expressionLanguage->evaluate('identity("foo")')); $this->assertEquals('"foo"', $expressionLanguage->compile('identity("foo")')); $this->assertEquals('FOO', $expressionLanguage->evaluate('strtoupper("foo")')); @@ -82,7 +86,7 @@ public function testProviders() */ public function testShortCircuitOperatorsEvaluate($expression, array $values, $expected) { - $expressionLanguage = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionLanguage(); + $expressionLanguage = new ExpressionLanguage(); $this->assertEquals($expected, $expressionLanguage->evaluate($expression, $values)); } /** @@ -91,30 +95,30 @@ public function testShortCircuitOperatorsEvaluate($expression, array $values, $e public function testShortCircuitOperatorsCompile($expression, array $names, $expected) { $result = null; - $expressionLanguage = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionLanguage(); - eval(\sprintf('$result = %s;', $expressionLanguage->compile($expression, $names))); + $expressionLanguage = new ExpressionLanguage(); + eval(sprintf('$result = %s;', $expressionLanguage->compile($expression, $names))); $this->assertSame($expected, $result); } public function testParseThrowsInsteadOfNotice() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\ExpressionLanguage\\SyntaxError'); $this->expectExceptionMessage('Unexpected end of expression around position 6 for expression `node.`.'); - $expressionLanguage = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionLanguage(); + $expressionLanguage = new ExpressionLanguage(); $expressionLanguage->parse('node.', ['node']); } public function shortCircuitProviderEvaluate() { $object = $this->getMockBuilder('stdClass')->setMethods(['foo'])->getMock(); $object->expects($this->never())->method('foo'); - return [['false and object.foo()', ['object' => $object], \false], ['false && object.foo()', ['object' => $object], \false], ['true || object.foo()', ['object' => $object], \true], ['true or object.foo()', ['object' => $object], \true]]; + return [['false and object.foo()', ['object' => $object], false], ['false && object.foo()', ['object' => $object], false], ['true || object.foo()', ['object' => $object], true], ['true or object.foo()', ['object' => $object], true]]; } public function shortCircuitProviderCompile() { - return [['false and foo', ['foo' => 'foo'], \false], ['false && foo', ['foo' => 'foo'], \false], ['true || foo', ['foo' => 'foo'], \true], ['true or foo', ['foo' => 'foo'], \true]]; + return [['false and foo', ['foo' => 'foo'], false], ['false && foo', ['foo' => 'foo'], false], ['true || foo', ['foo' => 'foo'], true], ['true or foo', ['foo' => 'foo'], true]]; } public function testCachingForOverriddenVariableNames() { - $expressionLanguage = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionLanguage(); + $expressionLanguage = new ExpressionLanguage(); $expression = 'a + b'; $expressionLanguage->evaluate($expression, ['a' => 1, 'b' => 1]); $result = $expressionLanguage->compile($expression, ['a', 'B' => 'b']); @@ -122,7 +126,7 @@ public function testCachingForOverriddenVariableNames() } public function testStrictEquality() { - $expressionLanguage = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionLanguage(); + $expressionLanguage = new ExpressionLanguage(); $expression = '123 === a'; $result = $expressionLanguage->compile($expression, ['a']); $this->assertSame('(123 === $a)', $result); @@ -131,13 +135,13 @@ public function testCachingWithDifferentNamesOrder() { $cacheMock = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Psr\\Cache\\CacheItemPoolInterface')->getMock(); $cacheItemMock = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Psr\\Cache\\CacheItemInterface')->getMock(); - $expressionLanguage = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionLanguage($cacheMock); + $expressionLanguage = new ExpressionLanguage($cacheMock); $savedParsedExpression = null; $cacheMock->expects($this->exactly(2))->method('getItem')->with('a%20%2B%20b%2F%2Fa%7CB%3Ab')->willReturn($cacheItemMock); $cacheItemMock->expects($this->exactly(2))->method('get')->willReturnCallback(function () use(&$savedParsedExpression) { return $savedParsedExpression; }); - $cacheItemMock->expects($this->exactly(1))->method('set')->with($this->isInstanceOf(\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParsedExpression::class))->willReturnCallback(function ($parsedExpression) use(&$savedParsedExpression) { + $cacheItemMock->expects($this->exactly(1))->method('set')->with($this->isInstanceOf(ParsedExpression::class))->willReturnCallback(function ($parsedExpression) use(&$savedParsedExpression) { $savedParsedExpression = $parsedExpression; }); $cacheMock->expects($this->exactly(1))->method('save')->with($cacheItemMock); @@ -147,7 +151,7 @@ public function testCachingWithDifferentNamesOrder() } public function testOperatorCollisions() { - $expressionLanguage = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionLanguage(); + $expressionLanguage = new ExpressionLanguage(); $expression = 'foo.not in [bar]'; $compiled = $expressionLanguage->compile($expression, ['foo', 'bar']); $this->assertSame('in_array($foo->not, [0 => $bar])', $compiled); @@ -160,7 +164,7 @@ public function testOperatorCollisions() public function testRegisterAfterParse($registerCallback) { $this->expectException('LogicException'); - $el = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionLanguage(); + $el = new ExpressionLanguage(); $el->parse('1 + 1', []); $registerCallback($el); } @@ -170,7 +174,7 @@ public function testRegisterAfterParse($registerCallback) public function testRegisterAfterEval($registerCallback) { $this->expectException('LogicException'); - $el = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionLanguage(); + $el = new ExpressionLanguage(); $el->evaluate('1 + 1'); $registerCallback($el); } @@ -178,8 +182,8 @@ public function testCallBadCallable() { $this->expectException('RuntimeException'); $this->expectExceptionMessageRegExp('/Unable to call method "\\w+" of object "\\w+"./'); - $el = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionLanguage(); - $el->evaluate('foo.myfunction()', ['foo' => new \stdClass()]); + $el = new ExpressionLanguage(); + $el->evaluate('foo.myfunction()', ['foo' => new stdClass()]); } /** * @dataProvider getRegisterCallbacks @@ -187,22 +191,22 @@ public function testCallBadCallable() public function testRegisterAfterCompile($registerCallback) { $this->expectException('LogicException'); - $el = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionLanguage(); + $el = new ExpressionLanguage(); $el->compile('1 + 1'); $registerCallback($el); } public function getRegisterCallbacks() { - return [[function (\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionLanguage $el) { + return [[function (ExpressionLanguage $el) { $el->register('fn', function () { }, function () { }); - }], [function (\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionLanguage $el) { - $el->addFunction(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionFunction('fn', function () { + }], [function (ExpressionLanguage $el) { + $el->addFunction(new ExpressionFunction('fn', function () { }, function () { })); - }], [function (\_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionLanguage $el) { - $el->registerProvider(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Tests\Fixtures\TestProvider()); + }], [function (ExpressionLanguage $el) { + $el->registerProvider(new TestProvider()); }]]; } } diff --git a/vendor/symfony/expression-language/Tests/ExpressionTest.php b/vendor/symfony/expression-language/Tests/ExpressionTest.php index 6a5642e9e..ff776995d 100644 --- a/vendor/symfony/expression-language/Tests/ExpressionTest.php +++ b/vendor/symfony/expression-language/Tests/ExpressionTest.php @@ -12,13 +12,16 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression; -class ExpressionTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use function serialize; +use function unserialize; + +class ExpressionTest extends TestCase { public function testSerialization() { - $expression = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Expression('kernel.boot()'); - $serializedExpression = \serialize($expression); - $unserializedExpression = \unserialize($serializedExpression); + $expression = new Expression('kernel.boot()'); + $serializedExpression = serialize($expression); + $unserializedExpression = unserialize($serializedExpression); $this->assertEquals($expression, $unserializedExpression); } } diff --git a/vendor/symfony/expression-language/Tests/Fixtures/TestProvider.php b/vendor/symfony/expression-language/Tests/Fixtures/TestProvider.php index dccc86a51..588406d29 100644 --- a/vendor/symfony/expression-language/Tests/Fixtures/TestProvider.php +++ b/vendor/symfony/expression-language/Tests/Fixtures/TestProvider.php @@ -13,18 +13,18 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionFunction; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionPhpFunction; -class TestProvider implements \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface +class TestProvider implements ExpressionFunctionProviderInterface { public function getFunctions() { - return [new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionFunction('identity', function ($input) { + return [new ExpressionFunction('identity', function ($input) { return $input; }, function (array $values, $input) { return $input; - }), \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionFunction::fromPhp('strtoupper'), \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionFunction::fromPhp('\\strtolower'), \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ExpressionFunction::fromPhp('_PhpScoper5ea00cc67502b\\Symfony\\Component\\ExpressionLanguage\\Tests\\Fixtures\\fn_namespaced', 'fn_namespaced')]; + }), ExpressionFunction::fromPhp('strtoupper'), ExpressionFunction::fromPhp('\\strtolower'), ExpressionFunction::fromPhp('_PhpScoper5ea00cc67502b\\Symfony\\Component\\ExpressionLanguage\\Tests\\Fixtures\\fn_namespaced', 'fn_namespaced')]; } } function fn_namespaced() { - return \true; + return true; } diff --git a/vendor/symfony/expression-language/Tests/Fixtures/index.php b/vendor/symfony/expression-language/Tests/Fixtures/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/expression-language/Tests/Fixtures/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/expression-language/Tests/LexerTest.php b/vendor/symfony/expression-language/Tests/LexerTest.php index 7e0092910..1a06802d8 100644 --- a/vendor/symfony/expression-language/Tests/LexerTest.php +++ b/vendor/symfony/expression-language/Tests/LexerTest.php @@ -14,7 +14,9 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Lexer; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\TokenStream; -class LexerTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use function strlen; + +class LexerTest extends TestCase { /** * @var Lexer @@ -22,15 +24,15 @@ class LexerTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase private $lexer; protected function setUp() { - $this->lexer = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Lexer(); + $this->lexer = new Lexer(); } /** * @dataProvider getTokenizeData */ public function testTokenize($tokens, $expression) { - $tokens[] = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('end of expression', null, \strlen($expression) + 1); - $this->assertEquals(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\TokenStream($tokens, $expression), $this->lexer->tokenize($expression)); + $tokens[] = new Token('end of expression', null, strlen($expression) + 1); + $this->assertEquals(new TokenStream($tokens, $expression), $this->lexer->tokenize($expression)); } public function testTokenizeThrowsErrorWithMessage() { @@ -48,6 +50,6 @@ public function testTokenizeThrowsErrorOnUnclosedBrace() } public function getTokenizeData() { - return [[[new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('name', 'a', 3)], ' a '], [[new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('name', 'a', 1)], 'a'], [[new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('string', 'foo', 1)], '"foo"'], [[new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('number', '3', 1)], '3'], [[new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('operator', '+', 1)], '+'], [[new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('punctuation', '.', 1)], '.'], [[new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('punctuation', '(', 1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('number', '3', 2), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('operator', '+', 4), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('number', '5', 6), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('punctuation', ')', 7), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('operator', '~', 9), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('name', 'foo', 11), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('punctuation', '(', 14), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('string', 'bar', 15), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('punctuation', ')', 20), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('punctuation', '.', 21), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('name', 'baz', 22), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('punctuation', '[', 25), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('number', '4', 26), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('punctuation', ']', 27)], '(3 + 5) ~ foo("bar").baz[4]'], [[new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('operator', '..', 1)], '..'], [[new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('string', '#foo', 1)], "'#foo'"], [[new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('string', '#foo', 1)], '"#foo"'], [[new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('name', 'foo', 1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('punctuation', '.', 4), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('name', 'not', 5), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('operator', 'in', 9), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('punctuation', '[', 12), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('name', 'bar', 13), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token('punctuation', ']', 16)], 'foo.not in [bar]']]; + return [[[new Token('name', 'a', 3)], ' a '], [[new Token('name', 'a', 1)], 'a'], [[new Token('string', 'foo', 1)], '"foo"'], [[new Token('number', '3', 1)], '3'], [[new Token('operator', '+', 1)], '+'], [[new Token('punctuation', '.', 1)], '.'], [[new Token('punctuation', '(', 1), new Token('number', '3', 2), new Token('operator', '+', 4), new Token('number', '5', 6), new Token('punctuation', ')', 7), new Token('operator', '~', 9), new Token('name', 'foo', 11), new Token('punctuation', '(', 14), new Token('string', 'bar', 15), new Token('punctuation', ')', 20), new Token('punctuation', '.', 21), new Token('name', 'baz', 22), new Token('punctuation', '[', 25), new Token('number', '4', 26), new Token('punctuation', ']', 27)], '(3 + 5) ~ foo("bar").baz[4]'], [[new Token('operator', '..', 1)], '..'], [[new Token('string', '#foo', 1)], "'#foo'"], [[new Token('string', '#foo', 1)], '"#foo"'], [[new Token('name', 'foo', 1), new Token('punctuation', '.', 4), new Token('name', 'not', 5), new Token('operator', 'in', 9), new Token('punctuation', '[', 12), new Token('name', 'bar', 13), new Token('punctuation', ']', 16)], 'foo.not in [bar]']]; } } diff --git a/vendor/symfony/expression-language/Tests/Node/AbstractNodeTest.php b/vendor/symfony/expression-language/Tests/Node/AbstractNodeTest.php index a27a191ea..1f89b8f67 100644 --- a/vendor/symfony/expression-language/Tests/Node/AbstractNodeTest.php +++ b/vendor/symfony/expression-language/Tests/Node/AbstractNodeTest.php @@ -12,7 +12,7 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Compiler; -abstract class AbstractNodeTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +abstract class AbstractNodeTest extends TestCase { /** * @dataProvider getEvaluateData @@ -27,7 +27,7 @@ public abstract function getEvaluateData(); */ public function testCompile($expected, $node, $functions = []) { - $compiler = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Compiler($functions); + $compiler = new Compiler($functions); $node->compile($compiler); $this->assertSame($expected, $compiler->getSource()); } diff --git a/vendor/symfony/expression-language/Tests/Node/ArgumentsNodeTest.php b/vendor/symfony/expression-language/Tests/Node/ArgumentsNodeTest.php index f320bcfa1..339c0cdc8 100644 --- a/vendor/symfony/expression-language/Tests/Node/ArgumentsNodeTest.php +++ b/vendor/symfony/expression-language/Tests/Node/ArgumentsNodeTest.php @@ -11,7 +11,7 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Tests\Node; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArgumentsNode; -class ArgumentsNodeTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Tests\Node\ArrayNodeTest +class ArgumentsNodeTest extends ArrayNodeTest { public function getCompileData() { @@ -23,6 +23,6 @@ public function getDumpData() } protected function createArrayNode() { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArgumentsNode(); + return new ArgumentsNode(); } } diff --git a/vendor/symfony/expression-language/Tests/Node/ArrayNodeTest.php b/vendor/symfony/expression-language/Tests/Node/ArrayNodeTest.php index 859d5ba0b..01e155dd9 100644 --- a/vendor/symfony/expression-language/Tests/Node/ArrayNodeTest.php +++ b/vendor/symfony/expression-language/Tests/Node/ArrayNodeTest.php @@ -12,14 +12,17 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArrayNode; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode; -class ArrayNodeTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Tests\Node\AbstractNodeTest +use function serialize; +use function unserialize; + +class ArrayNodeTest extends AbstractNodeTest { public function testSerialization() { $node = $this->createArrayNode(); - $node->addElement(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('foo')); - $serializedNode = \serialize($node); - $unserializedNode = \unserialize($serializedNode); + $node->addElement(new ConstantNode('foo')); + $serializedNode = serialize($node); + $unserializedNode = unserialize($serializedNode); $this->assertEquals($node, $unserializedNode); $this->assertNotEquals($this->createArrayNode(), $unserializedNode); } @@ -35,23 +38,23 @@ public function getDumpData() { (yield ['{"b": "a", 0: "b"}', $this->getArrayNode()]); $array = $this->createArrayNode(); - $array->addElement(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('c'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('a"b')); - $array->addElement(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('d'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('_PhpScoper5ea00cc67502b\\a\\b')); + $array->addElement(new ConstantNode('c'), new ConstantNode('a"b')); + $array->addElement(new ConstantNode('d'), new ConstantNode('_PhpScoper5ea00cc67502b\\a\\b')); (yield ['{"a\\"b": "c", "a\\\\b": "d"}', $array]); $array = $this->createArrayNode(); - $array->addElement(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('c')); - $array->addElement(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('d')); + $array->addElement(new ConstantNode('c')); + $array->addElement(new ConstantNode('d')); (yield ['["c", "d"]', $array]); } protected function getArrayNode() { $array = $this->createArrayNode(); - $array->addElement(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('a'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('b')); - $array->addElement(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('b')); + $array->addElement(new ConstantNode('a'), new ConstantNode('b')); + $array->addElement(new ConstantNode('b')); return $array; } protected function createArrayNode() { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArrayNode(); + return new ArrayNode(); } } diff --git a/vendor/symfony/expression-language/Tests/Node/BinaryNodeTest.php b/vendor/symfony/expression-language/Tests/Node/BinaryNodeTest.php index c69d7e986..580ce27fc 100644 --- a/vendor/symfony/expression-language/Tests/Node/BinaryNodeTest.php +++ b/vendor/symfony/expression-language/Tests/Node/BinaryNodeTest.php @@ -13,27 +13,27 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArrayNode; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode; -class BinaryNodeTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Tests\Node\AbstractNodeTest +class BinaryNodeTest extends AbstractNodeTest { public function getEvaluateData() { - $array = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArrayNode(); - $array->addElement(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('a')); - $array->addElement(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('b')); - return [[\true, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('or', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\false))], [\true, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('||', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\false))], [\false, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('and', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\false))], [\false, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('&&', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\false))], [0, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('&', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(4))], [6, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('|', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(4))], [6, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('^', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(4))], [\true, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('<', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], [\true, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('<=', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], [\true, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('<=', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1))], [\false, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('>', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], [\false, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('>=', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], [\true, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('>=', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1))], [\true, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('===', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true))], [\false, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('!==', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true))], [\false, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('==', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1))], [\true, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('!=', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1))], [-1, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('-', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], [3, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('+', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], [4, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('*', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], [1, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('/', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], [1, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('%', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(5), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], [25, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('**', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(5), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], ['ab', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('~', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('a'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('b'))], [\true, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('in', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('a'), $array)], [\false, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('in', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('c'), $array)], [\true, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('not in', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('c'), $array)], [\false, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('not in', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('a'), $array)], [[1, 2, 3], new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('..', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(3))], [1, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('matches', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('abc'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('/^[a-z]+$/'))]]; + $array = new ArrayNode(); + $array->addElement(new ConstantNode('a')); + $array->addElement(new ConstantNode('b')); + return [[true, new BinaryNode('or', new ConstantNode(true), new ConstantNode(false))], [true, new BinaryNode('||', new ConstantNode(true), new ConstantNode(false))], [false, new BinaryNode('and', new ConstantNode(true), new ConstantNode(false))], [false, new BinaryNode('&&', new ConstantNode(true), new ConstantNode(false))], [0, new BinaryNode('&', new ConstantNode(2), new ConstantNode(4))], [6, new BinaryNode('|', new ConstantNode(2), new ConstantNode(4))], [6, new BinaryNode('^', new ConstantNode(2), new ConstantNode(4))], [true, new BinaryNode('<', new ConstantNode(1), new ConstantNode(2))], [true, new BinaryNode('<=', new ConstantNode(1), new ConstantNode(2))], [true, new BinaryNode('<=', new ConstantNode(1), new ConstantNode(1))], [false, new BinaryNode('>', new ConstantNode(1), new ConstantNode(2))], [false, new BinaryNode('>=', new ConstantNode(1), new ConstantNode(2))], [true, new BinaryNode('>=', new ConstantNode(1), new ConstantNode(1))], [true, new BinaryNode('===', new ConstantNode(true), new ConstantNode(true))], [false, new BinaryNode('!==', new ConstantNode(true), new ConstantNode(true))], [false, new BinaryNode('==', new ConstantNode(2), new ConstantNode(1))], [true, new BinaryNode('!=', new ConstantNode(2), new ConstantNode(1))], [-1, new BinaryNode('-', new ConstantNode(1), new ConstantNode(2))], [3, new BinaryNode('+', new ConstantNode(1), new ConstantNode(2))], [4, new BinaryNode('*', new ConstantNode(2), new ConstantNode(2))], [1, new BinaryNode('/', new ConstantNode(2), new ConstantNode(2))], [1, new BinaryNode('%', new ConstantNode(5), new ConstantNode(2))], [25, new BinaryNode('**', new ConstantNode(5), new ConstantNode(2))], ['ab', new BinaryNode('~', new ConstantNode('a'), new ConstantNode('b'))], [true, new BinaryNode('in', new ConstantNode('a'), $array)], [false, new BinaryNode('in', new ConstantNode('c'), $array)], [true, new BinaryNode('not in', new ConstantNode('c'), $array)], [false, new BinaryNode('not in', new ConstantNode('a'), $array)], [[1, 2, 3], new BinaryNode('..', new ConstantNode(1), new ConstantNode(3))], [1, new BinaryNode('matches', new ConstantNode('abc'), new ConstantNode('/^[a-z]+$/'))]]; } public function getCompileData() { - $array = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArrayNode(); - $array->addElement(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('a')); - $array->addElement(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('b')); - return [['(true || false)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('or', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\false))], ['(true || false)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('||', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\false))], ['(true && false)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('and', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\false))], ['(true && false)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('&&', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\false))], ['(2 & 4)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('&', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(4))], ['(2 | 4)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('|', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(4))], ['(2 ^ 4)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('^', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(4))], ['(1 < 2)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('<', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], ['(1 <= 2)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('<=', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], ['(1 <= 1)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('<=', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1))], ['(1 > 2)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('>', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], ['(1 >= 2)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('>=', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], ['(1 >= 1)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('>=', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1))], ['(true === true)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('===', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true))], ['(true !== true)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('!==', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true))], ['(2 == 1)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('==', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1))], ['(2 != 1)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('!=', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1))], ['(1 - 2)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('-', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], ['(1 + 2)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('+', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], ['(2 * 2)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('*', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], ['(2 / 2)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('/', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], ['(5 % 2)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('%', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(5), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], ['pow(5, 2)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('**', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(5), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], ['("a" . "b")', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('~', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('a'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('b'))], ['in_array("a", [0 => "a", 1 => "b"])', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('in', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('a'), $array)], ['in_array("c", [0 => "a", 1 => "b"])', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('in', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('c'), $array)], ['!in_array("c", [0 => "a", 1 => "b"])', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('not in', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('c'), $array)], ['!in_array("a", [0 => "a", 1 => "b"])', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('not in', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('a'), $array)], ['range(1, 3)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('..', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(3))], ['preg_match("/^[a-z]+/i\\$/", "abc")', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('matches', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('abc'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('/^[a-z]+/i$/'))]]; + $array = new ArrayNode(); + $array->addElement(new ConstantNode('a')); + $array->addElement(new ConstantNode('b')); + return [['(true || false)', new BinaryNode('or', new ConstantNode(true), new ConstantNode(false))], ['(true || false)', new BinaryNode('||', new ConstantNode(true), new ConstantNode(false))], ['(true && false)', new BinaryNode('and', new ConstantNode(true), new ConstantNode(false))], ['(true && false)', new BinaryNode('&&', new ConstantNode(true), new ConstantNode(false))], ['(2 & 4)', new BinaryNode('&', new ConstantNode(2), new ConstantNode(4))], ['(2 | 4)', new BinaryNode('|', new ConstantNode(2), new ConstantNode(4))], ['(2 ^ 4)', new BinaryNode('^', new ConstantNode(2), new ConstantNode(4))], ['(1 < 2)', new BinaryNode('<', new ConstantNode(1), new ConstantNode(2))], ['(1 <= 2)', new BinaryNode('<=', new ConstantNode(1), new ConstantNode(2))], ['(1 <= 1)', new BinaryNode('<=', new ConstantNode(1), new ConstantNode(1))], ['(1 > 2)', new BinaryNode('>', new ConstantNode(1), new ConstantNode(2))], ['(1 >= 2)', new BinaryNode('>=', new ConstantNode(1), new ConstantNode(2))], ['(1 >= 1)', new BinaryNode('>=', new ConstantNode(1), new ConstantNode(1))], ['(true === true)', new BinaryNode('===', new ConstantNode(true), new ConstantNode(true))], ['(true !== true)', new BinaryNode('!==', new ConstantNode(true), new ConstantNode(true))], ['(2 == 1)', new BinaryNode('==', new ConstantNode(2), new ConstantNode(1))], ['(2 != 1)', new BinaryNode('!=', new ConstantNode(2), new ConstantNode(1))], ['(1 - 2)', new BinaryNode('-', new ConstantNode(1), new ConstantNode(2))], ['(1 + 2)', new BinaryNode('+', new ConstantNode(1), new ConstantNode(2))], ['(2 * 2)', new BinaryNode('*', new ConstantNode(2), new ConstantNode(2))], ['(2 / 2)', new BinaryNode('/', new ConstantNode(2), new ConstantNode(2))], ['(5 % 2)', new BinaryNode('%', new ConstantNode(5), new ConstantNode(2))], ['pow(5, 2)', new BinaryNode('**', new ConstantNode(5), new ConstantNode(2))], ['("a" . "b")', new BinaryNode('~', new ConstantNode('a'), new ConstantNode('b'))], ['in_array("a", [0 => "a", 1 => "b"])', new BinaryNode('in', new ConstantNode('a'), $array)], ['in_array("c", [0 => "a", 1 => "b"])', new BinaryNode('in', new ConstantNode('c'), $array)], ['!in_array("c", [0 => "a", 1 => "b"])', new BinaryNode('not in', new ConstantNode('c'), $array)], ['!in_array("a", [0 => "a", 1 => "b"])', new BinaryNode('not in', new ConstantNode('a'), $array)], ['range(1, 3)', new BinaryNode('..', new ConstantNode(1), new ConstantNode(3))], ['preg_match("/^[a-z]+/i\\$/", "abc")', new BinaryNode('matches', new ConstantNode('abc'), new ConstantNode('/^[a-z]+/i$/'))]]; } public function getDumpData() { - $array = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArrayNode(); - $array->addElement(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('a')); - $array->addElement(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('b')); - return [['(true or false)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('or', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\false))], ['(true || false)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('||', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\false))], ['(true and false)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('and', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\false))], ['(true && false)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('&&', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\false))], ['(2 & 4)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('&', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(4))], ['(2 | 4)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('|', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(4))], ['(2 ^ 4)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('^', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(4))], ['(1 < 2)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('<', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], ['(1 <= 2)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('<=', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], ['(1 <= 1)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('<=', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1))], ['(1 > 2)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('>', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], ['(1 >= 2)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('>=', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], ['(1 >= 1)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('>=', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1))], ['(true === true)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('===', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true))], ['(true !== true)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('!==', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true))], ['(2 == 1)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('==', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1))], ['(2 != 1)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('!=', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1))], ['(1 - 2)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('-', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], ['(1 + 2)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('+', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], ['(2 * 2)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('*', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], ['(2 / 2)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('/', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], ['(5 % 2)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('%', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(5), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], ['(5 ** 2)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('**', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(5), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], ['("a" ~ "b")', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('~', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('a'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('b'))], ['("a" in ["a", "b"])', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('in', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('a'), $array)], ['("c" in ["a", "b"])', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('in', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('c'), $array)], ['("c" not in ["a", "b"])', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('not in', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('c'), $array)], ['("a" not in ["a", "b"])', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('not in', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('a'), $array)], ['(1 .. 3)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('..', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(3))], ['("abc" matches "/^[a-z]+/i$/")', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('matches', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('abc'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('/^[a-z]+/i$/'))]]; + $array = new ArrayNode(); + $array->addElement(new ConstantNode('a')); + $array->addElement(new ConstantNode('b')); + return [['(true or false)', new BinaryNode('or', new ConstantNode(true), new ConstantNode(false))], ['(true || false)', new BinaryNode('||', new ConstantNode(true), new ConstantNode(false))], ['(true and false)', new BinaryNode('and', new ConstantNode(true), new ConstantNode(false))], ['(true && false)', new BinaryNode('&&', new ConstantNode(true), new ConstantNode(false))], ['(2 & 4)', new BinaryNode('&', new ConstantNode(2), new ConstantNode(4))], ['(2 | 4)', new BinaryNode('|', new ConstantNode(2), new ConstantNode(4))], ['(2 ^ 4)', new BinaryNode('^', new ConstantNode(2), new ConstantNode(4))], ['(1 < 2)', new BinaryNode('<', new ConstantNode(1), new ConstantNode(2))], ['(1 <= 2)', new BinaryNode('<=', new ConstantNode(1), new ConstantNode(2))], ['(1 <= 1)', new BinaryNode('<=', new ConstantNode(1), new ConstantNode(1))], ['(1 > 2)', new BinaryNode('>', new ConstantNode(1), new ConstantNode(2))], ['(1 >= 2)', new BinaryNode('>=', new ConstantNode(1), new ConstantNode(2))], ['(1 >= 1)', new BinaryNode('>=', new ConstantNode(1), new ConstantNode(1))], ['(true === true)', new BinaryNode('===', new ConstantNode(true), new ConstantNode(true))], ['(true !== true)', new BinaryNode('!==', new ConstantNode(true), new ConstantNode(true))], ['(2 == 1)', new BinaryNode('==', new ConstantNode(2), new ConstantNode(1))], ['(2 != 1)', new BinaryNode('!=', new ConstantNode(2), new ConstantNode(1))], ['(1 - 2)', new BinaryNode('-', new ConstantNode(1), new ConstantNode(2))], ['(1 + 2)', new BinaryNode('+', new ConstantNode(1), new ConstantNode(2))], ['(2 * 2)', new BinaryNode('*', new ConstantNode(2), new ConstantNode(2))], ['(2 / 2)', new BinaryNode('/', new ConstantNode(2), new ConstantNode(2))], ['(5 % 2)', new BinaryNode('%', new ConstantNode(5), new ConstantNode(2))], ['(5 ** 2)', new BinaryNode('**', new ConstantNode(5), new ConstantNode(2))], ['("a" ~ "b")', new BinaryNode('~', new ConstantNode('a'), new ConstantNode('b'))], ['("a" in ["a", "b"])', new BinaryNode('in', new ConstantNode('a'), $array)], ['("c" in ["a", "b"])', new BinaryNode('in', new ConstantNode('c'), $array)], ['("c" not in ["a", "b"])', new BinaryNode('not in', new ConstantNode('c'), $array)], ['("a" not in ["a", "b"])', new BinaryNode('not in', new ConstantNode('a'), $array)], ['(1 .. 3)', new BinaryNode('..', new ConstantNode(1), new ConstantNode(3))], ['("abc" matches "/^[a-z]+/i$/")', new BinaryNode('matches', new ConstantNode('abc'), new ConstantNode('/^[a-z]+/i$/'))]]; } } diff --git a/vendor/symfony/expression-language/Tests/Node/ConditionalNodeTest.php b/vendor/symfony/expression-language/Tests/Node/ConditionalNodeTest.php index bbbbcc1f1..f7146499b 100644 --- a/vendor/symfony/expression-language/Tests/Node/ConditionalNodeTest.php +++ b/vendor/symfony/expression-language/Tests/Node/ConditionalNodeTest.php @@ -12,18 +12,18 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConditionalNode; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode; -class ConditionalNodeTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Tests\Node\AbstractNodeTest +class ConditionalNodeTest extends AbstractNodeTest { public function getEvaluateData() { - return [[1, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConditionalNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], [2, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConditionalNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\false), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))]]; + return [[1, new ConditionalNode(new ConstantNode(true), new ConstantNode(1), new ConstantNode(2))], [2, new ConditionalNode(new ConstantNode(false), new ConstantNode(1), new ConstantNode(2))]]; } public function getCompileData() { - return [['((true) ? (1) : (2))', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConditionalNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], ['((false) ? (1) : (2))', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConditionalNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\false), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))]]; + return [['((true) ? (1) : (2))', new ConditionalNode(new ConstantNode(true), new ConstantNode(1), new ConstantNode(2))], ['((false) ? (1) : (2))', new ConditionalNode(new ConstantNode(false), new ConstantNode(1), new ConstantNode(2))]]; } public function getDumpData() { - return [['(true ? 1 : 2)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConditionalNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))], ['(false ? 1 : 2)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConditionalNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\false), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2))]]; + return [['(true ? 1 : 2)', new ConditionalNode(new ConstantNode(true), new ConstantNode(1), new ConstantNode(2))], ['(false ? 1 : 2)', new ConditionalNode(new ConstantNode(false), new ConstantNode(1), new ConstantNode(2))]]; } } diff --git a/vendor/symfony/expression-language/Tests/Node/ConstantNodeTest.php b/vendor/symfony/expression-language/Tests/Node/ConstantNodeTest.php index 1ed279aa1..b9fa58308 100644 --- a/vendor/symfony/expression-language/Tests/Node/ConstantNodeTest.php +++ b/vendor/symfony/expression-language/Tests/Node/ConstantNodeTest.php @@ -11,18 +11,18 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Tests\Node; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode; -class ConstantNodeTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Tests\Node\AbstractNodeTest +class ConstantNodeTest extends AbstractNodeTest { public function getEvaluateData() { - return [[\false, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\false)], [\true, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true)], [null, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(null)], [3, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(3)], [3.3, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(3.3)], ['foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('foo')], [[1, 'b' => 'a'], new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode([1, 'b' => 'a'])]]; + return [[false, new ConstantNode(false)], [true, new ConstantNode(true)], [null, new ConstantNode(null)], [3, new ConstantNode(3)], [3.3, new ConstantNode(3.3)], ['foo', new ConstantNode('foo')], [[1, 'b' => 'a'], new ConstantNode([1, 'b' => 'a'])]]; } public function getCompileData() { - return [['false', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\false)], ['true', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true)], ['null', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(null)], ['3', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(3)], ['3.3', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(3.3)], ['"foo"', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('foo')], ['[0 => 1, "b" => "a"]', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode([1, 'b' => 'a'])]]; + return [['false', new ConstantNode(false)], ['true', new ConstantNode(true)], ['null', new ConstantNode(null)], ['3', new ConstantNode(3)], ['3.3', new ConstantNode(3.3)], ['"foo"', new ConstantNode('foo')], ['[0 => 1, "b" => "a"]', new ConstantNode([1, 'b' => 'a'])]]; } public function getDumpData() { - return [['false', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\false)], ['true', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true)], ['null', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(null)], ['3', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(3)], ['3.3', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(3.3)], ['"foo"', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('foo')], ['foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('foo', \true)], ['{0: 1, "b": "a", 1: true}', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode([1, 'b' => 'a', \true])], ['{"a\\"b": "c", "a\\\\b": "d"}', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(['a"b' => 'c', '_PhpScoper5ea00cc67502b\\a\\b' => 'd'])], ['["c", "d"]', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(['c', 'd'])], ['{"a": ["b"]}', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(['a' => ['b']])]]; + return [['false', new ConstantNode(false)], ['true', new ConstantNode(true)], ['null', new ConstantNode(null)], ['3', new ConstantNode(3)], ['3.3', new ConstantNode(3.3)], ['"foo"', new ConstantNode('foo')], ['foo', new ConstantNode('foo', true)], ['{0: 1, "b": "a", 1: true}', new ConstantNode([1, 'b' => 'a', true])], ['{"a\\"b": "c", "a\\\\b": "d"}', new ConstantNode(['a"b' => 'c', '_PhpScoper5ea00cc67502b\\a\\b' => 'd'])], ['["c", "d"]', new ConstantNode(['c', 'd'])], ['{"a": ["b"]}', new ConstantNode(['a' => ['b']])]]; } } diff --git a/vendor/symfony/expression-language/Tests/Node/FunctionNodeTest.php b/vendor/symfony/expression-language/Tests/Node/FunctionNodeTest.php index f88fad8bf..a57c41154 100644 --- a/vendor/symfony/expression-language/Tests/Node/FunctionNodeTest.php +++ b/vendor/symfony/expression-language/Tests/Node/FunctionNodeTest.php @@ -13,24 +13,26 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\FunctionNode; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node; -class FunctionNodeTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Tests\Node\AbstractNodeTest +use function sprintf; + +class FunctionNodeTest extends AbstractNodeTest { public function getEvaluateData() { - return [['bar', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\FunctionNode('foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node([new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('bar')])), [], ['foo' => $this->getCallables()]]]; + return [['bar', new FunctionNode('foo', new Node([new ConstantNode('bar')])), [], ['foo' => $this->getCallables()]]]; } public function getCompileData() { - return [['foo("bar")', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\FunctionNode('foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node([new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('bar')])), ['foo' => $this->getCallables()]]]; + return [['foo("bar")', new FunctionNode('foo', new Node([new ConstantNode('bar')])), ['foo' => $this->getCallables()]]]; } public function getDumpData() { - return [['foo("bar")', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\FunctionNode('foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node([new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('bar')])), ['foo' => $this->getCallables()]]]; + return [['foo("bar")', new FunctionNode('foo', new Node([new ConstantNode('bar')])), ['foo' => $this->getCallables()]]]; } protected function getCallables() { return ['compiler' => function ($arg) { - return \sprintf('foo(%s)', $arg); + return sprintf('foo(%s)', $arg); }, 'evaluator' => function ($variables, $arg) { return $arg; }]; diff --git a/vendor/symfony/expression-language/Tests/Node/GetAttrNodeTest.php b/vendor/symfony/expression-language/Tests/Node/GetAttrNodeTest.php index 5ea226864..6df281780 100644 --- a/vendor/symfony/expression-language/Tests/Node/GetAttrNodeTest.php +++ b/vendor/symfony/expression-language/Tests/Node/GetAttrNodeTest.php @@ -14,25 +14,25 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode; -class GetAttrNodeTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Tests\Node\AbstractNodeTest +class GetAttrNodeTest extends AbstractNodeTest { public function getEvaluateData() { - return [['b', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(0), $this->getArrayNode(), \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::ARRAY_CALL), ['foo' => ['b' => 'a', 'b']]], ['a', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('b'), $this->getArrayNode(), \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::ARRAY_CALL), ['foo' => ['b' => 'a', 'b']]], ['bar', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('foo'), $this->getArrayNode(), \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::PROPERTY_CALL), ['foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Tests\Node\Obj()]], ['baz', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('foo'), $this->getArrayNode(), \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::METHOD_CALL), ['foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Tests\Node\Obj()]], ['a', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('index'), $this->getArrayNode(), \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::ARRAY_CALL), ['foo' => ['b' => 'a', 'b'], 'index' => 'b']]]; + return [['b', new GetAttrNode(new NameNode('foo'), new ConstantNode(0), $this->getArrayNode(), GetAttrNode::ARRAY_CALL), ['foo' => ['b' => 'a', 'b']]], ['a', new GetAttrNode(new NameNode('foo'), new ConstantNode('b'), $this->getArrayNode(), GetAttrNode::ARRAY_CALL), ['foo' => ['b' => 'a', 'b']]], ['bar', new GetAttrNode(new NameNode('foo'), new ConstantNode('foo'), $this->getArrayNode(), GetAttrNode::PROPERTY_CALL), ['foo' => new Obj()]], ['baz', new GetAttrNode(new NameNode('foo'), new ConstantNode('foo'), $this->getArrayNode(), GetAttrNode::METHOD_CALL), ['foo' => new Obj()]], ['a', new GetAttrNode(new NameNode('foo'), new NameNode('index'), $this->getArrayNode(), GetAttrNode::ARRAY_CALL), ['foo' => ['b' => 'a', 'b'], 'index' => 'b']]]; } public function getCompileData() { - return [['$foo[0]', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(0), $this->getArrayNode(), \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::ARRAY_CALL)], ['$foo["b"]', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('b'), $this->getArrayNode(), \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::ARRAY_CALL)], ['$foo->foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('foo'), $this->getArrayNode(), \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::PROPERTY_CALL), ['foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Tests\Node\Obj()]], ['$foo->foo(["b" => "a", 0 => "b"])', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('foo'), $this->getArrayNode(), \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::METHOD_CALL), ['foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Tests\Node\Obj()]], ['$foo[$index]', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('index'), $this->getArrayNode(), \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::ARRAY_CALL)]]; + return [['$foo[0]', new GetAttrNode(new NameNode('foo'), new ConstantNode(0), $this->getArrayNode(), GetAttrNode::ARRAY_CALL)], ['$foo["b"]', new GetAttrNode(new NameNode('foo'), new ConstantNode('b'), $this->getArrayNode(), GetAttrNode::ARRAY_CALL)], ['$foo->foo', new GetAttrNode(new NameNode('foo'), new ConstantNode('foo'), $this->getArrayNode(), GetAttrNode::PROPERTY_CALL), ['foo' => new Obj()]], ['$foo->foo(["b" => "a", 0 => "b"])', new GetAttrNode(new NameNode('foo'), new ConstantNode('foo'), $this->getArrayNode(), GetAttrNode::METHOD_CALL), ['foo' => new Obj()]], ['$foo[$index]', new GetAttrNode(new NameNode('foo'), new NameNode('index'), $this->getArrayNode(), GetAttrNode::ARRAY_CALL)]]; } public function getDumpData() { - return [['foo[0]', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(0), $this->getArrayNode(), \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::ARRAY_CALL)], ['foo["b"]', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('b'), $this->getArrayNode(), \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::ARRAY_CALL)], ['foo.foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), $this->getArrayNode(), \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::PROPERTY_CALL), ['foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Tests\Node\Obj()]], ['foo.foo({"b": "a", 0: "b"})', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), $this->getArrayNode(), \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::METHOD_CALL), ['foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Tests\Node\Obj()]], ['foo[index]', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('index'), $this->getArrayNode(), \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::ARRAY_CALL)]]; + return [['foo[0]', new GetAttrNode(new NameNode('foo'), new ConstantNode(0), $this->getArrayNode(), GetAttrNode::ARRAY_CALL)], ['foo["b"]', new GetAttrNode(new NameNode('foo'), new ConstantNode('b'), $this->getArrayNode(), GetAttrNode::ARRAY_CALL)], ['foo.foo', new GetAttrNode(new NameNode('foo'), new NameNode('foo'), $this->getArrayNode(), GetAttrNode::PROPERTY_CALL), ['foo' => new Obj()]], ['foo.foo({"b": "a", 0: "b"})', new GetAttrNode(new NameNode('foo'), new NameNode('foo'), $this->getArrayNode(), GetAttrNode::METHOD_CALL), ['foo' => new Obj()]], ['foo[index]', new GetAttrNode(new NameNode('foo'), new NameNode('index'), $this->getArrayNode(), GetAttrNode::ARRAY_CALL)]]; } protected function getArrayNode() { - $array = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArrayNode(); - $array->addElement(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('a'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('b')); - $array->addElement(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('b')); + $array = new ArrayNode(); + $array->addElement(new ConstantNode('a'), new ConstantNode('b')); + $array->addElement(new ConstantNode('b')); return $array; } } diff --git a/vendor/symfony/expression-language/Tests/Node/NameNodeTest.php b/vendor/symfony/expression-language/Tests/Node/NameNodeTest.php index 9d58d3a22..5aaebc341 100644 --- a/vendor/symfony/expression-language/Tests/Node/NameNodeTest.php +++ b/vendor/symfony/expression-language/Tests/Node/NameNodeTest.php @@ -11,18 +11,18 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Tests\Node; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode; -class NameNodeTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Tests\Node\AbstractNodeTest +class NameNodeTest extends AbstractNodeTest { public function getEvaluateData() { - return [['bar', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), ['foo' => 'bar']]]; + return [['bar', new NameNode('foo'), ['foo' => 'bar']]]; } public function getCompileData() { - return [['$foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo')]]; + return [['$foo', new NameNode('foo')]]; } public function getDumpData() { - return [['foo', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo')]]; + return [['foo', new NameNode('foo')]]; } } diff --git a/vendor/symfony/expression-language/Tests/Node/NodeTest.php b/vendor/symfony/expression-language/Tests/Node/NodeTest.php index e220d4008..d6a3ff5c8 100644 --- a/vendor/symfony/expression-language/Tests/Node/NodeTest.php +++ b/vendor/symfony/expression-language/Tests/Node/NodeTest.php @@ -13,11 +13,14 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node; -class NodeTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use function serialize; +use function unserialize; + +class NodeTest extends TestCase { public function testToString() { - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node([new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('foo')]); + $node = new Node([new ConstantNode('foo')]); $this->assertEquals(<<<'EOF' Node( ConstantNode(value: 'foo') @@ -27,9 +30,9 @@ public function testToString() } public function testSerialization() { - $node = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node(['foo' => 'bar'], ['bar' => 'foo']); - $serializedNode = \serialize($node); - $unserializedNode = \unserialize($serializedNode); + $node = new Node(['foo' => 'bar'], ['bar' => 'foo']); + $serializedNode = serialize($node); + $unserializedNode = unserialize($serializedNode); $this->assertEquals($node, $unserializedNode); } } diff --git a/vendor/symfony/expression-language/Tests/Node/UnaryNodeTest.php b/vendor/symfony/expression-language/Tests/Node/UnaryNodeTest.php index f10a76771..5abf617d7 100644 --- a/vendor/symfony/expression-language/Tests/Node/UnaryNodeTest.php +++ b/vendor/symfony/expression-language/Tests/Node/UnaryNodeTest.php @@ -12,18 +12,18 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\UnaryNode; -class UnaryNodeTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Tests\Node\AbstractNodeTest +class UnaryNodeTest extends AbstractNodeTest { public function getEvaluateData() { - return [[-1, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\UnaryNode('-', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1))], [3, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\UnaryNode('+', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(3))], [\false, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\UnaryNode('!', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true))], [\false, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\UnaryNode('not', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true))]]; + return [[-1, new UnaryNode('-', new ConstantNode(1))], [3, new UnaryNode('+', new ConstantNode(3))], [false, new UnaryNode('!', new ConstantNode(true))], [false, new UnaryNode('not', new ConstantNode(true))]]; } public function getCompileData() { - return [['(-1)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\UnaryNode('-', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1))], ['(+3)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\UnaryNode('+', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(3))], ['(!true)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\UnaryNode('!', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true))], ['(!true)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\UnaryNode('not', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true))]]; + return [['(-1)', new UnaryNode('-', new ConstantNode(1))], ['(+3)', new UnaryNode('+', new ConstantNode(3))], ['(!true)', new UnaryNode('!', new ConstantNode(true))], ['(!true)', new UnaryNode('not', new ConstantNode(true))]]; } public function getDumpData() { - return [['(- 1)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\UnaryNode('-', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(1))], ['(+ 3)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\UnaryNode('+', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(3))], ['(! true)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\UnaryNode('!', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true))], ['(not true)', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\UnaryNode('not', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true))]]; + return [['(- 1)', new UnaryNode('-', new ConstantNode(1))], ['(+ 3)', new UnaryNode('+', new ConstantNode(3))], ['(! true)', new UnaryNode('!', new ConstantNode(true))], ['(not true)', new UnaryNode('not', new ConstantNode(true))]]; } } diff --git a/vendor/symfony/expression-language/Tests/Node/index.php b/vendor/symfony/expression-language/Tests/Node/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/expression-language/Tests/Node/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/expression-language/Tests/ParsedExpressionTest.php b/vendor/symfony/expression-language/Tests/ParsedExpressionTest.php index 054ed46a1..137771210 100644 --- a/vendor/symfony/expression-language/Tests/ParsedExpressionTest.php +++ b/vendor/symfony/expression-language/Tests/ParsedExpressionTest.php @@ -13,13 +13,16 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParsedExpression; -class ParsedExpressionTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use function serialize; +use function unserialize; + +class ParsedExpressionTest extends TestCase { public function testSerialization() { - $expression = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParsedExpression('25', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('25')); - $serializedExpression = \serialize($expression); - $unserializedExpression = \unserialize($serializedExpression); + $expression = new ParsedExpression('25', new ConstantNode('25')); + $serializedExpression = serialize($expression); + $unserializedExpression = unserialize($serializedExpression); $this->assertEquals($expression, $unserializedExpression); } } diff --git a/vendor/symfony/expression-language/Tests/ParserCache/ParserCacheAdapterTest.php b/vendor/symfony/expression-language/Tests/ParserCache/ParserCacheAdapterTest.php index e5bef075c..938d0f030 100644 --- a/vendor/symfony/expression-language/Tests/ParserCache/ParserCacheAdapterTest.php +++ b/vendor/symfony/expression-language/Tests/ParserCache/ParserCacheAdapterTest.php @@ -14,29 +14,31 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParsedExpression; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheAdapter; +use BadMethodCallException; + /** * @group legacy */ -class ParserCacheAdapterTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class ParserCacheAdapterTest extends TestCase { public function testGetItem() { $poolMock = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\ExpressionLanguage\\ParserCache\\ParserCacheInterface')->getMock(); $key = 'key'; $value = 'value'; - $parserCacheAdapter = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheAdapter($poolMock); + $parserCacheAdapter = new ParserCacheAdapter($poolMock); $poolMock->expects($this->once())->method('fetch')->with($key)->willReturn($value); $cacheItem = $parserCacheAdapter->getItem($key); $this->assertEquals($cacheItem->get(), $value); - $this->assertEquals($cacheItem->isHit(), \true); + $this->assertEquals($cacheItem->isHit(), true); } public function testSave() { $poolMock = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\ExpressionLanguage\\ParserCache\\ParserCacheInterface')->getMock(); $cacheItemMock = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Psr\\Cache\\CacheItemInterface')->getMock(); $key = 'key'; - $value = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParsedExpression('1 + 1', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\Node([], [])); - $parserCacheAdapter = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheAdapter($poolMock); + $value = new ParsedExpression('1 + 1', new Node([], [])); + $parserCacheAdapter = new ParserCacheAdapter($poolMock); $poolMock->expects($this->once())->method('save')->with($key, $value); $cacheItemMock->expects($this->once())->method('getKey')->willReturn($key); $cacheItemMock->expects($this->once())->method('get')->willReturn($value); @@ -45,54 +47,54 @@ public function testSave() public function testGetItems() { $poolMock = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\ExpressionLanguage\\ParserCache\\ParserCacheInterface')->getMock(); - $parserCacheAdapter = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheAdapter($poolMock); - $this->expectException(\BadMethodCallException::class); + $parserCacheAdapter = new ParserCacheAdapter($poolMock); + $this->expectException(BadMethodCallException::class); $parserCacheAdapter->getItems(); } public function testHasItem() { $poolMock = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\ExpressionLanguage\\ParserCache\\ParserCacheInterface')->getMock(); $key = 'key'; - $parserCacheAdapter = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheAdapter($poolMock); - $this->expectException(\BadMethodCallException::class); + $parserCacheAdapter = new ParserCacheAdapter($poolMock); + $this->expectException(BadMethodCallException::class); $parserCacheAdapter->hasItem($key); } public function testClear() { $poolMock = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\ExpressionLanguage\\ParserCache\\ParserCacheInterface')->getMock(); - $parserCacheAdapter = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheAdapter($poolMock); - $this->expectException(\BadMethodCallException::class); + $parserCacheAdapter = new ParserCacheAdapter($poolMock); + $this->expectException(BadMethodCallException::class); $parserCacheAdapter->clear(); } public function testDeleteItem() { $poolMock = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\ExpressionLanguage\\ParserCache\\ParserCacheInterface')->getMock(); $key = 'key'; - $parserCacheAdapter = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheAdapter($poolMock); - $this->expectException(\BadMethodCallException::class); + $parserCacheAdapter = new ParserCacheAdapter($poolMock); + $this->expectException(BadMethodCallException::class); $parserCacheAdapter->deleteItem($key); } public function testDeleteItems() { $poolMock = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\ExpressionLanguage\\ParserCache\\ParserCacheInterface')->getMock(); $keys = ['key']; - $parserCacheAdapter = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheAdapter($poolMock); - $this->expectException(\BadMethodCallException::class); + $parserCacheAdapter = new ParserCacheAdapter($poolMock); + $this->expectException(BadMethodCallException::class); $parserCacheAdapter->deleteItems($keys); } public function testSaveDeferred() { $poolMock = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\ExpressionLanguage\\ParserCache\\ParserCacheInterface')->getMock(); - $parserCacheAdapter = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheAdapter($poolMock); + $parserCacheAdapter = new ParserCacheAdapter($poolMock); $cacheItemMock = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Psr\\Cache\\CacheItemInterface')->getMock(); - $this->expectException(\BadMethodCallException::class); + $this->expectException(BadMethodCallException::class); $parserCacheAdapter->saveDeferred($cacheItemMock); } public function testCommit() { $poolMock = $this->getMockBuilder('_PhpScoper5ea00cc67502b\\Symfony\\Component\\ExpressionLanguage\\ParserCache\\ParserCacheInterface')->getMock(); - $parserCacheAdapter = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheAdapter($poolMock); - $this->expectException(\BadMethodCallException::class); + $parserCacheAdapter = new ParserCacheAdapter($poolMock); + $this->expectException(BadMethodCallException::class); $parserCacheAdapter->commit(); } } diff --git a/vendor/symfony/expression-language/Tests/ParserCache/index.php b/vendor/symfony/expression-language/Tests/ParserCache/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/expression-language/Tests/ParserCache/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/expression-language/Tests/ParserTest.php b/vendor/symfony/expression-language/Tests/ParserTest.php index 14b20a3fc..670b878bd 100644 --- a/vendor/symfony/expression-language/Tests/ParserTest.php +++ b/vendor/symfony/expression-language/Tests/ParserTest.php @@ -13,23 +13,31 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Lexer; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node; +use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArgumentsNode; +use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArrayNode; +use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode; +use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConditionalNode; +use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode; +use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode; +use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode; +use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\UnaryNode; use _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Parser; -class ParserTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class ParserTest extends TestCase { public function testParseWithInvalidName() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\ExpressionLanguage\\SyntaxError'); $this->expectExceptionMessage('Variable "foo" is not valid around position 1 for expression `foo`.'); - $lexer = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Lexer(); - $parser = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Parser([]); + $lexer = new Lexer(); + $parser = new Parser([]); $parser->parse($lexer->tokenize('foo')); } public function testParseWithZeroInNames() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\ExpressionLanguage\\SyntaxError'); $this->expectExceptionMessage('Variable "foo" is not valid around position 1 for expression `foo`.'); - $lexer = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Lexer(); - $parser = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Parser([]); + $lexer = new Lexer(); + $parser = new Parser([]); $parser->parse($lexer->tokenize('foo'), [0]); } /** @@ -37,46 +45,46 @@ public function testParseWithZeroInNames() */ public function testParse($node, $expression, $names = []) { - $lexer = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Lexer(); - $parser = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Parser([]); + $lexer = new Lexer(); + $parser = new Parser([]); $this->assertEquals($node, $parser->parse($lexer->tokenize($expression), $names)); } public function getParseData() { - $arguments = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArgumentsNode(); - $arguments->addElement(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('arg1')); - $arguments->addElement(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2)); - $arguments->addElement(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true)); - $arrayNode = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArrayNode(); - $arrayNode->addElement(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('bar')); + $arguments = new ArgumentsNode(); + $arguments->addElement(new ConstantNode('arg1')); + $arguments->addElement(new ConstantNode(2)); + $arguments->addElement(new ConstantNode(true)); + $arrayNode = new ArrayNode(); + $arrayNode->addElement(new NameNode('bar')); return [ - [new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('a'), 'a', ['a']], - [new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('a'), '"a"'], - [new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(3), '3'], - [new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\false), 'false'], - [new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true), 'true'], - [new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(null), 'null'], - [new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\UnaryNode('-', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(3)), '-3'], - [new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('-', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(3), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(3)), '3 - 3'], - [new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('*', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('-', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(3), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(3)), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(2)), '(3 - 3) * 2'], - [new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('bar', \true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArgumentsNode(), \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::PROPERTY_CALL), 'foo.bar', ['foo']], - [new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('bar', \true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArgumentsNode(), \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::METHOD_CALL), 'foo.bar()', ['foo']], - [new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('not', \true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArgumentsNode(), \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::METHOD_CALL), 'foo.not()', ['foo']], - [new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('bar', \true), $arguments, \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::METHOD_CALL), 'foo.bar("arg1", 2, true)', ['foo']], - [new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(3), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArgumentsNode(), \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::ARRAY_CALL), 'foo[3]', ['foo']], - [new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConditionalNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode(\false)), 'true ? true : false'], - [new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('matches', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('foo'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('/foo/')), '"foo" matches "/foo/"'], + [new NameNode('a'), 'a', ['a']], + [new ConstantNode('a'), '"a"'], + [new ConstantNode(3), '3'], + [new ConstantNode(false), 'false'], + [new ConstantNode(true), 'true'], + [new ConstantNode(null), 'null'], + [new UnaryNode('-', new ConstantNode(3)), '-3'], + [new BinaryNode('-', new ConstantNode(3), new ConstantNode(3)), '3 - 3'], + [new BinaryNode('*', new BinaryNode('-', new ConstantNode(3), new ConstantNode(3)), new ConstantNode(2)), '(3 - 3) * 2'], + [new GetAttrNode(new NameNode('foo'), new ConstantNode('bar', true), new ArgumentsNode(), GetAttrNode::PROPERTY_CALL), 'foo.bar', ['foo']], + [new GetAttrNode(new NameNode('foo'), new ConstantNode('bar', true), new ArgumentsNode(), GetAttrNode::METHOD_CALL), 'foo.bar()', ['foo']], + [new GetAttrNode(new NameNode('foo'), new ConstantNode('not', true), new ArgumentsNode(), GetAttrNode::METHOD_CALL), 'foo.not()', ['foo']], + [new GetAttrNode(new NameNode('foo'), new ConstantNode('bar', true), $arguments, GetAttrNode::METHOD_CALL), 'foo.bar("arg1", 2, true)', ['foo']], + [new GetAttrNode(new NameNode('foo'), new ConstantNode(3), new ArgumentsNode(), GetAttrNode::ARRAY_CALL), 'foo[3]', ['foo']], + [new ConditionalNode(new ConstantNode(true), new ConstantNode(true), new ConstantNode(false)), 'true ? true : false'], + [new BinaryNode('matches', new ConstantNode('foo'), new ConstantNode('/foo/')), '"foo" matches "/foo/"'], // chained calls - [$this->createGetAttrNode($this->createGetAttrNode($this->createGetAttrNode($this->createGetAttrNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), 'bar', \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::METHOD_CALL), 'foo', \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::METHOD_CALL), 'baz', \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::PROPERTY_CALL), '3', \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::ARRAY_CALL), 'foo.bar().foo().baz[3]', ['foo']], - [new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), 'bar', ['foo' => 'bar']], + [$this->createGetAttrNode($this->createGetAttrNode($this->createGetAttrNode($this->createGetAttrNode(new NameNode('foo'), 'bar', GetAttrNode::METHOD_CALL), 'foo', GetAttrNode::METHOD_CALL), 'baz', GetAttrNode::PROPERTY_CALL), '3', GetAttrNode::ARRAY_CALL), 'foo.bar().foo().baz[3]', ['foo']], + [new NameNode('foo'), 'bar', ['foo' => 'bar']], // Operators collisions - [new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('in', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('not', \true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArgumentsNode(), \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::PROPERTY_CALL), $arrayNode), 'foo.not in [bar]', ['foo', 'bar']], - [new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\BinaryNode('or', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\UnaryNode('not', new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo')), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode(new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\NameNode('foo'), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode('not', \true), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArgumentsNode(), \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::PROPERTY_CALL)), 'not foo or foo.not', ['foo']], + [new BinaryNode('in', new GetAttrNode(new NameNode('foo'), new ConstantNode('not', true), new ArgumentsNode(), GetAttrNode::PROPERTY_CALL), $arrayNode), 'foo.not in [bar]', ['foo', 'bar']], + [new BinaryNode('or', new UnaryNode('not', new NameNode('foo')), new GetAttrNode(new NameNode('foo'), new ConstantNode('not', true), new ArgumentsNode(), GetAttrNode::PROPERTY_CALL)), 'not foo or foo.not', ['foo']], ]; } private function createGetAttrNode($node, $item, $type) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode($node, new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ConstantNode($item, \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\GetAttrNode::ARRAY_CALL !== $type), new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Node\ArgumentsNode(), $type); + return new GetAttrNode($node, new ConstantNode($item, GetAttrNode::ARRAY_CALL !== $type), new ArgumentsNode(), $type); } /** * @dataProvider getInvalidPostfixData @@ -84,8 +92,8 @@ private function createGetAttrNode($node, $item, $type) public function testParseWithInvalidPostfixData($expr, $names = []) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\ExpressionLanguage\\SyntaxError'); - $lexer = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Lexer(); - $parser = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Parser([]); + $lexer = new Lexer(); + $parser = new Parser([]); $parser->parse($lexer->tokenize($expr), $names); } public function getInvalidPostfixData() @@ -96,8 +104,8 @@ public function testNameProposal() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\ExpressionLanguage\\SyntaxError'); $this->expectExceptionMessage('Did you mean "baz"?'); - $lexer = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Lexer(); - $parser = new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Parser([]); + $lexer = new Lexer(); + $parser = new Parser([]); $parser->parse($lexer->tokenize('foo > bar'), ['foo', 'baz']); } } diff --git a/vendor/symfony/expression-language/Tests/index.php b/vendor/symfony/expression-language/Tests/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/expression-language/Tests/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/expression-language/Token.php b/vendor/symfony/expression-language/Token.php index cac2cbea2..31d5849b6 100644 --- a/vendor/symfony/expression-language/Token.php +++ b/vendor/symfony/expression-language/Token.php @@ -10,6 +10,9 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage; +use function sprintf; +use function strtoupper; + /** * Represents a Token. * @@ -44,7 +47,7 @@ public function __construct($type, $value, $cursor) */ public function __toString() { - return \sprintf('%3d %-11s %s', $this->cursor, \strtoupper($this->type), $this->value); + return sprintf('%3d %-11s %s', $this->cursor, strtoupper($this->type), $this->value); } /** * Tests the current token for a type and/or a value. diff --git a/vendor/symfony/expression-language/TokenStream.php b/vendor/symfony/expression-language/TokenStream.php index f45121b7d..d70061ee0 100644 --- a/vendor/symfony/expression-language/TokenStream.php +++ b/vendor/symfony/expression-language/TokenStream.php @@ -10,6 +10,9 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage; +use function implode; +use function sprintf; + /** * Represents a token stream. * @@ -38,7 +41,7 @@ public function __construct(array $tokens, $expression = '') */ public function __toString() { - return \implode("\n", $this->tokens); + return implode("\n", $this->tokens); } /** * Sets the pointer to the next token and returns the old one. @@ -47,7 +50,7 @@ public function next() { ++$this->position; if (!isset($this->tokens[$this->position])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\SyntaxError('Unexpected end of expression.', $this->current->cursor, $this->expression); + throw new SyntaxError('Unexpected end of expression.', $this->current->cursor, $this->expression); } $this->current = $this->tokens[$this->position]; } @@ -62,7 +65,7 @@ public function expect($type, $value = null, $message = null) { $token = $this->current; if (!$token->test($type, $value)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\SyntaxError(\sprintf('%sUnexpected token "%s" of value "%s" ("%s" expected%s).', $message ? $message . '. ' : '', $token->type, $token->value, $type, $value ? \sprintf(' with value "%s"', $value) : ''), $token->cursor, $this->expression); + throw new SyntaxError(sprintf('%sUnexpected token "%s" of value "%s" ("%s" expected%s).', $message ? $message . '. ' : '', $token->type, $token->value, $type, $value ? sprintf(' with value "%s"', $value) : ''), $token->cursor, $this->expression); } $this->next(); } @@ -73,7 +76,7 @@ public function expect($type, $value = null, $message = null) */ public function isEOF() { - return \_PhpScoper5ea00cc67502b\Symfony\Component\ExpressionLanguage\Token::EOF_TYPE === $this->current->type; + return Token::EOF_TYPE === $this->current->type; } /** * @internal diff --git a/vendor/symfony/expression-language/index.php b/vendor/symfony/expression-language/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/expression-language/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/filesystem/Exception/FileNotFoundException.php b/vendor/symfony/filesystem/Exception/FileNotFoundException.php index a2c36434a..22e716869 100644 --- a/vendor/symfony/filesystem/Exception/FileNotFoundException.php +++ b/vendor/symfony/filesystem/Exception/FileNotFoundException.php @@ -10,21 +10,24 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception; +use Exception; +use function sprintf; + /** * Exception class thrown when a file couldn't be found. * * @author Fabien Potencier * @author Christian Gärtner */ -class FileNotFoundException extends \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException +class FileNotFoundException extends IOException { - public function __construct($message = null, $code = 0, \Exception $previous = null, $path = null) + public function __construct($message = null, $code = 0, Exception $previous = null, $path = null) { if (null === $message) { if (null === $path) { $message = 'File could not be found.'; } else { - $message = \sprintf('File "%s" could not be found.', $path); + $message = sprintf('File "%s" could not be found.', $path); } } parent::__construct($message, $code, $previous, $path); diff --git a/vendor/symfony/filesystem/Exception/IOException.php b/vendor/symfony/filesystem/Exception/IOException.php index e77c6efe0..4a171cd37 100644 --- a/vendor/symfony/filesystem/Exception/IOException.php +++ b/vendor/symfony/filesystem/Exception/IOException.php @@ -10,6 +10,9 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception; +use Exception; +use RuntimeException; + /** * Exception class thrown when a filesystem operation failure happens. * @@ -17,10 +20,10 @@ * @author Christian Gärtner * @author Fabien Potencier */ -class IOException extends \RuntimeException implements \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOExceptionInterface +class IOException extends RuntimeException implements IOExceptionInterface { private $path; - public function __construct($message, $code = 0, \Exception $previous = null, $path = null) + public function __construct($message, $code = 0, Exception $previous = null, $path = null) { $this->path = $path; parent::__construct($message, $code, $previous); diff --git a/vendor/symfony/filesystem/Exception/IOExceptionInterface.php b/vendor/symfony/filesystem/Exception/IOExceptionInterface.php index f39d6e9a0..d27ca774a 100644 --- a/vendor/symfony/filesystem/Exception/IOExceptionInterface.php +++ b/vendor/symfony/filesystem/Exception/IOExceptionInterface.php @@ -15,7 +15,7 @@ * * @author Christian Gärtner */ -interface IOExceptionInterface extends \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\ExceptionInterface +interface IOExceptionInterface extends ExceptionInterface { /** * Returns the associated path for the exception. diff --git a/vendor/symfony/filesystem/Exception/index.php b/vendor/symfony/filesystem/Exception/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/filesystem/Exception/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/filesystem/Filesystem.php b/vendor/symfony/filesystem/Filesystem.php index fb1127221..da9444858 100644 --- a/vendor/symfony/filesystem/Filesystem.php +++ b/vendor/symfony/filesystem/Filesystem.php @@ -12,6 +12,79 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\FileNotFoundException; use _PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException; +use Exception; +use FilesystemIterator; +use RecursiveDirectoryIterator; +use RecursiveIteratorIterator; +use Throwable; +use Traversable; +use function array_pop; +use function array_reverse; +use function array_slice; +use function basename; +use function call_user_func_array; +use function chgrp; +use function chmod; +use function chown; +use function count; +use function ctype_alpha; +use function defined; +use function dirname; +use function explode; +use function fclose; +use function file_exists; +use function file_put_contents; +use function fileinode; +use function filemtime; +use function fileperms; +use function filesize; +use function fopen; +use function func_get_args; +use function function_exists; +use function implode; +use function is_array; +use function is_dir; +use function is_file; +use function is_link; +use function is_readable; +use function is_writable; +use function iterator_to_array; +use function lchgrp; +use function lchown; +use function mt_rand; +use function parse_url; +use function posix_getgrnam; +use function readlink; +use function realpath; +use function rename; +use function restore_error_handler; +use function rtrim; +use function set_error_handler; +use function sprintf; +use function str_repeat; +use function str_replace; +use function stream_context_create; +use function stream_copy_to_stream; +use function stream_is_local; +use function stripos; +use function strlen; +use function strpos; +use function strspn; +use function strtr; +use function substr; +use function tempnam; +use function touch; +use function trigger_error; +use function trim; +use function umask; +use function uniqid; +use const DIRECTORY_SEPARATOR; +use const E_USER_DEPRECATED; +use const FILE_APPEND; +use const PHP_MAXPATHLEN; +use const PHP_URL_HOST; +use const PHP_URL_SCHEME; + /** * Provides basic utility to manipulate the file system. * @@ -34,38 +107,38 @@ class Filesystem * @throws FileNotFoundException When originFile doesn't exist * @throws IOException When copy fails */ - public function copy($originFile, $targetFile, $overwriteNewerFiles = \false) + public function copy($originFile, $targetFile, $overwriteNewerFiles = false) { - $originIsLocal = \stream_is_local($originFile) || 0 === \stripos($originFile, 'file://'); - if ($originIsLocal && !\is_file($originFile)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\FileNotFoundException(\sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile); + $originIsLocal = stream_is_local($originFile) || 0 === stripos($originFile, 'file://'); + if ($originIsLocal && !is_file($originFile)) { + throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile); } - $this->mkdir(\dirname($targetFile)); - $doCopy = \true; - if (!$overwriteNewerFiles && null === \parse_url($originFile, \PHP_URL_HOST) && \is_file($targetFile)) { - $doCopy = \filemtime($originFile) > \filemtime($targetFile); + $this->mkdir(dirname($targetFile)); + $doCopy = true; + if (!$overwriteNewerFiles && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) { + $doCopy = filemtime($originFile) > filemtime($targetFile); } if ($doCopy) { // https://bugs.php.net/64634 - if (\false === ($source = @\fopen($originFile, 'r'))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $originFile, $targetFile), 0, null, $originFile); + if (false === ($source = @fopen($originFile, 'r'))) { + throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $originFile, $targetFile), 0, null, $originFile); } // Stream context created to allow files overwrite when using FTP stream wrapper - disabled by default - if (\false === ($target = @\fopen($targetFile, 'w', null, \stream_context_create(['ftp' => ['overwrite' => \true]])))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing.', $originFile, $targetFile), 0, null, $originFile); + if (false === ($target = @fopen($targetFile, 'w', null, stream_context_create(['ftp' => ['overwrite' => true]])))) { + throw new IOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing.', $originFile, $targetFile), 0, null, $originFile); } - $bytesCopied = \stream_copy_to_stream($source, $target); - \fclose($source); - \fclose($target); + $bytesCopied = stream_copy_to_stream($source, $target); + fclose($source); + fclose($target); unset($source, $target); - if (!\is_file($targetFile)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile); + if (!is_file($targetFile)) { + throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile); } if ($originIsLocal) { // Like `cp`, preserve executable permission bits - @\chmod($targetFile, \fileperms($targetFile) | \fileperms($originFile) & 0111); - if ($bytesCopied !== ($bytesOrigin = \filesize($originFile))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile); + @chmod($targetFile, fileperms($targetFile) | fileperms($originFile) & 0111); + if ($bytesCopied !== ($bytesOrigin = filesize($originFile))) { + throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile); } } } @@ -81,16 +154,16 @@ public function copy($originFile, $targetFile, $overwriteNewerFiles = \false) public function mkdir($dirs, $mode = 0777) { foreach ($this->toIterable($dirs) as $dir) { - if (\is_dir($dir)) { + if (is_dir($dir)) { continue; } - if (!self::box('mkdir', $dir, $mode, \true)) { - if (!\is_dir($dir)) { + if (!self::box('mkdir', $dir, $mode, true)) { + if (!is_dir($dir)) { // The directory was not created by a concurrent process. Let's throw an exception with a developer friendly error message if we have one if (self::$lastError) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Failed to create "%s": %s.', $dir, self::$lastError), 0, null, $dir); + throw new IOException(sprintf('Failed to create "%s": %s.', $dir, self::$lastError), 0, null, $dir); } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Failed to create "%s".', $dir), 0, null, $dir); + throw new IOException(sprintf('Failed to create "%s".', $dir), 0, null, $dir); } } } @@ -104,16 +177,16 @@ public function mkdir($dirs, $mode = 0777) */ public function exists($files) { - $maxPathLength = \PHP_MAXPATHLEN - 2; + $maxPathLength = PHP_MAXPATHLEN - 2; foreach ($this->toIterable($files) as $file) { - if (\strlen($file) > $maxPathLength) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file); + if (strlen($file) > $maxPathLength) { + throw new IOException(sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file); } - if (!\file_exists($file)) { - return \false; + if (!file_exists($file)) { + return false; } } - return \true; + return true; } /** * Sets access and modification time of file. @@ -127,9 +200,9 @@ public function exists($files) public function touch($files, $time = null, $atime = null) { foreach ($this->toIterable($files) as $file) { - $touch = $time ? @\touch($file, $time, $atime) : @\touch($file); - if (\true !== $touch) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Failed to touch "%s".', $file), 0, null, $file); + $touch = $time ? @touch($file, $time, $atime) : @touch($file); + if (true !== $touch) { + throw new IOException(sprintf('Failed to touch "%s".', $file), 0, null, $file); } } } @@ -142,25 +215,25 @@ public function touch($files, $time = null, $atime = null) */ public function remove($files) { - if ($files instanceof \Traversable) { - $files = \iterator_to_array($files, \false); - } elseif (!\is_array($files)) { + if ($files instanceof Traversable) { + $files = iterator_to_array($files, false); + } elseif (!is_array($files)) { $files = [$files]; } - $files = \array_reverse($files); + $files = array_reverse($files); foreach ($files as $file) { - if (\is_link($file)) { + if (is_link($file)) { // See https://bugs.php.net/52176 - if (!(self::box('unlink', $file) || '\\' !== \DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && \file_exists($file)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Failed to remove symlink "%s": %s.', $file, self::$lastError)); + if (!(self::box('unlink', $file) || '\\' !== DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && file_exists($file)) { + throw new IOException(sprintf('Failed to remove symlink "%s": %s.', $file, self::$lastError)); } - } elseif (\is_dir($file)) { - $this->remove(new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS)); - if (!self::box('rmdir', $file) && \file_exists($file)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Failed to remove directory "%s": %s.', $file, self::$lastError)); + } elseif (is_dir($file)) { + $this->remove(new FilesystemIterator($file, FilesystemIterator::CURRENT_AS_PATHNAME | FilesystemIterator::SKIP_DOTS)); + if (!self::box('rmdir', $file) && file_exists($file)) { + throw new IOException(sprintf('Failed to remove directory "%s": %s.', $file, self::$lastError)); } - } elseif (!self::box('unlink', $file) && \file_exists($file)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Failed to remove file "%s": %s.', $file, self::$lastError)); + } elseif (!self::box('unlink', $file) && file_exists($file)) { + throw new IOException(sprintf('Failed to remove file "%s": %s.', $file, self::$lastError)); } } } @@ -174,14 +247,14 @@ public function remove($files) * * @throws IOException When the change fails */ - public function chmod($files, $mode, $umask = 00, $recursive = \false) + public function chmod($files, $mode, $umask = 00, $recursive = false) { foreach ($this->toIterable($files) as $file) { - if (\true !== @\chmod($file, $mode & ~$umask)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Failed to chmod file "%s".', $file), 0, null, $file); + if (true !== @chmod($file, $mode & ~$umask)) { + throw new IOException(sprintf('Failed to chmod file "%s".', $file), 0, null, $file); } - if ($recursive && \is_dir($file) && !\is_link($file)) { - $this->chmod(new \FilesystemIterator($file), $mode, $umask, \true); + if ($recursive && is_dir($file) && !is_link($file)) { + $this->chmod(new FilesystemIterator($file), $mode, $umask, true); } } } @@ -194,19 +267,19 @@ public function chmod($files, $mode, $umask = 00, $recursive = \false) * * @throws IOException When the change fails */ - public function chown($files, $user, $recursive = \false) + public function chown($files, $user, $recursive = false) { foreach ($this->toIterable($files) as $file) { - if ($recursive && \is_dir($file) && !\is_link($file)) { - $this->chown(new \FilesystemIterator($file), $user, \true); + if ($recursive && is_dir($file) && !is_link($file)) { + $this->chown(new FilesystemIterator($file), $user, true); } - if (\is_link($file) && \function_exists('lchown')) { - if (\true !== @\lchown($file, $user)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Failed to chown file "%s".', $file), 0, null, $file); + if (is_link($file) && function_exists('lchown')) { + if (true !== @lchown($file, $user)) { + throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file); } } else { - if (\true !== @\chown($file, $user)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Failed to chown file "%s".', $file), 0, null, $file); + if (true !== @chown($file, $user)) { + throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file); } } } @@ -220,19 +293,19 @@ public function chown($files, $user, $recursive = \false) * * @throws IOException When the change fails */ - public function chgrp($files, $group, $recursive = \false) + public function chgrp($files, $group, $recursive = false) { foreach ($this->toIterable($files) as $file) { - if ($recursive && \is_dir($file) && !\is_link($file)) { - $this->chgrp(new \FilesystemIterator($file), $group, \true); + if ($recursive && is_dir($file) && !is_link($file)) { + $this->chgrp(new FilesystemIterator($file), $group, true); } - if (\is_link($file) && \function_exists('lchgrp')) { - if (\true !== @\lchgrp($file, $group) || \defined('HHVM_VERSION') && !\posix_getgrnam($group)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Failed to chgrp file "%s".', $file), 0, null, $file); + if (is_link($file) && function_exists('lchgrp')) { + if (true !== @lchgrp($file, $group) || defined('HHVM_VERSION') && !posix_getgrnam($group)) { + throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file); } } else { - if (\true !== @\chgrp($file, $group)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Failed to chgrp file "%s".', $file), 0, null, $file); + if (true !== @chgrp($file, $group)) { + throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file); } } } @@ -247,20 +320,20 @@ public function chgrp($files, $group, $recursive = \false) * @throws IOException When target file or directory already exists * @throws IOException When origin cannot be renamed */ - public function rename($origin, $target, $overwrite = \false) + public function rename($origin, $target, $overwrite = false) { // we check that target does not exist if (!$overwrite && $this->isReadable($target)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target); + throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target); } - if (\true !== @\rename($origin, $target)) { - if (\is_dir($origin)) { + if (true !== @rename($origin, $target)) { + if (is_dir($origin)) { // See https://bugs.php.net/54097 & https://php.net/rename#113943 $this->mirror($origin, $target, null, ['override' => $overwrite, 'delete' => $overwrite]); $this->remove($origin); return; } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target); + throw new IOException(sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target); } } /** @@ -274,11 +347,11 @@ public function rename($origin, $target, $overwrite = \false) */ private function isReadable($filename) { - $maxPathLength = \PHP_MAXPATHLEN - 2; - if (\strlen($filename) > $maxPathLength) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename); + $maxPathLength = PHP_MAXPATHLEN - 2; + if (strlen($filename) > $maxPathLength) { + throw new IOException(sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename); } - return \is_readable($filename); + return is_readable($filename); } /** * Creates a symbolic link or copy a directory. @@ -289,19 +362,19 @@ private function isReadable($filename) * * @throws IOException When symlink fails */ - public function symlink($originDir, $targetDir, $copyOnWindows = \false) + public function symlink($originDir, $targetDir, $copyOnWindows = false) { - if ('\\' === \DIRECTORY_SEPARATOR) { - $originDir = \strtr($originDir, '/', '\\'); - $targetDir = \strtr($targetDir, '/', '\\'); + if ('\\' === DIRECTORY_SEPARATOR) { + $originDir = strtr($originDir, '/', '\\'); + $targetDir = strtr($targetDir, '/', '\\'); if ($copyOnWindows) { $this->mirror($originDir, $targetDir); return; } } - $this->mkdir(\dirname($targetDir)); - if (\is_link($targetDir)) { - if (\readlink($targetDir) === $originDir) { + $this->mkdir(dirname($targetDir)); + if (is_link($targetDir)) { + if (readlink($targetDir) === $originDir) { return; } $this->remove($targetDir); @@ -322,14 +395,14 @@ public function symlink($originDir, $targetDir, $copyOnWindows = \false) public function hardlink($originFile, $targetFiles) { if (!$this->exists($originFile)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\FileNotFoundException(null, 0, null, $originFile); + throw new FileNotFoundException(null, 0, null, $originFile); } - if (!\is_file($originFile)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\FileNotFoundException(\sprintf('Origin file "%s" is not a file.', $originFile)); + if (!is_file($originFile)) { + throw new FileNotFoundException(sprintf('Origin file "%s" is not a file.', $originFile)); } foreach ($this->toIterable($targetFiles) as $targetFile) { - if (\is_file($targetFile)) { - if (\fileinode($originFile) === \fileinode($targetFile)) { + if (is_file($targetFile)) { + if (fileinode($originFile) === fileinode($targetFile)) { continue; } $this->remove($targetFile); @@ -347,11 +420,11 @@ public function hardlink($originFile, $targetFiles) private function linkException($origin, $target, $linkType) { if (self::$lastError) { - if ('\\' === \DIRECTORY_SEPARATOR && \false !== \strpos(self::$lastError, 'error code(1314)')) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Unable to create "%s" link due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', $linkType), 0, null, $target); + if ('\\' === DIRECTORY_SEPARATOR && false !== strpos(self::$lastError, 'error code(1314)')) { + throw new IOException(sprintf('Unable to create "%s" link due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', $linkType), 0, null, $target); } } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Failed to create "%s" link from "%s" to "%s".', $linkType, $origin, $target), 0, null, $target); + throw new IOException(sprintf('Failed to create "%s" link from "%s" to "%s".', $linkType, $origin, $target), 0, null, $target); } /** * Resolves links in paths. @@ -369,24 +442,24 @@ private function linkException($origin, $target, $linkType) * * @return string|null */ - public function readlink($path, $canonicalize = \false) + public function readlink($path, $canonicalize = false) { - if (!$canonicalize && !\is_link($path)) { + if (!$canonicalize && !is_link($path)) { return null; } if ($canonicalize) { if (!$this->exists($path)) { return null; } - if ('\\' === \DIRECTORY_SEPARATOR) { - $path = \readlink($path); + if ('\\' === DIRECTORY_SEPARATOR) { + $path = readlink($path); } - return \realpath($path); + return realpath($path); } - if ('\\' === \DIRECTORY_SEPARATOR) { - return \realpath($path); + if ('\\' === DIRECTORY_SEPARATOR) { + return realpath($path); } - return \readlink($path); + return readlink($path); } /** * Given an existing path, convert it to a path relative to a given starting path. @@ -399,29 +472,29 @@ public function readlink($path, $canonicalize = \false) public function makePathRelative($endPath, $startPath) { if (!$this->isAbsolutePath($endPath) || !$this->isAbsolutePath($startPath)) { - @\trigger_error(\sprintf('Support for passing relative paths to %s() is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), \E_USER_DEPRECATED); + @trigger_error(sprintf('Support for passing relative paths to %s() is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED); } // Normalize separators on Windows - if ('\\' === \DIRECTORY_SEPARATOR) { - $endPath = \str_replace('\\', '/', $endPath); - $startPath = \str_replace('\\', '/', $startPath); + if ('\\' === DIRECTORY_SEPARATOR) { + $endPath = str_replace('\\', '/', $endPath); + $startPath = str_replace('\\', '/', $startPath); } $stripDriveLetter = function ($path) { - if (\strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && \ctype_alpha($path[0])) { - return \substr($path, 2); + if (strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0])) { + return substr($path, 2); } return $path; }; $endPath = $stripDriveLetter($endPath); $startPath = $stripDriveLetter($startPath); // Split the paths into arrays - $startPathArr = \explode('/', \trim($startPath, '/')); - $endPathArr = \explode('/', \trim($endPath, '/')); + $startPathArr = explode('/', trim($startPath, '/')); + $endPathArr = explode('/', trim($endPath, '/')); $normalizePathArray = function ($pathSegments, $absolute) { $result = []; foreach ($pathSegments as $segment) { - if ('..' === $segment && ($absolute || \count($result))) { - \array_pop($result); + if ('..' === $segment && ($absolute || count($result))) { + array_pop($result); } elseif ('.' !== $segment) { $result[] = $segment; } @@ -436,14 +509,14 @@ public function makePathRelative($endPath, $startPath) ++$index; } // Determine how deep the start path is relative to the common path (ie, "web/bundles" = 2 levels) - if (1 === \count($startPathArr) && '' === $startPathArr[0]) { + if (1 === count($startPathArr) && '' === $startPathArr[0]) { $depth = 0; } else { - $depth = \count($startPathArr) - $index; + $depth = count($startPathArr) - $index; } // Repeated "../" for each level need to reach the common path - $traverser = \str_repeat('../', $depth); - $endPathRemainder = \implode('/', \array_slice($endPathArr, $index)); + $traverser = str_repeat('../', $depth); + $endPathRemainder = implode('/', array_slice($endPathArr, $index)); // Construct $endPath from traversing to the common path, then to the remaining $endPath $relativePath = $traverser . ('' !== $endPathRemainder ? $endPathRemainder . '/' : ''); return '' === $relativePath ? './' : $relativePath; @@ -458,7 +531,7 @@ public function makePathRelative($endPath, $startPath) * * @param string $originDir The origin directory * @param string $targetDir The target directory - * @param \Traversable|null $iterator Iterator that filters which files and directories to copy, if null a recursive iterator is created + * @param Traversable|null $iterator Iterator that filters which files and directories to copy, if null a recursive iterator is created * @param array $options An array of boolean options * Valid options are: * - $options['override'] If true, target files newer than origin files are overwritten (see copy(), defaults to false) @@ -467,56 +540,56 @@ public function makePathRelative($endPath, $startPath) * * @throws IOException When file type is unknown */ - public function mirror($originDir, $targetDir, \Traversable $iterator = null, $options = []) + public function mirror($originDir, $targetDir, Traversable $iterator = null, $options = []) { - $targetDir = \rtrim($targetDir, '/\\'); - $originDir = \rtrim($originDir, '/\\'); - $originDirLen = \strlen($originDir); + $targetDir = rtrim($targetDir, '/\\'); + $originDir = rtrim($originDir, '/\\'); + $originDirLen = strlen($originDir); // Iterate in destination folder to remove obsolete entries if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) { $deleteIterator = $iterator; if (null === $deleteIterator) { - $flags = \FilesystemIterator::SKIP_DOTS; - $deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST); + $flags = FilesystemIterator::SKIP_DOTS; + $deleteIterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($targetDir, $flags), RecursiveIteratorIterator::CHILD_FIRST); } - $targetDirLen = \strlen($targetDir); + $targetDirLen = strlen($targetDir); foreach ($deleteIterator as $file) { - $origin = $originDir . \substr($file->getPathname(), $targetDirLen); + $origin = $originDir . substr($file->getPathname(), $targetDirLen); if (!$this->exists($origin)) { $this->remove($file); } } } - $copyOnWindows = \false; + $copyOnWindows = false; if (isset($options['copy_on_windows'])) { $copyOnWindows = $options['copy_on_windows']; } if (null === $iterator) { - $flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS; - $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST); + $flags = $copyOnWindows ? FilesystemIterator::SKIP_DOTS | FilesystemIterator::FOLLOW_SYMLINKS : FilesystemIterator::SKIP_DOTS; + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($originDir, $flags), RecursiveIteratorIterator::SELF_FIRST); } if ($this->exists($originDir)) { $this->mkdir($targetDir); } foreach ($iterator as $file) { - $target = $targetDir . \substr($file->getPathname(), $originDirLen); + $target = $targetDir . substr($file->getPathname(), $originDirLen); if ($copyOnWindows) { - if (\is_file($file)) { - $this->copy($file, $target, isset($options['override']) ? $options['override'] : \false); - } elseif (\is_dir($file)) { + if (is_file($file)) { + $this->copy($file, $target, isset($options['override']) ? $options['override'] : false); + } elseif (is_dir($file)) { $this->mkdir($target); } else { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Unable to guess "%s" file type.', $file), 0, null, $file); + throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file); } } else { - if (\is_link($file)) { + if (is_link($file)) { $this->symlink($file->getLinkTarget(), $target); - } elseif (\is_dir($file)) { + } elseif (is_dir($file)) { $this->mkdir($target); - } elseif (\is_file($file)) { - $this->copy($file, $target, isset($options['override']) ? $options['override'] : \false); + } elseif (is_file($file)) { + $this->copy($file, $target, isset($options['override']) ? $options['override'] : false); } else { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Unable to guess "%s" file type.', $file), 0, null, $file); + throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file); } } } @@ -530,7 +603,7 @@ public function mirror($originDir, $targetDir, \Traversable $iterator = null, $o */ public function isAbsolutePath($file) { - return \strspn($file, '/\\', 0, 1) || \strlen($file) > 3 && \ctype_alpha($file[0]) && ':' === $file[1] && \strspn($file, '/\\', 2, 1) || null !== \parse_url($file, \PHP_URL_SCHEME); + return strspn($file, '/\\', 0, 1) || strlen($file) > 3 && ctype_alpha($file[0]) && ':' === $file[1] && strspn($file, '/\\', 2, 1) || null !== parse_url($file, PHP_URL_SCHEME); } /** * Creates a temporary file with support for custom stream wrappers. @@ -543,35 +616,35 @@ public function isAbsolutePath($file) */ public function tempnam($dir, $prefix) { - list($scheme, $hierarchy) = $this->getSchemeAndHierarchy($dir); + [$scheme, $hierarchy] = $this->getSchemeAndHierarchy($dir); // If no scheme or scheme is "file" or "gs" (Google Cloud) create temp file in local filesystem if (null === $scheme || 'file' === $scheme || 'gs' === $scheme) { - $tmpFile = @\tempnam($hierarchy, $prefix); + $tmpFile = @tempnam($hierarchy, $prefix); // If tempnam failed or no scheme return the filename otherwise prepend the scheme - if (\false !== $tmpFile) { + if (false !== $tmpFile) { if (null !== $scheme && 'gs' !== $scheme) { return $scheme . '://' . $tmpFile; } return $tmpFile; } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException('A temporary file could not be created.'); + throw new IOException('A temporary file could not be created.'); } // Loop until we create a valid temp file or have reached 10 attempts for ($i = 0; $i < 10; ++$i) { // Create a unique filename - $tmpFile = $dir . '/' . $prefix . \uniqid(\mt_rand(), \true); + $tmpFile = $dir . '/' . $prefix . uniqid(mt_rand(), true); // Use fopen instead of file_exists as some streams do not support stat // Use mode 'x+' to atomically check existence and create to avoid a TOCTOU vulnerability - $handle = @\fopen($tmpFile, 'x+'); + $handle = @fopen($tmpFile, 'x+'); // If unsuccessful restart the loop - if (\false === $handle) { + if (false === $handle) { continue; } // Close the file if it was successfully opened - @\fclose($handle); + @fclose($handle); return $tmpFile; } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException('A temporary file could not be created.'); + throw new IOException('A temporary file could not be created.'); } /** * Atomically dumps content into a file. @@ -583,21 +656,21 @@ public function tempnam($dir, $prefix) */ public function dumpFile($filename, $content) { - $dir = \dirname($filename); - if (!\is_dir($dir)) { + $dir = dirname($filename); + if (!is_dir($dir)) { $this->mkdir($dir); } - if (!\is_writable($dir)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir); + if (!is_writable($dir)) { + throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir); } // Will create a temp file with 0600 access rights // when the filesystem supports chmod. - $tmpFile = $this->tempnam($dir, \basename($filename)); - if (\false === @\file_put_contents($tmpFile, $content)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Failed to write file "%s".', $filename), 0, null, $filename); + $tmpFile = $this->tempnam($dir, basename($filename)); + if (false === @file_put_contents($tmpFile, $content)) { + throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename); } - @\chmod($tmpFile, \file_exists($filename) ? \fileperms($filename) : 0666 & ~\umask()); - $this->rename($tmpFile, $filename, \true); + @chmod($tmpFile, file_exists($filename) ? fileperms($filename) : 0666 & ~umask()); + $this->rename($tmpFile, $filename, true); } /** * Appends content to an existing file. @@ -609,25 +682,25 @@ public function dumpFile($filename, $content) */ public function appendToFile($filename, $content) { - $dir = \dirname($filename); - if (!\is_dir($dir)) { + $dir = dirname($filename); + if (!is_dir($dir)) { $this->mkdir($dir); } - if (!\is_writable($dir)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir); + if (!is_writable($dir)) { + throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir); } - if (\false === @\file_put_contents($filename, $content, \FILE_APPEND)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('Failed to write file "%s".', $filename), 0, null, $filename); + if (false === @file_put_contents($filename, $content, FILE_APPEND)) { + throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename); } } /** * @param mixed $files * - * @return array|\Traversable + * @return array|Traversable */ private function toIterable($files) { - return \is_array($files) || $files instanceof \Traversable ? $files : [$files]; + return is_array($files) || $files instanceof Traversable ? $files : [$files]; } /** * Gets a 2-tuple of scheme (may be null) and hierarchical part of a filename (e.g. file:///tmp -> [file, tmp]). @@ -638,8 +711,8 @@ private function toIterable($files) */ private function getSchemeAndHierarchy($filename) { - $components = \explode('://', $filename, 2); - return 2 === \count($components) ? [$components[0], $components[1]] : [null, $components[0]]; + $components = explode('://', $filename, 2); + return 2 === count($components) ? [$components[0], $components[1]] : [null, $components[0]]; } /** * @param callable $func @@ -649,15 +722,15 @@ private function getSchemeAndHierarchy($filename) private static function box($func) { self::$lastError = null; - \set_error_handler(__CLASS__ . '::handleError'); + set_error_handler(__CLASS__ . '::handleError'); try { - $result = \call_user_func_array($func, \array_slice(\func_get_args(), 1)); - \restore_error_handler(); + $result = call_user_func_array($func, array_slice(func_get_args(), 1)); + restore_error_handler(); return $result; - } catch (\Throwable $e) { - } catch (\Exception $e) { + } catch (Throwable $e) { + } catch (Exception $e) { } - \restore_error_handler(); + restore_error_handler(); throw $e; } /** diff --git a/vendor/symfony/filesystem/LockHandler.php b/vendor/symfony/filesystem/LockHandler.php index 3623254f1..20d42c4bc 100644 --- a/vendor/symfony/filesystem/LockHandler.php +++ b/vendor/symfony/filesystem/LockHandler.php @@ -13,7 +13,26 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException; use _PhpScoper5ea00cc67502b\Symfony\Component\Lock\Store\FlockStore; use _PhpScoper5ea00cc67502b\Symfony\Component\Lock\Store\SemaphoreStore; -@\trigger_error(\sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use %s or %s instead.', \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\LockHandler::class, \_PhpScoper5ea00cc67502b\Symfony\Component\Lock\Store\SemaphoreStore::class, \_PhpScoper5ea00cc67502b\Symfony\Component\Lock\Store\FlockStore::class), \E_USER_DEPRECATED); +use function chmod; +use function fclose; +use function flock; +use function fopen; +use function hash; +use function is_dir; +use function is_writable; +use function preg_replace; +use function restore_error_handler; +use function set_error_handler; +use function sprintf; +use function sys_get_temp_dir; +use function trigger_error; +use function usleep; +use const E_USER_DEPRECATED; +use const LOCK_EX; +use const LOCK_NB; +use const LOCK_UN; + +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use %s or %s instead.', LockHandler::class, SemaphoreStore::class, FlockStore::class), E_USER_DEPRECATED); /** * LockHandler class provides a simple abstraction to lock anything by means of * a file lock. @@ -41,15 +60,15 @@ class LockHandler */ public function __construct($name, $lockPath = null) { - $lockPath = $lockPath ?: \sys_get_temp_dir(); - if (!\is_dir($lockPath)) { - $fs = new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Filesystem(); + $lockPath = $lockPath ?: sys_get_temp_dir(); + if (!is_dir($lockPath)) { + $fs = new Filesystem(); $fs->mkdir($lockPath); } - if (!\is_writable($lockPath)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException(\sprintf('The directory "%s" is not writable.', $lockPath), 0, null, $lockPath); + if (!is_writable($lockPath)) { + throw new IOException(sprintf('The directory "%s" is not writable.', $lockPath), 0, null, $lockPath); } - $this->file = \sprintf('%s/sf.%s.%s.lock', $lockPath, \preg_replace('/[^a-z0-9\\._-]+/i', '-', $name), \hash('sha256', $name)); + $this->file = sprintf('%s/sf.%s.%s.lock', $lockPath, preg_replace('/[^a-z0-9\\._-]+/i', '-', $name), hash('sha256', $name)); } /** * Lock the resource. @@ -60,37 +79,37 @@ public function __construct($name, $lockPath = null) * * @throws IOException If the lock file could not be created or opened */ - public function lock($blocking = \false) + public function lock($blocking = false) { if ($this->handle) { - return \true; + return true; } $error = null; // Silence error reporting - \set_error_handler(function ($errno, $msg) use(&$error) { + set_error_handler(function ($errno, $msg) use(&$error) { $error = $msg; }); - if (!($this->handle = \fopen($this->file, 'r+') ?: \fopen($this->file, 'r'))) { - if ($this->handle = \fopen($this->file, 'x')) { - \chmod($this->file, 0666); - } elseif (!($this->handle = \fopen($this->file, 'r+') ?: \fopen($this->file, 'r'))) { - \usleep(100); + if (!($this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r'))) { + if ($this->handle = fopen($this->file, 'x')) { + chmod($this->file, 0666); + } elseif (!($this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r'))) { + usleep(100); // Give some time for chmod() to complete - $this->handle = \fopen($this->file, 'r+') ?: \fopen($this->file, 'r'); + $this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r'); } } - \restore_error_handler(); + restore_error_handler(); if (!$this->handle) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException($error, 0, null, $this->file); + throw new IOException($error, 0, null, $this->file); } // On Windows, even if PHP doc says the contrary, LOCK_NB works, see // https://bugs.php.net/54129 - if (!\flock($this->handle, \LOCK_EX | ($blocking ? 0 : \LOCK_NB))) { - \fclose($this->handle); + if (!flock($this->handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) { + fclose($this->handle); $this->handle = null; - return \false; + return false; } - return \true; + return true; } /** * Release the resource. @@ -98,8 +117,8 @@ public function lock($blocking = \false) public function release() { if ($this->handle) { - \flock($this->handle, \LOCK_UN | \LOCK_NB); - \fclose($this->handle); + flock($this->handle, LOCK_UN | LOCK_NB); + fclose($this->handle); $this->handle = null; } } diff --git a/vendor/symfony/filesystem/Tests/ExceptionTest.php b/vendor/symfony/filesystem/Tests/ExceptionTest.php index fd2b19328..33c03ea02 100644 --- a/vendor/symfony/filesystem/Tests/ExceptionTest.php +++ b/vendor/symfony/filesystem/Tests/ExceptionTest.php @@ -16,27 +16,27 @@ /** * Test class for Filesystem. */ -class ExceptionTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class ExceptionTest extends TestCase { public function testGetPath() { - $e = new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException('', 0, null, '/foo'); + $e = new IOException('', 0, null, '/foo'); $this->assertEquals('/foo', $e->getPath(), 'The pass should be returned.'); } public function testGeneratedMessage() { - $e = new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\FileNotFoundException(null, 0, null, '/foo'); + $e = new FileNotFoundException(null, 0, null, '/foo'); $this->assertEquals('/foo', $e->getPath()); $this->assertEquals('File "/foo" could not be found.', $e->getMessage(), 'A message should be generated.'); } public function testGeneratedMessageWithoutPath() { - $e = new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\FileNotFoundException(); + $e = new FileNotFoundException(); $this->assertEquals('File could not be found.', $e->getMessage(), 'A message should be generated.'); } public function testCustomMessage() { - $e = new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\FileNotFoundException('bar', 0, null, '/foo'); + $e = new FileNotFoundException('bar', 0, null, '/foo'); $this->assertEquals('bar', $e->getMessage(), 'A custom message should be possible still.'); } } diff --git a/vendor/symfony/filesystem/Tests/FilesystemTest.php b/vendor/symfony/filesystem/Tests/FilesystemTest.php index c235c2d48..1251bcb8e 100644 --- a/vendor/symfony/filesystem/Tests/FilesystemTest.php +++ b/vendor/symfony/filesystem/Tests/FilesystemTest.php @@ -10,16 +10,58 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Tests; +use ArrayObject; +use Phar; +use function chdir; +use function chmod; +use function defined; +use function exec; +use function fclose; +use function file_get_contents; +use function file_put_contents; +use function fileinode; +use function fileperms; +use function fopen; +use function fseek; +use function fwrite; +use function getcwd; +use function getenv; +use function in_array; +use function is_dir; +use function is_file; +use function is_link; +use function link; +use function mkdir; +use function mt_rand; +use function readlink; +use function realpath; +use function rmdir; +use function rtrim; +use function str_repeat; +use function str_replace; +use function stream_get_wrappers; +use function stream_wrapper_register; +use function strlen; +use function symlink; +use function sys_get_temp_dir; +use function time; +use function touch; +use function umask; +use function uniqid; +use function unlink; +use const DIRECTORY_SEPARATOR; +use const PHP_MAXPATHLEN; + /** * Test class for Filesystem. */ -class FilesystemTest extends \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Tests\FilesystemTestCase +class FilesystemTest extends FilesystemTestCase { public function testCopyCreatesNewFile() { - $sourceFilePath = $this->workspace . \DIRECTORY_SEPARATOR . 'copy_source_file'; - $targetFilePath = $this->workspace . \DIRECTORY_SEPARATOR . 'copy_target_file'; - \file_put_contents($sourceFilePath, 'SOURCE FILE'); + $sourceFilePath = $this->workspace . DIRECTORY_SEPARATOR . 'copy_source_file'; + $targetFilePath = $this->workspace . DIRECTORY_SEPARATOR . 'copy_target_file'; + file_put_contents($sourceFilePath, 'SOURCE FILE'); $this->filesystem->copy($sourceFilePath, $targetFilePath); $this->assertFileExists($targetFilePath); $this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE'); @@ -27,63 +69,63 @@ public function testCopyCreatesNewFile() public function testCopyFails() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Filesystem\\Exception\\IOException'); - $sourceFilePath = $this->workspace . \DIRECTORY_SEPARATOR . 'copy_source_file'; - $targetFilePath = $this->workspace . \DIRECTORY_SEPARATOR . 'copy_target_file'; + $sourceFilePath = $this->workspace . DIRECTORY_SEPARATOR . 'copy_source_file'; + $targetFilePath = $this->workspace . DIRECTORY_SEPARATOR . 'copy_target_file'; $this->filesystem->copy($sourceFilePath, $targetFilePath); } public function testCopyUnreadableFileFails() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Filesystem\\Exception\\IOException'); // skip test on Windows; PHP can't easily set file as unreadable on Windows - if ('\\' === \DIRECTORY_SEPARATOR) { + if ('\\' === DIRECTORY_SEPARATOR) { $this->markTestSkipped('This test cannot run on Windows.'); } - if (!\getenv('USER') || 'root' === \getenv('USER')) { + if (!getenv('USER') || 'root' === getenv('USER')) { $this->markTestSkipped('This test will fail if run under superuser'); } - $sourceFilePath = $this->workspace . \DIRECTORY_SEPARATOR . 'copy_source_file'; - $targetFilePath = $this->workspace . \DIRECTORY_SEPARATOR . 'copy_target_file'; - \file_put_contents($sourceFilePath, 'SOURCE FILE'); + $sourceFilePath = $this->workspace . DIRECTORY_SEPARATOR . 'copy_source_file'; + $targetFilePath = $this->workspace . DIRECTORY_SEPARATOR . 'copy_target_file'; + file_put_contents($sourceFilePath, 'SOURCE FILE'); // make sure target cannot be read $this->filesystem->chmod($sourceFilePath, 0222); $this->filesystem->copy($sourceFilePath, $targetFilePath); } public function testCopyOverridesExistingFileIfModified() { - $sourceFilePath = $this->workspace . \DIRECTORY_SEPARATOR . 'copy_source_file'; - $targetFilePath = $this->workspace . \DIRECTORY_SEPARATOR . 'copy_target_file'; - \file_put_contents($sourceFilePath, 'SOURCE FILE'); - \file_put_contents($targetFilePath, 'TARGET FILE'); - \touch($targetFilePath, \time() - 1000); + $sourceFilePath = $this->workspace . DIRECTORY_SEPARATOR . 'copy_source_file'; + $targetFilePath = $this->workspace . DIRECTORY_SEPARATOR . 'copy_target_file'; + file_put_contents($sourceFilePath, 'SOURCE FILE'); + file_put_contents($targetFilePath, 'TARGET FILE'); + touch($targetFilePath, time() - 1000); $this->filesystem->copy($sourceFilePath, $targetFilePath); $this->assertFileExists($targetFilePath); $this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE'); } public function testCopyDoesNotOverrideExistingFileByDefault() { - $sourceFilePath = $this->workspace . \DIRECTORY_SEPARATOR . 'copy_source_file'; - $targetFilePath = $this->workspace . \DIRECTORY_SEPARATOR . 'copy_target_file'; - \file_put_contents($sourceFilePath, 'SOURCE FILE'); - \file_put_contents($targetFilePath, 'TARGET FILE'); + $sourceFilePath = $this->workspace . DIRECTORY_SEPARATOR . 'copy_source_file'; + $targetFilePath = $this->workspace . DIRECTORY_SEPARATOR . 'copy_target_file'; + file_put_contents($sourceFilePath, 'SOURCE FILE'); + file_put_contents($targetFilePath, 'TARGET FILE'); // make sure both files have the same modification time - $modificationTime = \time() - 1000; - \touch($sourceFilePath, $modificationTime); - \touch($targetFilePath, $modificationTime); + $modificationTime = time() - 1000; + touch($sourceFilePath, $modificationTime); + touch($targetFilePath, $modificationTime); $this->filesystem->copy($sourceFilePath, $targetFilePath); $this->assertFileExists($targetFilePath); $this->assertStringEqualsFile($targetFilePath, 'TARGET FILE'); } public function testCopyOverridesExistingFileIfForced() { - $sourceFilePath = $this->workspace . \DIRECTORY_SEPARATOR . 'copy_source_file'; - $targetFilePath = $this->workspace . \DIRECTORY_SEPARATOR . 'copy_target_file'; - \file_put_contents($sourceFilePath, 'SOURCE FILE'); - \file_put_contents($targetFilePath, 'TARGET FILE'); + $sourceFilePath = $this->workspace . DIRECTORY_SEPARATOR . 'copy_source_file'; + $targetFilePath = $this->workspace . DIRECTORY_SEPARATOR . 'copy_target_file'; + file_put_contents($sourceFilePath, 'SOURCE FILE'); + file_put_contents($targetFilePath, 'TARGET FILE'); // make sure both files have the same modification time - $modificationTime = \time() - 1000; - \touch($sourceFilePath, $modificationTime); - \touch($targetFilePath, $modificationTime); - $this->filesystem->copy($sourceFilePath, $targetFilePath, \true); + $modificationTime = time() - 1000; + touch($sourceFilePath, $modificationTime); + touch($targetFilePath, $modificationTime); + $this->filesystem->copy($sourceFilePath, $targetFilePath, true); $this->assertFileExists($targetFilePath); $this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE'); } @@ -91,30 +133,30 @@ public function testCopyWithOverrideWithReadOnlyTargetFails() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Filesystem\\Exception\\IOException'); // skip test on Windows; PHP can't easily set file as unwritable on Windows - if ('\\' === \DIRECTORY_SEPARATOR) { + if ('\\' === DIRECTORY_SEPARATOR) { $this->markTestSkipped('This test cannot run on Windows.'); } - if (!\getenv('USER') || 'root' === \getenv('USER')) { + if (!getenv('USER') || 'root' === getenv('USER')) { $this->markTestSkipped('This test will fail if run under superuser'); } - $sourceFilePath = $this->workspace . \DIRECTORY_SEPARATOR . 'copy_source_file'; - $targetFilePath = $this->workspace . \DIRECTORY_SEPARATOR . 'copy_target_file'; - \file_put_contents($sourceFilePath, 'SOURCE FILE'); - \file_put_contents($targetFilePath, 'TARGET FILE'); + $sourceFilePath = $this->workspace . DIRECTORY_SEPARATOR . 'copy_source_file'; + $targetFilePath = $this->workspace . DIRECTORY_SEPARATOR . 'copy_target_file'; + file_put_contents($sourceFilePath, 'SOURCE FILE'); + file_put_contents($targetFilePath, 'TARGET FILE'); // make sure both files have the same modification time - $modificationTime = \time() - 1000; - \touch($sourceFilePath, $modificationTime); - \touch($targetFilePath, $modificationTime); + $modificationTime = time() - 1000; + touch($sourceFilePath, $modificationTime); + touch($targetFilePath, $modificationTime); // make sure target is read-only $this->filesystem->chmod($targetFilePath, 0444); - $this->filesystem->copy($sourceFilePath, $targetFilePath, \true); + $this->filesystem->copy($sourceFilePath, $targetFilePath, true); } public function testCopyCreatesTargetDirectoryIfItDoesNotExist() { - $sourceFilePath = $this->workspace . \DIRECTORY_SEPARATOR . 'copy_source_file'; - $targetFileDirectory = $this->workspace . \DIRECTORY_SEPARATOR . 'directory'; - $targetFilePath = $targetFileDirectory . \DIRECTORY_SEPARATOR . 'copy_target_file'; - \file_put_contents($sourceFilePath, 'SOURCE FILE'); + $sourceFilePath = $this->workspace . DIRECTORY_SEPARATOR . 'copy_source_file'; + $targetFileDirectory = $this->workspace . DIRECTORY_SEPARATOR . 'directory'; + $targetFilePath = $targetFileDirectory . DIRECTORY_SEPARATOR . 'copy_target_file'; + file_put_contents($sourceFilePath, 'SOURCE FILE'); $this->filesystem->copy($sourceFilePath, $targetFilePath); $this->assertDirectoryExists($targetFileDirectory); $this->assertFileExists($targetFilePath); @@ -125,25 +167,25 @@ public function testCopyCreatesTargetDirectoryIfItDoesNotExist() */ public function testCopyForOriginUrlsAndExistingLocalFileDefaultsToCopy() { - if (!\in_array('https', \stream_get_wrappers())) { + if (!in_array('https', stream_get_wrappers())) { $this->markTestSkipped('"https" stream wrapper is not enabled.'); } $sourceFilePath = 'https://symfony.com/images/common/logo/logo_symfony_header.png'; - $targetFilePath = $this->workspace . \DIRECTORY_SEPARATOR . 'copy_target_file'; - \file_put_contents($targetFilePath, 'TARGET FILE'); - $this->filesystem->copy($sourceFilePath, $targetFilePath, \false); + $targetFilePath = $this->workspace . DIRECTORY_SEPARATOR . 'copy_target_file'; + file_put_contents($targetFilePath, 'TARGET FILE'); + $this->filesystem->copy($sourceFilePath, $targetFilePath, false); $this->assertFileExists($targetFilePath); - $this->assertEquals(\file_get_contents($sourceFilePath), \file_get_contents($targetFilePath)); + $this->assertEquals(file_get_contents($sourceFilePath), file_get_contents($targetFilePath)); } public function testMkdirCreatesDirectoriesRecursively() { - $directory = $this->workspace . \DIRECTORY_SEPARATOR . 'directory' . \DIRECTORY_SEPARATOR . 'sub_directory'; + $directory = $this->workspace . DIRECTORY_SEPARATOR . 'directory' . DIRECTORY_SEPARATOR . 'sub_directory'; $this->filesystem->mkdir($directory); $this->assertDirectoryExists($directory); } public function testMkdirCreatesDirectoriesFromArray() { - $basePath = $this->workspace . \DIRECTORY_SEPARATOR; + $basePath = $this->workspace . DIRECTORY_SEPARATOR; $directories = [$basePath . '1', $basePath . '2', $basePath . '3']; $this->filesystem->mkdir($directories); $this->assertDirectoryExists($basePath . '1'); @@ -152,8 +194,8 @@ public function testMkdirCreatesDirectoriesFromArray() } public function testMkdirCreatesDirectoriesFromTraversableObject() { - $basePath = $this->workspace . \DIRECTORY_SEPARATOR; - $directories = new \ArrayObject([$basePath . '1', $basePath . '2', $basePath . '3']); + $basePath = $this->workspace . DIRECTORY_SEPARATOR; + $directories = new ArrayObject([$basePath . '1', $basePath . '2', $basePath . '3']); $this->filesystem->mkdir($directories); $this->assertDirectoryExists($basePath . '1'); $this->assertDirectoryExists($basePath . '2'); @@ -162,26 +204,26 @@ public function testMkdirCreatesDirectoriesFromTraversableObject() public function testMkdirCreatesDirectoriesFails() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Filesystem\\Exception\\IOException'); - $basePath = $this->workspace . \DIRECTORY_SEPARATOR; + $basePath = $this->workspace . DIRECTORY_SEPARATOR; $dir = $basePath . '2'; - \file_put_contents($dir, ''); + file_put_contents($dir, ''); $this->filesystem->mkdir($dir); } public function testTouchCreatesEmptyFile() { - $file = $this->workspace . \DIRECTORY_SEPARATOR . '1'; + $file = $this->workspace . DIRECTORY_SEPARATOR . '1'; $this->filesystem->touch($file); $this->assertFileExists($file); } public function testTouchFails() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Filesystem\\Exception\\IOException'); - $file = $this->workspace . \DIRECTORY_SEPARATOR . '1' . \DIRECTORY_SEPARATOR . '2'; + $file = $this->workspace . DIRECTORY_SEPARATOR . '1' . DIRECTORY_SEPARATOR . '2'; $this->filesystem->touch($file); } public function testTouchCreatesEmptyFilesFromArray() { - $basePath = $this->workspace . \DIRECTORY_SEPARATOR; + $basePath = $this->workspace . DIRECTORY_SEPARATOR; $files = [$basePath . '1', $basePath . '2', $basePath . '3']; $this->filesystem->touch($files); $this->assertFileExists($basePath . '1'); @@ -190,8 +232,8 @@ public function testTouchCreatesEmptyFilesFromArray() } public function testTouchCreatesEmptyFilesFromTraversableObject() { - $basePath = $this->workspace . \DIRECTORY_SEPARATOR; - $files = new \ArrayObject([$basePath . '1', $basePath . '2', $basePath . '3']); + $basePath = $this->workspace . DIRECTORY_SEPARATOR; + $files = new ArrayObject([$basePath . '1', $basePath . '2', $basePath . '3']); $this->filesystem->touch($files); $this->assertFileExists($basePath . '1'); $this->assertFileExists($basePath . '2'); @@ -199,18 +241,18 @@ public function testTouchCreatesEmptyFilesFromTraversableObject() } public function testRemoveCleansFilesAndDirectoriesIteratively() { - $basePath = $this->workspace . \DIRECTORY_SEPARATOR . 'directory' . \DIRECTORY_SEPARATOR; - \mkdir($basePath); - \mkdir($basePath . 'dir'); - \touch($basePath . 'file'); + $basePath = $this->workspace . DIRECTORY_SEPARATOR . 'directory' . DIRECTORY_SEPARATOR; + mkdir($basePath); + mkdir($basePath . 'dir'); + touch($basePath . 'file'); $this->filesystem->remove($basePath); $this->assertFileNotExists($basePath); } public function testRemoveCleansArrayOfFilesAndDirectories() { - $basePath = $this->workspace . \DIRECTORY_SEPARATOR; - \mkdir($basePath . 'dir'); - \touch($basePath . 'file'); + $basePath = $this->workspace . DIRECTORY_SEPARATOR; + mkdir($basePath . 'dir'); + touch($basePath . 'file'); $files = [$basePath . 'dir', $basePath . 'file']; $this->filesystem->remove($files); $this->assertFileNotExists($basePath . 'dir'); @@ -218,18 +260,18 @@ public function testRemoveCleansArrayOfFilesAndDirectories() } public function testRemoveCleansTraversableObjectOfFilesAndDirectories() { - $basePath = $this->workspace . \DIRECTORY_SEPARATOR; - \mkdir($basePath . 'dir'); - \touch($basePath . 'file'); - $files = new \ArrayObject([$basePath . 'dir', $basePath . 'file']); + $basePath = $this->workspace . DIRECTORY_SEPARATOR; + mkdir($basePath . 'dir'); + touch($basePath . 'file'); + $files = new ArrayObject([$basePath . 'dir', $basePath . 'file']); $this->filesystem->remove($files); $this->assertFileNotExists($basePath . 'dir'); $this->assertFileNotExists($basePath . 'file'); } public function testRemoveIgnoresNonExistingFiles() { - $basePath = $this->workspace . \DIRECTORY_SEPARATOR; - \mkdir($basePath . 'dir'); + $basePath = $this->workspace . DIRECTORY_SEPARATOR; + mkdir($basePath . 'dir'); $files = [$basePath . 'dir', $basePath . 'file']; $this->filesystem->remove($files); $this->assertFileNotExists($basePath . 'dir'); @@ -237,79 +279,79 @@ public function testRemoveIgnoresNonExistingFiles() public function testRemoveCleansInvalidLinks() { $this->markAsSkippedIfSymlinkIsMissing(); - $basePath = $this->workspace . \DIRECTORY_SEPARATOR . 'directory' . \DIRECTORY_SEPARATOR; - \mkdir($basePath); - \mkdir($basePath . 'dir'); + $basePath = $this->workspace . DIRECTORY_SEPARATOR . 'directory' . DIRECTORY_SEPARATOR; + mkdir($basePath); + mkdir($basePath . 'dir'); // create symlink to nonexistent file - @\symlink($basePath . 'file', $basePath . 'file-link'); + @symlink($basePath . 'file', $basePath . 'file-link'); // create symlink to dir using trailing forward slash $this->filesystem->symlink($basePath . 'dir/', $basePath . 'dir-link'); $this->assertDirectoryExists($basePath . 'dir-link'); // create symlink to nonexistent dir - \rmdir($basePath . 'dir'); - $this->assertFalse('\\' === \DIRECTORY_SEPARATOR ? @\readlink($basePath . 'dir-link') : \is_dir($basePath . 'dir-link')); + rmdir($basePath . 'dir'); + $this->assertFalse('\\' === DIRECTORY_SEPARATOR ? @readlink($basePath . 'dir-link') : is_dir($basePath . 'dir-link')); $this->filesystem->remove($basePath); $this->assertFileNotExists($basePath); } public function testFilesExists() { - $basePath = $this->workspace . \DIRECTORY_SEPARATOR . 'directory' . \DIRECTORY_SEPARATOR; - \mkdir($basePath); - \touch($basePath . 'file1'); - \mkdir($basePath . 'folder'); + $basePath = $this->workspace . DIRECTORY_SEPARATOR . 'directory' . DIRECTORY_SEPARATOR; + mkdir($basePath); + touch($basePath . 'file1'); + mkdir($basePath . 'folder'); $this->assertTrue($this->filesystem->exists($basePath . 'file1')); $this->assertTrue($this->filesystem->exists($basePath . 'folder')); } public function testFilesExistsFails() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Filesystem\\Exception\\IOException'); - if ('\\' !== \DIRECTORY_SEPARATOR) { + if ('\\' !== DIRECTORY_SEPARATOR) { $this->markTestSkipped('Long file names are an issue on Windows'); } $basePath = $this->workspace . '\\directory\\'; - $maxPathLength = \PHP_MAXPATHLEN - 2; - $oldPath = \getcwd(); - \mkdir($basePath); - \chdir($basePath); - $file = \str_repeat('T', $maxPathLength - \strlen($basePath) + 1); + $maxPathLength = PHP_MAXPATHLEN - 2; + $oldPath = getcwd(); + mkdir($basePath); + chdir($basePath); + $file = str_repeat('T', $maxPathLength - strlen($basePath) + 1); $path = $basePath . $file; - \exec('TYPE NUL >>' . $file); + exec('TYPE NUL >>' . $file); // equivalent of touch, we can not use the php touch() here because it suffers from the same limitation $this->longPathNamesWindows[] = $path; // save this so we can clean up later - \chdir($oldPath); + chdir($oldPath); $this->filesystem->exists($path); } public function testFilesExistsTraversableObjectOfFilesAndDirectories() { - $basePath = $this->workspace . \DIRECTORY_SEPARATOR; - \mkdir($basePath . 'dir'); - \touch($basePath . 'file'); - $files = new \ArrayObject([$basePath . 'dir', $basePath . 'file']); + $basePath = $this->workspace . DIRECTORY_SEPARATOR; + mkdir($basePath . 'dir'); + touch($basePath . 'file'); + $files = new ArrayObject([$basePath . 'dir', $basePath . 'file']); $this->assertTrue($this->filesystem->exists($files)); } public function testFilesNotExistsTraversableObjectOfFilesAndDirectories() { - $basePath = $this->workspace . \DIRECTORY_SEPARATOR; - \mkdir($basePath . 'dir'); - \touch($basePath . 'file'); - \touch($basePath . 'file2'); - $files = new \ArrayObject([$basePath . 'dir', $basePath . 'file', $basePath . 'file2']); - \unlink($basePath . 'file'); + $basePath = $this->workspace . DIRECTORY_SEPARATOR; + mkdir($basePath . 'dir'); + touch($basePath . 'file'); + touch($basePath . 'file2'); + $files = new ArrayObject([$basePath . 'dir', $basePath . 'file', $basePath . 'file2']); + unlink($basePath . 'file'); $this->assertFalse($this->filesystem->exists($files)); } public function testInvalidFileNotExists() { - $basePath = $this->workspace . \DIRECTORY_SEPARATOR . 'directory' . \DIRECTORY_SEPARATOR; - $this->assertFalse($this->filesystem->exists($basePath . \time())); + $basePath = $this->workspace . DIRECTORY_SEPARATOR . 'directory' . DIRECTORY_SEPARATOR; + $this->assertFalse($this->filesystem->exists($basePath . time())); } public function testChmodChangesFileMode() { $this->markAsSkippedIfChmodIsMissing(); - $dir = $this->workspace . \DIRECTORY_SEPARATOR . 'dir'; - \mkdir($dir); - $file = $dir . \DIRECTORY_SEPARATOR . 'file'; - \touch($file); + $dir = $this->workspace . DIRECTORY_SEPARATOR . 'dir'; + mkdir($dir); + $file = $dir . DIRECTORY_SEPARATOR . 'file'; + touch($file); $this->filesystem->chmod($file, 0400); $this->filesystem->chmod($dir, 0753); $this->assertFilePermissions(753, $dir); @@ -318,43 +360,43 @@ public function testChmodChangesFileMode() public function testChmodWithWrongModLeavesPreviousPermissionsUntouched() { $this->markAsSkippedIfChmodIsMissing(); - if (\defined('HHVM_VERSION')) { + if (defined('HHVM_VERSION')) { $this->markTestSkipped('chmod() changes permissions even when passing invalid modes on HHVM'); } - $dir = $this->workspace . \DIRECTORY_SEPARATOR . 'file'; - \touch($dir); - $permissions = \fileperms($dir); + $dir = $this->workspace . DIRECTORY_SEPARATOR . 'file'; + touch($dir); + $permissions = fileperms($dir); $this->filesystem->chmod($dir, 'Wrongmode'); - $this->assertSame($permissions, \fileperms($dir)); + $this->assertSame($permissions, fileperms($dir)); } public function testChmodRecursive() { $this->markAsSkippedIfChmodIsMissing(); - $dir = $this->workspace . \DIRECTORY_SEPARATOR . 'dir'; - \mkdir($dir); - $file = $dir . \DIRECTORY_SEPARATOR . 'file'; - \touch($file); - $this->filesystem->chmod($file, 0400, 00, \true); - $this->filesystem->chmod($dir, 0753, 00, \true); + $dir = $this->workspace . DIRECTORY_SEPARATOR . 'dir'; + mkdir($dir); + $file = $dir . DIRECTORY_SEPARATOR . 'file'; + touch($file); + $this->filesystem->chmod($file, 0400, 00, true); + $this->filesystem->chmod($dir, 0753, 00, true); $this->assertFilePermissions(753, $dir); $this->assertFilePermissions(753, $file); } public function testChmodAppliesUmask() { $this->markAsSkippedIfChmodIsMissing(); - $file = $this->workspace . \DIRECTORY_SEPARATOR . 'file'; - \touch($file); + $file = $this->workspace . DIRECTORY_SEPARATOR . 'file'; + touch($file); $this->filesystem->chmod($file, 0770, 022); $this->assertFilePermissions(750, $file); } public function testChmodChangesModeOfArrayOfFiles() { $this->markAsSkippedIfChmodIsMissing(); - $directory = $this->workspace . \DIRECTORY_SEPARATOR . 'directory'; - $file = $this->workspace . \DIRECTORY_SEPARATOR . 'file'; + $directory = $this->workspace . DIRECTORY_SEPARATOR . 'directory'; + $file = $this->workspace . DIRECTORY_SEPARATOR . 'file'; $files = [$directory, $file]; - \mkdir($directory); - \touch($file); + mkdir($directory); + touch($file); $this->filesystem->chmod($files, 0753); $this->assertFilePermissions(753, $file); $this->assertFilePermissions(753, $directory); @@ -362,11 +404,11 @@ public function testChmodChangesModeOfArrayOfFiles() public function testChmodChangesModeOfTraversableFileObject() { $this->markAsSkippedIfChmodIsMissing(); - $directory = $this->workspace . \DIRECTORY_SEPARATOR . 'directory'; - $file = $this->workspace . \DIRECTORY_SEPARATOR . 'file'; - $files = new \ArrayObject([$directory, $file]); - \mkdir($directory); - \touch($file); + $directory = $this->workspace . DIRECTORY_SEPARATOR . 'directory'; + $file = $this->workspace . DIRECTORY_SEPARATOR . 'file'; + $files = new ArrayObject([$directory, $file]); + mkdir($directory); + touch($file); $this->filesystem->chmod($files, 0753); $this->assertFilePermissions(753, $file); $this->assertFilePermissions(753, $directory); @@ -374,19 +416,19 @@ public function testChmodChangesModeOfTraversableFileObject() public function testChmodChangesZeroModeOnSubdirectoriesOnRecursive() { $this->markAsSkippedIfChmodIsMissing(); - $directory = $this->workspace . \DIRECTORY_SEPARATOR . 'directory'; - $subdirectory = $directory . \DIRECTORY_SEPARATOR . 'subdirectory'; - \mkdir($directory); - \mkdir($subdirectory); - \chmod($subdirectory, 00); - $this->filesystem->chmod($directory, 0753, 00, \true); + $directory = $this->workspace . DIRECTORY_SEPARATOR . 'directory'; + $subdirectory = $directory . DIRECTORY_SEPARATOR . 'subdirectory'; + mkdir($directory); + mkdir($subdirectory); + chmod($subdirectory, 00); + $this->filesystem->chmod($directory, 0753, 00, true); $this->assertFilePermissions(753, $subdirectory); } public function testChown() { $this->markAsSkippedIfPosixIsMissing(); - $dir = $this->workspace . \DIRECTORY_SEPARATOR . 'dir'; - \mkdir($dir); + $dir = $this->workspace . DIRECTORY_SEPARATOR . 'dir'; + mkdir($dir); $owner = $this->getFileOwner($dir); $this->filesystem->chown($dir, $owner); $this->assertSame($owner, $this->getFileOwner($dir)); @@ -394,20 +436,20 @@ public function testChown() public function testChownRecursive() { $this->markAsSkippedIfPosixIsMissing(); - $dir = $this->workspace . \DIRECTORY_SEPARATOR . 'dir'; - \mkdir($dir); - $file = $dir . \DIRECTORY_SEPARATOR . 'file'; - \touch($file); + $dir = $this->workspace . DIRECTORY_SEPARATOR . 'dir'; + mkdir($dir); + $file = $dir . DIRECTORY_SEPARATOR . 'file'; + touch($file); $owner = $this->getFileOwner($dir); - $this->filesystem->chown($dir, $owner, \true); + $this->filesystem->chown($dir, $owner, true); $this->assertSame($owner, $this->getFileOwner($file)); } public function testChownSymlink() { $this->markAsSkippedIfSymlinkIsMissing(); - $file = $this->workspace . \DIRECTORY_SEPARATOR . 'file'; - $link = $this->workspace . \DIRECTORY_SEPARATOR . 'link'; - \touch($file); + $file = $this->workspace . DIRECTORY_SEPARATOR . 'file'; + $link = $this->workspace . DIRECTORY_SEPARATOR . 'link'; + touch($file); $this->filesystem->symlink($file, $link); $owner = $this->getFileOwner($link); $this->filesystem->chown($link, $owner); @@ -416,9 +458,9 @@ public function testChownSymlink() public function testChownLink() { $this->markAsSkippedIfLinkIsMissing(); - $file = $this->workspace . \DIRECTORY_SEPARATOR . 'file'; - $link = $this->workspace . \DIRECTORY_SEPARATOR . 'link'; - \touch($file); + $file = $this->workspace . DIRECTORY_SEPARATOR . 'file'; + $link = $this->workspace . DIRECTORY_SEPARATOR . 'link'; + touch($file); $this->filesystem->hardlink($file, $link); $owner = $this->getFileOwner($link); $this->filesystem->chown($link, $owner); @@ -428,35 +470,35 @@ public function testChownSymlinkFails() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Filesystem\\Exception\\IOException'); $this->markAsSkippedIfSymlinkIsMissing(); - $file = $this->workspace . \DIRECTORY_SEPARATOR . 'file'; - $link = $this->workspace . \DIRECTORY_SEPARATOR . 'link'; - \touch($file); + $file = $this->workspace . DIRECTORY_SEPARATOR . 'file'; + $link = $this->workspace . DIRECTORY_SEPARATOR . 'link'; + touch($file); $this->filesystem->symlink($file, $link); - $this->filesystem->chown($link, 'user' . \time() . \mt_rand(1000, 9999)); + $this->filesystem->chown($link, 'user' . time() . mt_rand(1000, 9999)); } public function testChownLinkFails() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Filesystem\\Exception\\IOException'); $this->markAsSkippedIfLinkIsMissing(); - $file = $this->workspace . \DIRECTORY_SEPARATOR . 'file'; - $link = $this->workspace . \DIRECTORY_SEPARATOR . 'link'; - \touch($file); + $file = $this->workspace . DIRECTORY_SEPARATOR . 'file'; + $link = $this->workspace . DIRECTORY_SEPARATOR . 'link'; + touch($file); $this->filesystem->hardlink($file, $link); - $this->filesystem->chown($link, 'user' . \time() . \mt_rand(1000, 9999)); + $this->filesystem->chown($link, 'user' . time() . mt_rand(1000, 9999)); } public function testChownFail() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Filesystem\\Exception\\IOException'); $this->markAsSkippedIfPosixIsMissing(); - $dir = $this->workspace . \DIRECTORY_SEPARATOR . 'dir'; - \mkdir($dir); - $this->filesystem->chown($dir, 'user' . \time() . \mt_rand(1000, 9999)); + $dir = $this->workspace . DIRECTORY_SEPARATOR . 'dir'; + mkdir($dir); + $this->filesystem->chown($dir, 'user' . time() . mt_rand(1000, 9999)); } public function testChgrp() { $this->markAsSkippedIfPosixIsMissing(); - $dir = $this->workspace . \DIRECTORY_SEPARATOR . 'dir'; - \mkdir($dir); + $dir = $this->workspace . DIRECTORY_SEPARATOR . 'dir'; + mkdir($dir); $group = $this->getFileGroup($dir); $this->filesystem->chgrp($dir, $group); $this->assertSame($group, $this->getFileGroup($dir)); @@ -464,20 +506,20 @@ public function testChgrp() public function testChgrpRecursive() { $this->markAsSkippedIfPosixIsMissing(); - $dir = $this->workspace . \DIRECTORY_SEPARATOR . 'dir'; - \mkdir($dir); - $file = $dir . \DIRECTORY_SEPARATOR . 'file'; - \touch($file); + $dir = $this->workspace . DIRECTORY_SEPARATOR . 'dir'; + mkdir($dir); + $file = $dir . DIRECTORY_SEPARATOR . 'file'; + touch($file); $group = $this->getFileGroup($dir); - $this->filesystem->chgrp($dir, $group, \true); + $this->filesystem->chgrp($dir, $group, true); $this->assertSame($group, $this->getFileGroup($file)); } public function testChgrpSymlink() { $this->markAsSkippedIfSymlinkIsMissing(); - $file = $this->workspace . \DIRECTORY_SEPARATOR . 'file'; - $link = $this->workspace . \DIRECTORY_SEPARATOR . 'link'; - \touch($file); + $file = $this->workspace . DIRECTORY_SEPARATOR . 'file'; + $link = $this->workspace . DIRECTORY_SEPARATOR . 'link'; + touch($file); $this->filesystem->symlink($file, $link); $group = $this->getFileGroup($link); $this->filesystem->chgrp($link, $group); @@ -486,9 +528,9 @@ public function testChgrpSymlink() public function testChgrpLink() { $this->markAsSkippedIfLinkIsMissing(); - $file = $this->workspace . \DIRECTORY_SEPARATOR . 'file'; - $link = $this->workspace . \DIRECTORY_SEPARATOR . 'link'; - \touch($file); + $file = $this->workspace . DIRECTORY_SEPARATOR . 'file'; + $link = $this->workspace . DIRECTORY_SEPARATOR . 'link'; + touch($file); $this->filesystem->hardlink($file, $link); $group = $this->getFileGroup($link); $this->filesystem->chgrp($link, $group); @@ -498,35 +540,35 @@ public function testChgrpSymlinkFails() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Filesystem\\Exception\\IOException'); $this->markAsSkippedIfSymlinkIsMissing(); - $file = $this->workspace . \DIRECTORY_SEPARATOR . 'file'; - $link = $this->workspace . \DIRECTORY_SEPARATOR . 'link'; - \touch($file); + $file = $this->workspace . DIRECTORY_SEPARATOR . 'file'; + $link = $this->workspace . DIRECTORY_SEPARATOR . 'link'; + touch($file); $this->filesystem->symlink($file, $link); - $this->filesystem->chgrp($link, 'user' . \time() . \mt_rand(1000, 9999)); + $this->filesystem->chgrp($link, 'user' . time() . mt_rand(1000, 9999)); } public function testChgrpLinkFails() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Filesystem\\Exception\\IOException'); $this->markAsSkippedIfLinkIsMissing(); - $file = $this->workspace . \DIRECTORY_SEPARATOR . 'file'; - $link = $this->workspace . \DIRECTORY_SEPARATOR . 'link'; - \touch($file); + $file = $this->workspace . DIRECTORY_SEPARATOR . 'file'; + $link = $this->workspace . DIRECTORY_SEPARATOR . 'link'; + touch($file); $this->filesystem->hardlink($file, $link); - $this->filesystem->chgrp($link, 'user' . \time() . \mt_rand(1000, 9999)); + $this->filesystem->chgrp($link, 'user' . time() . mt_rand(1000, 9999)); } public function testChgrpFail() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Filesystem\\Exception\\IOException'); $this->markAsSkippedIfPosixIsMissing(); - $dir = $this->workspace . \DIRECTORY_SEPARATOR . 'dir'; - \mkdir($dir); - $this->filesystem->chgrp($dir, 'user' . \time() . \mt_rand(1000, 9999)); + $dir = $this->workspace . DIRECTORY_SEPARATOR . 'dir'; + mkdir($dir); + $this->filesystem->chgrp($dir, 'user' . time() . mt_rand(1000, 9999)); } public function testRename() { - $file = $this->workspace . \DIRECTORY_SEPARATOR . 'file'; - $newPath = $this->workspace . \DIRECTORY_SEPARATOR . 'new_file'; - \touch($file); + $file = $this->workspace . DIRECTORY_SEPARATOR . 'file'; + $newPath = $this->workspace . DIRECTORY_SEPARATOR . 'new_file'; + touch($file); $this->filesystem->rename($file, $newPath); $this->assertFileNotExists($file); $this->assertFileExists($newPath); @@ -534,42 +576,42 @@ public function testRename() public function testRenameThrowsExceptionIfTargetAlreadyExists() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Filesystem\\Exception\\IOException'); - $file = $this->workspace . \DIRECTORY_SEPARATOR . 'file'; - $newPath = $this->workspace . \DIRECTORY_SEPARATOR . 'new_file'; - \touch($file); - \touch($newPath); + $file = $this->workspace . DIRECTORY_SEPARATOR . 'file'; + $newPath = $this->workspace . DIRECTORY_SEPARATOR . 'new_file'; + touch($file); + touch($newPath); $this->filesystem->rename($file, $newPath); } public function testRenameOverwritesTheTargetIfItAlreadyExists() { - $file = $this->workspace . \DIRECTORY_SEPARATOR . 'file'; - $newPath = $this->workspace . \DIRECTORY_SEPARATOR . 'new_file'; - \touch($file); - \touch($newPath); - $this->filesystem->rename($file, $newPath, \true); + $file = $this->workspace . DIRECTORY_SEPARATOR . 'file'; + $newPath = $this->workspace . DIRECTORY_SEPARATOR . 'new_file'; + touch($file); + touch($newPath); + $this->filesystem->rename($file, $newPath, true); $this->assertFileNotExists($file); $this->assertFileExists($newPath); } public function testRenameThrowsExceptionOnError() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Filesystem\\Exception\\IOException'); - $file = $this->workspace . \DIRECTORY_SEPARATOR . \uniqid('fs_test_', \true); - $newPath = $this->workspace . \DIRECTORY_SEPARATOR . 'new_file'; + $file = $this->workspace . DIRECTORY_SEPARATOR . uniqid('fs_test_', true); + $newPath = $this->workspace . DIRECTORY_SEPARATOR . 'new_file'; $this->filesystem->rename($file, $newPath); } public function testSymlink() { - if ('\\' === \DIRECTORY_SEPARATOR) { + if ('\\' === DIRECTORY_SEPARATOR) { $this->markTestSkipped('Windows does not support creating "broken" symlinks'); } - $file = $this->workspace . \DIRECTORY_SEPARATOR . 'file'; - $link = $this->workspace . \DIRECTORY_SEPARATOR . 'link'; + $file = $this->workspace . DIRECTORY_SEPARATOR . 'file'; + $link = $this->workspace . DIRECTORY_SEPARATOR . 'link'; // $file does not exist right now: creating "broken" links is a wanted feature $this->filesystem->symlink($file, $link); - $this->assertTrue(\is_link($link)); + $this->assertTrue(is_link($link)); // Create the linked file AFTER creating the link - \touch($file); - $this->assertEquals($file, \readlink($link)); + touch($file); + $this->assertEquals($file, readlink($link)); } /** * @depends testSymlink @@ -577,57 +619,57 @@ public function testSymlink() public function testRemoveSymlink() { $this->markAsSkippedIfSymlinkIsMissing(); - $link = $this->workspace . \DIRECTORY_SEPARATOR . 'link'; + $link = $this->workspace . DIRECTORY_SEPARATOR . 'link'; $this->filesystem->remove($link); - $this->assertFalse(\is_link($link)); - $this->assertFalse(\is_file($link)); + $this->assertFalse(is_link($link)); + $this->assertFalse(is_file($link)); $this->assertDirectoryNotExists($link); } public function testSymlinkIsOverwrittenIfPointsToDifferentTarget() { $this->markAsSkippedIfSymlinkIsMissing(); - $file = $this->workspace . \DIRECTORY_SEPARATOR . 'file'; - $link = $this->workspace . \DIRECTORY_SEPARATOR . 'link'; - \touch($file); - \symlink($this->workspace, $link); + $file = $this->workspace . DIRECTORY_SEPARATOR . 'file'; + $link = $this->workspace . DIRECTORY_SEPARATOR . 'link'; + touch($file); + symlink($this->workspace, $link); $this->filesystem->symlink($file, $link); - $this->assertTrue(\is_link($link)); - $this->assertEquals($file, \readlink($link)); + $this->assertTrue(is_link($link)); + $this->assertEquals($file, readlink($link)); } public function testSymlinkIsNotOverwrittenIfAlreadyCreated() { $this->markAsSkippedIfSymlinkIsMissing(); - $file = $this->workspace . \DIRECTORY_SEPARATOR . 'file'; - $link = $this->workspace . \DIRECTORY_SEPARATOR . 'link'; - \touch($file); - \symlink($file, $link); + $file = $this->workspace . DIRECTORY_SEPARATOR . 'file'; + $link = $this->workspace . DIRECTORY_SEPARATOR . 'link'; + touch($file); + symlink($file, $link); $this->filesystem->symlink($file, $link); - $this->assertTrue(\is_link($link)); - $this->assertEquals($file, \readlink($link)); + $this->assertTrue(is_link($link)); + $this->assertEquals($file, readlink($link)); } public function testSymlinkCreatesTargetDirectoryIfItDoesNotExist() { $this->markAsSkippedIfSymlinkIsMissing(); - $file = $this->workspace . \DIRECTORY_SEPARATOR . 'file'; - $link1 = $this->workspace . \DIRECTORY_SEPARATOR . 'dir' . \DIRECTORY_SEPARATOR . 'link'; - $link2 = $this->workspace . \DIRECTORY_SEPARATOR . 'dir' . \DIRECTORY_SEPARATOR . 'subdir' . \DIRECTORY_SEPARATOR . 'link'; - \touch($file); + $file = $this->workspace . DIRECTORY_SEPARATOR . 'file'; + $link1 = $this->workspace . DIRECTORY_SEPARATOR . 'dir' . DIRECTORY_SEPARATOR . 'link'; + $link2 = $this->workspace . DIRECTORY_SEPARATOR . 'dir' . DIRECTORY_SEPARATOR . 'subdir' . DIRECTORY_SEPARATOR . 'link'; + touch($file); $this->filesystem->symlink($file, $link1); $this->filesystem->symlink($file, $link2); - $this->assertTrue(\is_link($link1)); - $this->assertEquals($file, \readlink($link1)); - $this->assertTrue(\is_link($link2)); - $this->assertEquals($file, \readlink($link2)); + $this->assertTrue(is_link($link1)); + $this->assertEquals($file, readlink($link1)); + $this->assertTrue(is_link($link2)); + $this->assertEquals($file, readlink($link2)); } public function testLink() { $this->markAsSkippedIfLinkIsMissing(); - $file = $this->workspace . \DIRECTORY_SEPARATOR . 'file'; - $link = $this->workspace . \DIRECTORY_SEPARATOR . 'link'; - \touch($file); + $file = $this->workspace . DIRECTORY_SEPARATOR . 'file'; + $link = $this->workspace . DIRECTORY_SEPARATOR . 'link'; + touch($file); $this->filesystem->hardlink($file, $link); - $this->assertTrue(\is_file($link)); - $this->assertEquals(\fileinode($file), \fileinode($link)); + $this->assertTrue(is_file($link)); + $this->assertEquals(fileinode($file), fileinode($link)); } /** * @depends testLink @@ -635,75 +677,75 @@ public function testLink() public function testRemoveLink() { $this->markAsSkippedIfLinkIsMissing(); - $link = $this->workspace . \DIRECTORY_SEPARATOR . 'link'; + $link = $this->workspace . DIRECTORY_SEPARATOR . 'link'; $this->filesystem->remove($link); - $this->assertTrue(!\is_file($link)); + $this->assertTrue(!is_file($link)); } public function testLinkIsOverwrittenIfPointsToDifferentTarget() { $this->markAsSkippedIfLinkIsMissing(); - $file = $this->workspace . \DIRECTORY_SEPARATOR . 'file'; - $file2 = $this->workspace . \DIRECTORY_SEPARATOR . 'file2'; - $link = $this->workspace . \DIRECTORY_SEPARATOR . 'link'; - \touch($file); - \touch($file2); - \link($file2, $link); + $file = $this->workspace . DIRECTORY_SEPARATOR . 'file'; + $file2 = $this->workspace . DIRECTORY_SEPARATOR . 'file2'; + $link = $this->workspace . DIRECTORY_SEPARATOR . 'link'; + touch($file); + touch($file2); + link($file2, $link); $this->filesystem->hardlink($file, $link); - $this->assertTrue(\is_file($link)); - $this->assertEquals(\fileinode($file), \fileinode($link)); + $this->assertTrue(is_file($link)); + $this->assertEquals(fileinode($file), fileinode($link)); } public function testLinkIsNotOverwrittenIfAlreadyCreated() { $this->markAsSkippedIfLinkIsMissing(); - $file = $this->workspace . \DIRECTORY_SEPARATOR . 'file'; - $link = $this->workspace . \DIRECTORY_SEPARATOR . 'link'; - \touch($file); - \link($file, $link); + $file = $this->workspace . DIRECTORY_SEPARATOR . 'file'; + $link = $this->workspace . DIRECTORY_SEPARATOR . 'link'; + touch($file); + link($file, $link); $this->filesystem->hardlink($file, $link); - $this->assertTrue(\is_file($link)); - $this->assertEquals(\fileinode($file), \fileinode($link)); + $this->assertTrue(is_file($link)); + $this->assertEquals(fileinode($file), fileinode($link)); } public function testLinkWithSeveralTargets() { $this->markAsSkippedIfLinkIsMissing(); - $file = $this->workspace . \DIRECTORY_SEPARATOR . 'file'; - $link1 = $this->workspace . \DIRECTORY_SEPARATOR . 'link'; - $link2 = $this->workspace . \DIRECTORY_SEPARATOR . 'link2'; - \touch($file); + $file = $this->workspace . DIRECTORY_SEPARATOR . 'file'; + $link1 = $this->workspace . DIRECTORY_SEPARATOR . 'link'; + $link2 = $this->workspace . DIRECTORY_SEPARATOR . 'link2'; + touch($file); $this->filesystem->hardlink($file, [$link1, $link2]); - $this->assertTrue(\is_file($link1)); - $this->assertEquals(\fileinode($file), \fileinode($link1)); - $this->assertTrue(\is_file($link2)); - $this->assertEquals(\fileinode($file), \fileinode($link2)); + $this->assertTrue(is_file($link1)); + $this->assertEquals(fileinode($file), fileinode($link1)); + $this->assertTrue(is_file($link2)); + $this->assertEquals(fileinode($file), fileinode($link2)); } public function testLinkWithSameTarget() { $this->markAsSkippedIfLinkIsMissing(); - $file = $this->workspace . \DIRECTORY_SEPARATOR . 'file'; - $link = $this->workspace . \DIRECTORY_SEPARATOR . 'link'; - \touch($file); + $file = $this->workspace . DIRECTORY_SEPARATOR . 'file'; + $link = $this->workspace . DIRECTORY_SEPARATOR . 'link'; + touch($file); // practically same as testLinkIsNotOverwrittenIfAlreadyCreated $this->filesystem->hardlink($file, [$link, $link]); - $this->assertTrue(\is_file($link)); - $this->assertEquals(\fileinode($file), \fileinode($link)); + $this->assertTrue(is_file($link)); + $this->assertEquals(fileinode($file), fileinode($link)); } public function testReadRelativeLink() { $this->markAsSkippedIfSymlinkIsMissing(); - if ('\\' === \DIRECTORY_SEPARATOR) { + if ('\\' === DIRECTORY_SEPARATOR) { $this->markTestSkipped('Relative symbolic links are not supported on Windows'); } $file = $this->workspace . '/file'; $link1 = $this->workspace . '/dir/link'; $link2 = $this->workspace . '/dir/link2'; - \touch($file); + touch($file); $this->filesystem->symlink('../file', $link1); $this->filesystem->symlink('link', $link2); $this->assertEquals($this->normalize('../file'), $this->filesystem->readlink($link1)); $this->assertEquals('link', $this->filesystem->readlink($link2)); - $this->assertEquals($file, $this->filesystem->readlink($link1, \true)); - $this->assertEquals($file, $this->filesystem->readlink($link2, \true)); - $this->assertEquals($file, $this->filesystem->readlink($file, \true)); + $this->assertEquals($file, $this->filesystem->readlink($link1, true)); + $this->assertEquals($file, $this->filesystem->readlink($link2, true)); + $this->assertEquals($file, $this->filesystem->readlink($file, true)); } public function testReadAbsoluteLink() { @@ -711,28 +753,28 @@ public function testReadAbsoluteLink() $file = $this->normalize($this->workspace . '/file'); $link1 = $this->normalize($this->workspace . '/dir/link'); $link2 = $this->normalize($this->workspace . '/dir/link2'); - \touch($file); + touch($file); $this->filesystem->symlink($file, $link1); $this->filesystem->symlink($link1, $link2); $this->assertEquals($file, $this->filesystem->readlink($link1)); $this->assertEquals($link1, $this->filesystem->readlink($link2)); - $this->assertEquals($file, $this->filesystem->readlink($link1, \true)); - $this->assertEquals($file, $this->filesystem->readlink($link2, \true)); - $this->assertEquals($file, $this->filesystem->readlink($file, \true)); + $this->assertEquals($file, $this->filesystem->readlink($link1, true)); + $this->assertEquals($file, $this->filesystem->readlink($link2, true)); + $this->assertEquals($file, $this->filesystem->readlink($file, true)); } public function testReadBrokenLink() { $this->markAsSkippedIfSymlinkIsMissing(); - if ('\\' === \DIRECTORY_SEPARATOR) { + if ('\\' === DIRECTORY_SEPARATOR) { $this->markTestSkipped('Windows does not support creating "broken" symlinks'); } $file = $this->workspace . '/file'; $link = $this->workspace . '/link'; $this->filesystem->symlink($file, $link); $this->assertEquals($file, $this->filesystem->readlink($link)); - $this->assertNull($this->filesystem->readlink($link, \true)); - \touch($file); - $this->assertEquals($file, $this->filesystem->readlink($link, \true)); + $this->assertNull($this->filesystem->readlink($link, true)); + touch($file); + $this->assertEquals($file, $this->filesystem->readlink($link, true)); } public function testReadLinkDefaultPathDoesNotExist() { @@ -741,20 +783,20 @@ public function testReadLinkDefaultPathDoesNotExist() public function testReadLinkDefaultPathNotLink() { $file = $this->normalize($this->workspace . '/file'); - \touch($file); + touch($file); $this->assertNull($this->filesystem->readlink($file)); } public function testReadLinkCanonicalizePath() { $this->markAsSkippedIfSymlinkIsMissing(); $file = $this->normalize($this->workspace . '/file'); - \mkdir($this->normalize($this->workspace . '/dir')); - \touch($file); - $this->assertEquals($file, $this->filesystem->readlink($this->normalize($this->workspace . '/dir/../file'), \true)); + mkdir($this->normalize($this->workspace . '/dir')); + touch($file); + $this->assertEquals($file, $this->filesystem->readlink($this->normalize($this->workspace . '/dir/../file'), true)); } public function testReadLinkCanonicalizedPathDoesNotExist() { - $this->assertNull($this->filesystem->readlink($this->normalize($this->workspace . 'invalid'), \true)); + $this->assertNull($this->filesystem->readlink($this->normalize($this->workspace . 'invalid'), true)); } /** * @dataProvider providePathsForMakePathRelative @@ -767,7 +809,7 @@ public function testMakePathRelative($endPath, $startPath, $expectedPath) public function providePathsForMakePathRelative() { $paths = [['/var/lib/symfony/src/Symfony/', '/var/lib/symfony/src/Symfony/Component', '../'], ['/var/lib/symfony/src/Symfony/', '/var/lib/symfony/src/Symfony/Component/', '../'], ['/var/lib/symfony/src/Symfony', '/var/lib/symfony/src/Symfony/Component', '../'], ['/var/lib/symfony/src/Symfony', '/var/lib/symfony/src/Symfony/Component/', '../'], ['/usr/lib/symfony/', '/var/lib/symfony/src/Symfony/Component', '../../../../../../usr/lib/symfony/'], ['/var/lib/symfony/src/Symfony/', '/var/lib/symfony/', 'src/Symfony/'], ['/aa/bb', '/aa/bb', './'], ['/aa/bb', '/aa/bb/', './'], ['/aa/bb/', '/aa/bb', './'], ['/aa/bb/', '/aa/bb/', './'], ['/aa/bb/cc', '/aa/bb/cc/dd', '../'], ['/aa/bb/cc', '/aa/bb/cc/dd/', '../'], ['/aa/bb/cc/', '/aa/bb/cc/dd', '../'], ['/aa/bb/cc/', '/aa/bb/cc/dd/', '../'], ['/aa/bb/cc', '/aa', 'bb/cc/'], ['/aa/bb/cc', '/aa/', 'bb/cc/'], ['/aa/bb/cc/', '/aa', 'bb/cc/'], ['/aa/bb/cc/', '/aa/', 'bb/cc/'], ['/a/aab/bb', '/a/aa', '../aab/bb/'], ['/a/aab/bb', '/a/aa/', '../aab/bb/'], ['/a/aab/bb/', '/a/aa', '../aab/bb/'], ['/a/aab/bb/', '/a/aa/', '../aab/bb/'], ['/a/aab/bb/', '/', 'a/aab/bb/'], ['/a/aab/bb/', '/b/aab', '../../a/aab/bb/'], ['/aab/bb', '/aa', '../aab/bb/'], ['/aab', '/aa', '../aab/'], ['/aa/bb/cc', '/aa/dd/..', 'bb/cc/'], ['/aa/../bb/cc', '/aa/dd/..', '../bb/cc/'], ['/aa/bb/../../cc', '/aa/../dd/..', 'cc/'], ['/../aa/bb/cc', '/aa/dd/..', 'bb/cc/'], ['/../../aa/../bb/cc', '/aa/dd/..', '../bb/cc/'], ['C:/aa/bb/cc', 'C:/aa/dd/..', 'bb/cc/'], ['c:/aa/../bb/cc', 'c:/aa/dd/..', '../bb/cc/'], ['C:/aa/bb/../../cc', 'C:/aa/../dd/..', 'cc/'], ['C:/../aa/bb/cc', 'C:/aa/dd/..', 'bb/cc/'], ['C:/../../aa/../bb/cc', 'C:/aa/dd/..', '../bb/cc/']]; - if ('\\' === \DIRECTORY_SEPARATOR) { + if ('\\' === DIRECTORY_SEPARATOR) { $paths[] = ['c:\\var\\lib/symfony/src/Symfony/', 'c:/var/lib/symfony/', 'src/Symfony/']; } return $paths; @@ -788,38 +830,38 @@ public function provideLegacyPathsForMakePathRelativeWithRelativePaths() } public function testMirrorCopiesFilesAndDirectoriesRecursively() { - $sourcePath = $this->workspace . \DIRECTORY_SEPARATOR . 'source' . \DIRECTORY_SEPARATOR; - $directory = $sourcePath . 'directory' . \DIRECTORY_SEPARATOR; + $sourcePath = $this->workspace . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR; + $directory = $sourcePath . 'directory' . DIRECTORY_SEPARATOR; $file1 = $directory . 'file1'; $file2 = $sourcePath . 'file2'; - \mkdir($sourcePath); - \mkdir($directory); - \file_put_contents($file1, 'FILE1'); - \file_put_contents($file2, 'FILE2'); - $targetPath = $this->workspace . \DIRECTORY_SEPARATOR . 'target' . \DIRECTORY_SEPARATOR; + mkdir($sourcePath); + mkdir($directory); + file_put_contents($file1, 'FILE1'); + file_put_contents($file2, 'FILE2'); + $targetPath = $this->workspace . DIRECTORY_SEPARATOR . 'target' . DIRECTORY_SEPARATOR; $this->filesystem->mirror($sourcePath, $targetPath); $this->assertDirectoryExists($targetPath); $this->assertDirectoryExists($targetPath . 'directory'); - $this->assertFileEquals($file1, $targetPath . 'directory' . \DIRECTORY_SEPARATOR . 'file1'); + $this->assertFileEquals($file1, $targetPath . 'directory' . DIRECTORY_SEPARATOR . 'file1'); $this->assertFileEquals($file2, $targetPath . 'file2'); $this->filesystem->remove($file1); - $this->filesystem->mirror($sourcePath, $targetPath, null, ['delete' => \false]); - $this->assertTrue($this->filesystem->exists($targetPath . 'directory' . \DIRECTORY_SEPARATOR . 'file1')); - $this->filesystem->mirror($sourcePath, $targetPath, null, ['delete' => \true]); - $this->assertFalse($this->filesystem->exists($targetPath . 'directory' . \DIRECTORY_SEPARATOR . 'file1')); - \file_put_contents($file1, 'FILE1'); - $this->filesystem->mirror($sourcePath, $targetPath, null, ['delete' => \true]); - $this->assertTrue($this->filesystem->exists($targetPath . 'directory' . \DIRECTORY_SEPARATOR . 'file1')); + $this->filesystem->mirror($sourcePath, $targetPath, null, ['delete' => false]); + $this->assertTrue($this->filesystem->exists($targetPath . 'directory' . DIRECTORY_SEPARATOR . 'file1')); + $this->filesystem->mirror($sourcePath, $targetPath, null, ['delete' => true]); + $this->assertFalse($this->filesystem->exists($targetPath . 'directory' . DIRECTORY_SEPARATOR . 'file1')); + file_put_contents($file1, 'FILE1'); + $this->filesystem->mirror($sourcePath, $targetPath, null, ['delete' => true]); + $this->assertTrue($this->filesystem->exists($targetPath . 'directory' . DIRECTORY_SEPARATOR . 'file1')); $this->filesystem->remove($directory); - $this->filesystem->mirror($sourcePath, $targetPath, null, ['delete' => \true]); + $this->filesystem->mirror($sourcePath, $targetPath, null, ['delete' => true]); $this->assertFalse($this->filesystem->exists($targetPath . 'directory')); - $this->assertFalse($this->filesystem->exists($targetPath . 'directory' . \DIRECTORY_SEPARATOR . 'file1')); + $this->assertFalse($this->filesystem->exists($targetPath . 'directory' . DIRECTORY_SEPARATOR . 'file1')); } public function testMirrorCreatesEmptyDirectory() { - $sourcePath = $this->workspace . \DIRECTORY_SEPARATOR . 'source' . \DIRECTORY_SEPARATOR; - \mkdir($sourcePath); - $targetPath = $this->workspace . \DIRECTORY_SEPARATOR . 'target' . \DIRECTORY_SEPARATOR; + $sourcePath = $this->workspace . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR; + mkdir($sourcePath); + $targetPath = $this->workspace . DIRECTORY_SEPARATOR . 'target' . DIRECTORY_SEPARATOR; $this->filesystem->mirror($sourcePath, $targetPath); $this->assertDirectoryExists($targetPath); $this->filesystem->remove($sourcePath); @@ -827,89 +869,89 @@ public function testMirrorCreatesEmptyDirectory() public function testMirrorCopiesLinks() { $this->markAsSkippedIfSymlinkIsMissing(); - $sourcePath = $this->workspace . \DIRECTORY_SEPARATOR . 'source' . \DIRECTORY_SEPARATOR; - \mkdir($sourcePath); - \file_put_contents($sourcePath . 'file1', 'FILE1'); - \symlink($sourcePath . 'file1', $sourcePath . 'link1'); - $targetPath = $this->workspace . \DIRECTORY_SEPARATOR . 'target' . \DIRECTORY_SEPARATOR; + $sourcePath = $this->workspace . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR; + mkdir($sourcePath); + file_put_contents($sourcePath . 'file1', 'FILE1'); + symlink($sourcePath . 'file1', $sourcePath . 'link1'); + $targetPath = $this->workspace . DIRECTORY_SEPARATOR . 'target' . DIRECTORY_SEPARATOR; $this->filesystem->mirror($sourcePath, $targetPath); $this->assertDirectoryExists($targetPath); $this->assertFileEquals($sourcePath . 'file1', $targetPath . 'link1'); - $this->assertTrue(\is_link($targetPath . \DIRECTORY_SEPARATOR . 'link1')); + $this->assertTrue(is_link($targetPath . DIRECTORY_SEPARATOR . 'link1')); } public function testMirrorCopiesLinkedDirectoryContents() { - $this->markAsSkippedIfSymlinkIsMissing(\true); - $sourcePath = $this->workspace . \DIRECTORY_SEPARATOR . 'source' . \DIRECTORY_SEPARATOR; - \mkdir($sourcePath . 'nested/', 0777, \true); - \file_put_contents($sourcePath . '/nested/file1.txt', 'FILE1'); + $this->markAsSkippedIfSymlinkIsMissing(true); + $sourcePath = $this->workspace . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR; + mkdir($sourcePath . 'nested/', 0777, true); + file_put_contents($sourcePath . '/nested/file1.txt', 'FILE1'); // Note: We symlink directory, not file - \symlink($sourcePath . 'nested', $sourcePath . 'link1'); - $targetPath = $this->workspace . \DIRECTORY_SEPARATOR . 'target' . \DIRECTORY_SEPARATOR; + symlink($sourcePath . 'nested', $sourcePath . 'link1'); + $targetPath = $this->workspace . DIRECTORY_SEPARATOR . 'target' . DIRECTORY_SEPARATOR; $this->filesystem->mirror($sourcePath, $targetPath); $this->assertDirectoryExists($targetPath); $this->assertFileEquals($sourcePath . '/nested/file1.txt', $targetPath . 'link1/file1.txt'); - $this->assertTrue(\is_link($targetPath . \DIRECTORY_SEPARATOR . 'link1')); + $this->assertTrue(is_link($targetPath . DIRECTORY_SEPARATOR . 'link1')); } public function testMirrorCopiesRelativeLinkedContents() { - $this->markAsSkippedIfSymlinkIsMissing(\true); - $sourcePath = $this->workspace . \DIRECTORY_SEPARATOR . 'source' . \DIRECTORY_SEPARATOR; - $oldPath = \getcwd(); - \mkdir($sourcePath . 'nested/', 0777, \true); - \file_put_contents($sourcePath . '/nested/file1.txt', 'FILE1'); + $this->markAsSkippedIfSymlinkIsMissing(true); + $sourcePath = $this->workspace . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR; + $oldPath = getcwd(); + mkdir($sourcePath . 'nested/', 0777, true); + file_put_contents($sourcePath . '/nested/file1.txt', 'FILE1'); // Note: Create relative symlink - \chdir($sourcePath); - \symlink('nested', 'link1'); - \chdir($oldPath); - $targetPath = $this->workspace . \DIRECTORY_SEPARATOR . 'target' . \DIRECTORY_SEPARATOR; + chdir($sourcePath); + symlink('nested', 'link1'); + chdir($oldPath); + $targetPath = $this->workspace . DIRECTORY_SEPARATOR . 'target' . DIRECTORY_SEPARATOR; $this->filesystem->mirror($sourcePath, $targetPath); $this->assertDirectoryExists($targetPath); $this->assertFileEquals($sourcePath . '/nested/file1.txt', $targetPath . 'link1/file1.txt'); - $this->assertTrue(\is_link($targetPath . \DIRECTORY_SEPARATOR . 'link1')); - $this->assertEquals('\\' === \DIRECTORY_SEPARATOR ? \realpath($sourcePath . '\\nested') : 'nested', \readlink($targetPath . \DIRECTORY_SEPARATOR . 'link1')); + $this->assertTrue(is_link($targetPath . DIRECTORY_SEPARATOR . 'link1')); + $this->assertEquals('\\' === DIRECTORY_SEPARATOR ? realpath($sourcePath . '\\nested') : 'nested', readlink($targetPath . DIRECTORY_SEPARATOR . 'link1')); } public function testMirrorContentsWithSameNameAsSourceOrTargetWithoutDeleteOption() { - $sourcePath = $this->workspace . \DIRECTORY_SEPARATOR . 'source' . \DIRECTORY_SEPARATOR; - \mkdir($sourcePath); - \touch($sourcePath . 'source'); - \touch($sourcePath . 'target'); - $targetPath = $this->workspace . \DIRECTORY_SEPARATOR . 'target' . \DIRECTORY_SEPARATOR; - $oldPath = \getcwd(); - \chdir($this->workspace); + $sourcePath = $this->workspace . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR; + mkdir($sourcePath); + touch($sourcePath . 'source'); + touch($sourcePath . 'target'); + $targetPath = $this->workspace . DIRECTORY_SEPARATOR . 'target' . DIRECTORY_SEPARATOR; + $oldPath = getcwd(); + chdir($this->workspace); $this->filesystem->mirror('source', $targetPath); - \chdir($oldPath); + chdir($oldPath); $this->assertDirectoryExists($targetPath); $this->assertFileExists($targetPath . 'source'); $this->assertFileExists($targetPath . 'target'); } public function testMirrorContentsWithSameNameAsSourceOrTargetWithDeleteOption() { - $sourcePath = $this->workspace . \DIRECTORY_SEPARATOR . 'source' . \DIRECTORY_SEPARATOR; - \mkdir($sourcePath); - \touch($sourcePath . 'source'); - $targetPath = $this->workspace . \DIRECTORY_SEPARATOR . 'target' . \DIRECTORY_SEPARATOR; - \mkdir($targetPath); - \touch($targetPath . 'source'); - \touch($targetPath . 'target'); - $oldPath = \getcwd(); - \chdir($this->workspace); - $this->filesystem->mirror('source', 'target', null, ['delete' => \true]); - \chdir($oldPath); + $sourcePath = $this->workspace . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR; + mkdir($sourcePath); + touch($sourcePath . 'source'); + $targetPath = $this->workspace . DIRECTORY_SEPARATOR . 'target' . DIRECTORY_SEPARATOR; + mkdir($targetPath); + touch($targetPath . 'source'); + touch($targetPath . 'target'); + $oldPath = getcwd(); + chdir($this->workspace); + $this->filesystem->mirror('source', 'target', null, ['delete' => true]); + chdir($oldPath); $this->assertDirectoryExists($targetPath); $this->assertFileExists($targetPath . 'source'); $this->assertFileNotExists($targetPath . 'target'); } public function testMirrorFromSubdirectoryInToParentDirectory() { - $targetPath = $this->workspace . \DIRECTORY_SEPARATOR . 'foo' . \DIRECTORY_SEPARATOR; - $sourcePath = $targetPath . 'bar' . \DIRECTORY_SEPARATOR; + $targetPath = $this->workspace . DIRECTORY_SEPARATOR . 'foo' . DIRECTORY_SEPARATOR; + $sourcePath = $targetPath . 'bar' . DIRECTORY_SEPARATOR; $file1 = $sourcePath . 'file1'; $file2 = $sourcePath . 'file2'; $this->filesystem->mkdir($sourcePath); - \file_put_contents($file1, 'FILE1'); - \file_put_contents($file2, 'FILE2'); + file_put_contents($file1, 'FILE1'); + file_put_contents($file2, 'FILE2'); $this->filesystem->mirror($sourcePath, $targetPath); $this->assertFileEquals($file1, $targetPath . 'file1'); } @@ -923,7 +965,7 @@ public function testIsAbsolutePath($path, $expectedResult) } public function providePathsForIsAbsolutePath() { - return [['/var/lib', \true], ['_PhpScoper5ea00cc67502b\\c:\\var\\lib', \true], ['_PhpScoper5ea00cc67502b\\var\\lib', \true], ['var/lib', \false], ['../var/lib', \false], ['', \false], [null, \false]]; + return [['/var/lib', true], ['_PhpScoper5ea00cc67502b\\c:\\var\\lib', true], ['_PhpScoper5ea00cc67502b\\var\\lib', true], ['var/lib', false], ['../var/lib', false], ['', false], [null, false]]; } public function testTempnam() { @@ -941,7 +983,7 @@ public function testTempnamWithFileScheme() } public function testTempnamWithMockScheme() { - \stream_wrapper_register('mock', '_PhpScoper5ea00cc67502b\\Symfony\\Component\\Filesystem\\Tests\\Fixtures\\MockStream\\MockStream'); + stream_wrapper_register('mock', '_PhpScoper5ea00cc67502b\\Symfony\\Component\\Filesystem\\Tests\\Fixtures\\MockStream\\MockStream'); $scheme = 'mock://'; $dirname = $scheme . $this->workspace; $filename = $this->filesystem->tempnam($dirname, 'foo'); @@ -969,13 +1011,13 @@ public function testTempnamWithPharSchemeFails() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Filesystem\\Exception\\IOException'); // Skip test if Phar disabled phar.readonly must be 0 in php.ini - if (!\Phar::canWrite()) { + if (!Phar::canWrite()) { $this->markTestSkipped('This test cannot run when phar.readonly is 1.'); } $scheme = 'phar://'; $dirname = $scheme . $this->workspace; $pharname = 'foo.phar'; - new \Phar($this->workspace . '/' . $pharname, 0, $pharname); + new Phar($this->workspace . '/' . $pharname, 0, $pharname); // The phar:// stream does not support mode x: fails to create file, errors "failed to open stream: phar error: "$filename" is not a file in phar "$pharname"" and returns false $this->filesystem->tempnam($dirname, $pharname . '/bar'); } @@ -990,63 +1032,63 @@ public function testTempnamWithHTTPSchemeFails() public function testTempnamOnUnwritableFallsBackToSysTmp() { $scheme = 'file://'; - $dirname = $scheme . $this->workspace . \DIRECTORY_SEPARATOR . 'does_not_exist'; + $dirname = $scheme . $this->workspace . DIRECTORY_SEPARATOR . 'does_not_exist'; $filename = $this->filesystem->tempnam($dirname, 'bar'); - $realTempDir = \realpath(\sys_get_temp_dir()); - $this->assertStringStartsWith(\rtrim($scheme . $realTempDir, \DIRECTORY_SEPARATOR), $filename); + $realTempDir = realpath(sys_get_temp_dir()); + $this->assertStringStartsWith(rtrim($scheme . $realTempDir, DIRECTORY_SEPARATOR), $filename); $this->assertFileExists($filename); // Tear down - @\unlink($filename); + @unlink($filename); } public function testDumpFile() { - $filename = $this->workspace . \DIRECTORY_SEPARATOR . 'foo' . \DIRECTORY_SEPARATOR . 'baz.txt'; + $filename = $this->workspace . DIRECTORY_SEPARATOR . 'foo' . DIRECTORY_SEPARATOR . 'baz.txt'; // skip mode check on Windows - if ('\\' !== \DIRECTORY_SEPARATOR) { - $oldMask = \umask(02); + if ('\\' !== DIRECTORY_SEPARATOR) { + $oldMask = umask(02); } $this->filesystem->dumpFile($filename, 'bar'); $this->assertFileExists($filename); $this->assertStringEqualsFile($filename, 'bar'); // skip mode check on Windows - if ('\\' !== \DIRECTORY_SEPARATOR) { + if ('\\' !== DIRECTORY_SEPARATOR) { $this->assertFilePermissions(664, $filename); - \umask($oldMask); + umask($oldMask); } } public function testDumpFileWithArray() { - $filename = $this->workspace . \DIRECTORY_SEPARATOR . 'foo' . \DIRECTORY_SEPARATOR . 'baz.txt'; + $filename = $this->workspace . DIRECTORY_SEPARATOR . 'foo' . DIRECTORY_SEPARATOR . 'baz.txt'; $this->filesystem->dumpFile($filename, ['bar']); $this->assertFileExists($filename); $this->assertStringEqualsFile($filename, 'bar'); } public function testDumpFileWithResource() { - $filename = $this->workspace . \DIRECTORY_SEPARATOR . 'foo' . \DIRECTORY_SEPARATOR . 'baz.txt'; - $resource = \fopen('php://memory', 'rw'); - \fwrite($resource, 'bar'); - \fseek($resource, 0); + $filename = $this->workspace . DIRECTORY_SEPARATOR . 'foo' . DIRECTORY_SEPARATOR . 'baz.txt'; + $resource = fopen('php://memory', 'rw'); + fwrite($resource, 'bar'); + fseek($resource, 0); $this->filesystem->dumpFile($filename, $resource); - \fclose($resource); + fclose($resource); $this->assertFileExists($filename); $this->assertStringEqualsFile($filename, 'bar'); } public function testDumpFileOverwritesAnExistingFile() { - $filename = $this->workspace . \DIRECTORY_SEPARATOR . 'foo.txt'; - \file_put_contents($filename, 'FOO BAR'); + $filename = $this->workspace . DIRECTORY_SEPARATOR . 'foo.txt'; + file_put_contents($filename, 'FOO BAR'); $this->filesystem->dumpFile($filename, 'bar'); $this->assertFileExists($filename); $this->assertStringEqualsFile($filename, 'bar'); } public function testDumpFileWithFileScheme() { - if (\defined('HHVM_VERSION')) { + if (defined('HHVM_VERSION')) { $this->markTestSkipped('HHVM does not handle the file:// scheme correctly'); } $scheme = 'file://'; - $filename = $scheme . $this->workspace . \DIRECTORY_SEPARATOR . 'foo' . \DIRECTORY_SEPARATOR . 'baz.txt'; + $filename = $scheme . $this->workspace . DIRECTORY_SEPARATOR . 'foo' . DIRECTORY_SEPARATOR . 'baz.txt'; $this->filesystem->dumpFile($filename, 'bar'); $this->assertFileExists($filename); $this->assertStringEqualsFile($filename, 'bar'); @@ -1054,36 +1096,36 @@ public function testDumpFileWithFileScheme() public function testDumpFileWithZlibScheme() { $scheme = 'compress.zlib://'; - $filename = $this->workspace . \DIRECTORY_SEPARATOR . 'foo' . \DIRECTORY_SEPARATOR . 'baz.txt'; + $filename = $this->workspace . DIRECTORY_SEPARATOR . 'foo' . DIRECTORY_SEPARATOR . 'baz.txt'; $this->filesystem->dumpFile($filename, 'bar'); // Zlib stat uses file:// wrapper so remove scheme - $this->assertFileExists(\str_replace($scheme, '', $filename)); + $this->assertFileExists(str_replace($scheme, '', $filename)); $this->assertStringEqualsFile($filename, 'bar'); } public function testAppendToFile() { - $filename = $this->workspace . \DIRECTORY_SEPARATOR . 'foo' . \DIRECTORY_SEPARATOR . 'bar.txt'; + $filename = $this->workspace . DIRECTORY_SEPARATOR . 'foo' . DIRECTORY_SEPARATOR . 'bar.txt'; // skip mode check on Windows - if ('\\' !== \DIRECTORY_SEPARATOR) { - $oldMask = \umask(02); + if ('\\' !== DIRECTORY_SEPARATOR) { + $oldMask = umask(02); } $this->filesystem->dumpFile($filename, 'foo'); $this->filesystem->appendToFile($filename, 'bar'); $this->assertFileExists($filename); $this->assertStringEqualsFile($filename, 'foobar'); // skip mode check on Windows - if ('\\' !== \DIRECTORY_SEPARATOR) { + if ('\\' !== DIRECTORY_SEPARATOR) { $this->assertFilePermissions(664, $filename); - \umask($oldMask); + umask($oldMask); } } public function testAppendToFileWithScheme() { - if (\defined('HHVM_VERSION')) { + if (defined('HHVM_VERSION')) { $this->markTestSkipped('HHVM does not handle the file:// scheme correctly'); } $scheme = 'file://'; - $filename = $scheme . $this->workspace . \DIRECTORY_SEPARATOR . 'foo' . \DIRECTORY_SEPARATOR . 'baz.txt'; + $filename = $scheme . $this->workspace . DIRECTORY_SEPARATOR . 'foo' . DIRECTORY_SEPARATOR . 'baz.txt'; $this->filesystem->dumpFile($filename, 'foo'); $this->filesystem->appendToFile($filename, 'bar'); $this->assertFileExists($filename); @@ -1092,26 +1134,26 @@ public function testAppendToFileWithScheme() public function testAppendToFileWithZlibScheme() { $scheme = 'compress.zlib://'; - $filename = $this->workspace . \DIRECTORY_SEPARATOR . 'foo' . \DIRECTORY_SEPARATOR . 'baz.txt'; + $filename = $this->workspace . DIRECTORY_SEPARATOR . 'foo' . DIRECTORY_SEPARATOR . 'baz.txt'; $this->filesystem->dumpFile($filename, 'foo'); // Zlib stat uses file:// wrapper so remove it - $this->assertStringEqualsFile(\str_replace($scheme, '', $filename), 'foo'); + $this->assertStringEqualsFile(str_replace($scheme, '', $filename), 'foo'); $this->filesystem->appendToFile($filename, 'bar'); $this->assertFileExists($filename); $this->assertStringEqualsFile($filename, 'foobar'); } public function testAppendToFileCreateTheFileIfNotExists() { - $filename = $this->workspace . \DIRECTORY_SEPARATOR . 'foo' . \DIRECTORY_SEPARATOR . 'bar.txt'; + $filename = $this->workspace . DIRECTORY_SEPARATOR . 'foo' . DIRECTORY_SEPARATOR . 'bar.txt'; // skip mode check on Windows - if ('\\' !== \DIRECTORY_SEPARATOR) { - $oldMask = \umask(02); + if ('\\' !== DIRECTORY_SEPARATOR) { + $oldMask = umask(02); } $this->filesystem->appendToFile($filename, 'bar'); // skip mode check on Windows - if ('\\' !== \DIRECTORY_SEPARATOR) { + if ('\\' !== DIRECTORY_SEPARATOR) { $this->assertFilePermissions(664, $filename); - \umask($oldMask); + umask($oldMask); } $this->assertFileExists($filename); $this->assertStringEqualsFile($filename, 'bar'); @@ -1119,19 +1161,19 @@ public function testAppendToFileCreateTheFileIfNotExists() public function testDumpKeepsExistingPermissionsWhenOverwritingAnExistingFile() { $this->markAsSkippedIfChmodIsMissing(); - $filename = $this->workspace . \DIRECTORY_SEPARATOR . 'foo.txt'; - \file_put_contents($filename, 'FOO BAR'); - \chmod($filename, 0745); + $filename = $this->workspace . DIRECTORY_SEPARATOR . 'foo.txt'; + file_put_contents($filename, 'FOO BAR'); + chmod($filename, 0745); $this->filesystem->dumpFile($filename, 'bar', null); $this->assertFilePermissions(745, $filename); } public function testCopyShouldKeepExecutionPermission() { $this->markAsSkippedIfChmodIsMissing(); - $sourceFilePath = $this->workspace . \DIRECTORY_SEPARATOR . 'copy_source_file'; - $targetFilePath = $this->workspace . \DIRECTORY_SEPARATOR . 'copy_target_file'; - \file_put_contents($sourceFilePath, 'SOURCE FILE'); - \chmod($sourceFilePath, 0745); + $sourceFilePath = $this->workspace . DIRECTORY_SEPARATOR . 'copy_source_file'; + $targetFilePath = $this->workspace . DIRECTORY_SEPARATOR . 'copy_target_file'; + file_put_contents($sourceFilePath, 'SOURCE FILE'); + chmod($sourceFilePath, 0745); $this->filesystem->copy($sourceFilePath, $targetFilePath); $this->assertFilePermissions(767, $targetFilePath); } @@ -1144,6 +1186,6 @@ public function testCopyShouldKeepExecutionPermission() */ private function normalize($path) { - return \str_replace('/', \DIRECTORY_SEPARATOR, $path); + return str_replace('/', DIRECTORY_SEPARATOR, $path); } } diff --git a/vendor/symfony/filesystem/Tests/FilesystemTestCase.php b/vendor/symfony/filesystem/Tests/FilesystemTestCase.php index 3f9e62e80..b10372dc5 100644 --- a/vendor/symfony/filesystem/Tests/FilesystemTestCase.php +++ b/vendor/symfony/filesystem/Tests/FilesystemTestCase.php @@ -12,7 +12,31 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Filesystem; -class FilesystemTestCase extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use function error_get_last; +use function exec; +use function fileperms; +use function function_exists; +use function is_array; +use function link; +use function microtime; +use function mkdir; +use function mt_rand; +use function posix_getgrgid; +use function posix_getpwuid; +use function realpath; +use function sprintf; +use function stat; +use function strpos; +use function substr; +use function symlink; +use function sys_get_temp_dir; +use function tempnam; +use function umask; +use function unlink; +use const DIRECTORY_SEPARATOR; +use const PHP_ZTS; + +class FilesystemTestCase extends TestCase { private $umask; protected $longPathNamesWindows = []; @@ -34,49 +58,49 @@ class FilesystemTestCase extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\Test private static $symlinkOnWindows = null; public static function setUpBeforeClass() { - if ('\\' === \DIRECTORY_SEPARATOR) { - self::$linkOnWindows = \true; - $originFile = \tempnam(\sys_get_temp_dir(), 'li'); - $targetFile = \tempnam(\sys_get_temp_dir(), 'li'); - if (\true !== @\link($originFile, $targetFile)) { - $report = \error_get_last(); - if (\is_array($report) && \false !== \strpos($report['message'], 'error code(1314)')) { - self::$linkOnWindows = \false; + if ('\\' === DIRECTORY_SEPARATOR) { + self::$linkOnWindows = true; + $originFile = tempnam(sys_get_temp_dir(), 'li'); + $targetFile = tempnam(sys_get_temp_dir(), 'li'); + if (true !== @link($originFile, $targetFile)) { + $report = error_get_last(); + if (is_array($report) && false !== strpos($report['message'], 'error code(1314)')) { + self::$linkOnWindows = false; } } else { - @\unlink($targetFile); + @unlink($targetFile); } - self::$symlinkOnWindows = \true; - $originDir = \tempnam(\sys_get_temp_dir(), 'sl'); - $targetDir = \tempnam(\sys_get_temp_dir(), 'sl'); - if (\true !== @\symlink($originDir, $targetDir)) { - $report = \error_get_last(); - if (\is_array($report) && \false !== \strpos($report['message'], 'error code(1314)')) { - self::$symlinkOnWindows = \false; + self::$symlinkOnWindows = true; + $originDir = tempnam(sys_get_temp_dir(), 'sl'); + $targetDir = tempnam(sys_get_temp_dir(), 'sl'); + if (true !== @symlink($originDir, $targetDir)) { + $report = error_get_last(); + if (is_array($report) && false !== strpos($report['message'], 'error code(1314)')) { + self::$symlinkOnWindows = false; } } else { - @\unlink($targetDir); + @unlink($targetDir); } } } protected function setUp() { - $this->umask = \umask(0); - $this->filesystem = new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Filesystem(); - $this->workspace = \sys_get_temp_dir() . '/' . \microtime(\true) . '.' . \mt_rand(); - \mkdir($this->workspace, 0777, \true); - $this->workspace = \realpath($this->workspace); + $this->umask = umask(0); + $this->filesystem = new Filesystem(); + $this->workspace = sys_get_temp_dir() . '/' . microtime(true) . '.' . mt_rand(); + mkdir($this->workspace, 0777, true); + $this->workspace = realpath($this->workspace); } protected function tearDown() { if (!empty($this->longPathNamesWindows)) { foreach ($this->longPathNamesWindows as $path) { - \exec('DEL ' . $path); + exec('DEL ' . $path); } $this->longPathNamesWindows = []; } $this->filesystem->remove($this->workspace); - \umask($this->umask); + umask($this->umask); } /** * @param int $expectedFilePerms Expected file permissions as three digits (i.e. 755) @@ -84,52 +108,52 @@ protected function tearDown() */ protected function assertFilePermissions($expectedFilePerms, $filePath) { - $actualFilePerms = (int) \substr(\sprintf('%o', \fileperms($filePath)), -3); - $this->assertEquals($expectedFilePerms, $actualFilePerms, \sprintf('File permissions for %s must be %s. Actual %s', $filePath, $expectedFilePerms, $actualFilePerms)); + $actualFilePerms = (int) substr(sprintf('%o', fileperms($filePath)), -3); + $this->assertEquals($expectedFilePerms, $actualFilePerms, sprintf('File permissions for %s must be %s. Actual %s', $filePath, $expectedFilePerms, $actualFilePerms)); } protected function getFileOwner($filepath) { $this->markAsSkippedIfPosixIsMissing(); - $infos = \stat($filepath); - return ($datas = \posix_getpwuid($infos['uid'])) ? $datas['name'] : null; + $infos = stat($filepath); + return ($datas = posix_getpwuid($infos['uid'])) ? $datas['name'] : null; } protected function getFileGroup($filepath) { $this->markAsSkippedIfPosixIsMissing(); - $infos = \stat($filepath); - if ($datas = \posix_getgrgid($infos['gid'])) { + $infos = stat($filepath); + if ($datas = posix_getgrgid($infos['gid'])) { return $datas['name']; } $this->markTestSkipped('Unable to retrieve file group name'); } protected function markAsSkippedIfLinkIsMissing() { - if (!\function_exists('link')) { + if (!function_exists('link')) { $this->markTestSkipped('link is not supported'); } - if ('\\' === \DIRECTORY_SEPARATOR && \false === self::$linkOnWindows) { + if ('\\' === DIRECTORY_SEPARATOR && false === self::$linkOnWindows) { $this->markTestSkipped('link requires "Create hard links" privilege on windows'); } } - protected function markAsSkippedIfSymlinkIsMissing($relative = \false) + protected function markAsSkippedIfSymlinkIsMissing($relative = false) { - if ('\\' === \DIRECTORY_SEPARATOR && \false === self::$symlinkOnWindows) { + if ('\\' === DIRECTORY_SEPARATOR && false === self::$symlinkOnWindows) { $this->markTestSkipped('symlink requires "Create symbolic links" privilege on Windows'); } // https://bugs.php.net/69473 - if ($relative && '\\' === \DIRECTORY_SEPARATOR && 1 === \PHP_ZTS) { + if ($relative && '\\' === DIRECTORY_SEPARATOR && 1 === PHP_ZTS) { $this->markTestSkipped('symlink does not support relative paths on thread safe Windows PHP versions'); } } protected function markAsSkippedIfChmodIsMissing() { - if ('\\' === \DIRECTORY_SEPARATOR) { + if ('\\' === DIRECTORY_SEPARATOR) { $this->markTestSkipped('chmod is not supported on Windows'); } } protected function markAsSkippedIfPosixIsMissing() { - if (!\function_exists('posix_isatty')) { + if (!function_exists('posix_isatty')) { $this->markTestSkipped('Function posix_isatty is required.'); } } diff --git a/vendor/symfony/filesystem/Tests/Fixtures/MockStream/MockStream.php b/vendor/symfony/filesystem/Tests/Fixtures/MockStream/MockStream.php index 85dc59004..e17202bb0 100644 --- a/vendor/symfony/filesystem/Tests/Fixtures/MockStream/MockStream.php +++ b/vendor/symfony/filesystem/Tests/Fixtures/MockStream/MockStream.php @@ -29,7 +29,7 @@ class MockStream */ public function stream_open($path, $mode, $options, &$opened_path) { - return \true; + return true; } /** * @param string $path The file path or URL to stat diff --git a/vendor/symfony/filesystem/Tests/Fixtures/MockStream/index.php b/vendor/symfony/filesystem/Tests/Fixtures/MockStream/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/filesystem/Tests/Fixtures/MockStream/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/filesystem/Tests/Fixtures/index.php b/vendor/symfony/filesystem/Tests/Fixtures/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/filesystem/Tests/Fixtures/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/filesystem/Tests/LockHandlerTest.php b/vendor/symfony/filesystem/Tests/LockHandlerTest.php index b75b61cde..1df46bd64 100644 --- a/vendor/symfony/filesystem/Tests/LockHandlerTest.php +++ b/vendor/symfony/filesystem/Tests/LockHandlerTest.php @@ -14,68 +14,82 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException; use _PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Filesystem; use _PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\LockHandler; +use Exception; +use Throwable; +use function chmod; +use function get_class; +use function getenv; +use function is_dir; +use function mkdir; +use function sprintf; +use function strpos; +use function sys_get_temp_dir; +use function uniqid; +use function unlink; +use const DIRECTORY_SEPARATOR; + /** * @group legacy */ -class LockHandlerTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class LockHandlerTest extends TestCase { public function testConstructWhenRepositoryDoesNotExist() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Filesystem\\Exception\\IOException'); $this->expectExceptionMessage('Failed to create "/a/b/c/d/e": mkdir(): Permission denied.'); - if (!\getenv('USER') || 'root' === \getenv('USER')) { + if (!getenv('USER') || 'root' === getenv('USER')) { $this->markTestSkipped('This test will fail if run under superuser'); } - new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\LockHandler('lock', '/a/b/c/d/e'); + new LockHandler('lock', '/a/b/c/d/e'); } public function testConstructWhenRepositoryIsNotWriteable() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Filesystem\\Exception\\IOException'); $this->expectExceptionMessage('The directory "/" is not writable.'); - if (!\getenv('USER') || 'root' === \getenv('USER')) { + if (!getenv('USER') || 'root' === getenv('USER')) { $this->markTestSkipped('This test will fail if run under superuser'); } - new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\LockHandler('lock', '/'); + new LockHandler('lock', '/'); } public function testErrorHandlingInLockIfLockPathBecomesUnwritable() { // skip test on Windows; PHP can't easily set file as unreadable on Windows - if ('\\' === \DIRECTORY_SEPARATOR) { + if ('\\' === DIRECTORY_SEPARATOR) { $this->markTestSkipped('This test cannot run on Windows.'); } - if (!\getenv('USER') || 'root' === \getenv('USER')) { + if (!getenv('USER') || 'root' === getenv('USER')) { $this->markTestSkipped('This test will fail if run under superuser'); } - $lockPath = \sys_get_temp_dir() . '/' . \uniqid('', \true); + $lockPath = sys_get_temp_dir() . '/' . uniqid('', true); $e = null; $wrongMessage = null; try { - \mkdir($lockPath); - $lockHandler = new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\LockHandler('lock', $lockPath); - \chmod($lockPath, 0444); + mkdir($lockPath); + $lockHandler = new LockHandler('lock', $lockPath); + chmod($lockPath, 0444); $lockHandler->lock(); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Exception\IOException $e) { - if (\false === \strpos($e->getMessage(), 'Permission denied')) { + } catch (IOException $e) { + if (false === strpos($e->getMessage(), 'Permission denied')) { $wrongMessage = $e->getMessage(); } else { $this->addToAssertionCount(1); } - } catch (\Exception $e) { - } catch (\Throwable $e) { + } catch (Exception $e) { + } catch (Throwable $e) { } - if (\is_dir($lockPath)) { - $fs = new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\Filesystem(); + if (is_dir($lockPath)) { + $fs = new Filesystem(); $fs->remove($lockPath); } - $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Filesystem\\Exception\\IOException', $e, \sprintf('Expected IOException to be thrown, got %s instead.', \get_class($e))); - $this->assertNull($wrongMessage, \sprintf('Expected exception message to contain "Permission denied", got "%s" instead.', $wrongMessage)); + $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Filesystem\\Exception\\IOException', $e, sprintf('Expected IOException to be thrown, got %s instead.', get_class($e))); + $this->assertNull($wrongMessage, sprintf('Expected exception message to contain "Permission denied", got "%s" instead.', $wrongMessage)); } public function testConstructSanitizeName() { - $lock = new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\LockHandler(''); - $file = \sprintf('%s/sf.-php-echo-hello-word-.4b3d9d0d27ddef3a78a64685dda3a963e478659a9e5240feaf7b4173a8f28d5f.lock', \sys_get_temp_dir()); + $lock = new LockHandler(''); + $file = sprintf('%s/sf.-php-echo-hello-word-.4b3d9d0d27ddef3a78a64685dda3a963e478659a9e5240feaf7b4173a8f28d5f.lock', sys_get_temp_dir()); // ensure the file does not exist before the lock - @\unlink($file); + @unlink($file); $lock->lock(); $this->assertFileExists($file); $lock->release(); @@ -83,8 +97,8 @@ public function testConstructSanitizeName() public function testLockRelease() { $name = 'symfony-test-filesystem.lock'; - $l1 = new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\LockHandler($name); - $l2 = new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\LockHandler($name); + $l1 = new LockHandler($name); + $l2 = new LockHandler($name); $this->assertTrue($l1->lock()); $this->assertFalse($l2->lock()); $l1->release(); @@ -94,7 +108,7 @@ public function testLockRelease() public function testLockTwice() { $name = 'symfony-test-filesystem.lock'; - $lockHandler = new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\LockHandler($name); + $lockHandler = new LockHandler($name); $this->assertTrue($lockHandler->lock()); $this->assertTrue($lockHandler->lock()); $lockHandler->release(); @@ -102,8 +116,8 @@ public function testLockTwice() public function testLockIsReleased() { $name = 'symfony-test-filesystem.lock'; - $l1 = new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\LockHandler($name); - $l2 = new \_PhpScoper5ea00cc67502b\Symfony\Component\Filesystem\LockHandler($name); + $l1 = new LockHandler($name); + $l2 = new LockHandler($name); $this->assertTrue($l1->lock()); $this->assertFalse($l2->lock()); $l1 = null; diff --git a/vendor/symfony/filesystem/Tests/index.php b/vendor/symfony/filesystem/Tests/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/filesystem/Tests/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/filesystem/index.php b/vendor/symfony/filesystem/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/filesystem/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/index.php b/vendor/symfony/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/polyfill-apcu/Apcu.php b/vendor/symfony/polyfill-apcu/Apcu.php index 7d8945edf..2da9582ff 100644 --- a/vendor/symfony/polyfill-apcu/Apcu.php +++ b/vendor/symfony/polyfill-apcu/Apcu.php @@ -10,6 +10,8 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Polyfill\Apcu; +use function is_array; + /** * Apcu for Zend Server Data Cache. * @@ -22,7 +24,7 @@ final class Apcu { public static function apcu_add($key, $var = null, $ttl = 0) { - if (!\is_array($key)) { + if (!is_array($key)) { return apc_add($key, $var, $ttl); } $errors = array(); @@ -35,7 +37,7 @@ public static function apcu_add($key, $var = null, $ttl = 0) } public static function apcu_store($key, $var = null, $ttl = 0) { - if (!\is_array($key)) { + if (!is_array($key)) { return apc_store($key, $var, $ttl); } $errors = array(); @@ -48,30 +50,30 @@ public static function apcu_store($key, $var = null, $ttl = 0) } public static function apcu_exists($keys) { - if (!\is_array($keys)) { + if (!is_array($keys)) { return apc_exists($keys); } $existing = array(); foreach ($keys as $k) { if (apc_exists($k)) { - $existing[$k] = \true; + $existing[$k] = true; } } return $existing; } public static function apcu_fetch($key, &$success = null) { - if (!\is_array($key)) { + if (!is_array($key)) { return apc_fetch($key, $success); } - $succeeded = \true; + $succeeded = true; $values = array(); foreach ($key as $k) { $v = apc_fetch($k, $success); if ($success) { $values[$k] = $v; } else { - $succeeded = \false; + $succeeded = false; } } $success = $succeeded; @@ -79,10 +81,10 @@ public static function apcu_fetch($key, &$success = null) } public static function apcu_delete($key) { - if (!\is_array($key)) { + if (!is_array($key)) { return apc_delete($key); } - $success = \true; + $success = true; foreach ($key as $k) { $success = apc_delete($k) && $success; } diff --git a/vendor/symfony/polyfill-apcu/bootstrap.php b/vendor/symfony/polyfill-apcu/bootstrap.php index 04d6ceb2c..7e7153eb3 100644 --- a/vendor/symfony/polyfill-apcu/bootstrap.php +++ b/vendor/symfony/polyfill-apcu/bootstrap.php @@ -11,82 +11,89 @@ * file that was distributed with this source code. */ use _PhpScoper5ea00cc67502b\Symfony\Polyfill\Apcu as p; -if (!\extension_loaded('apc') && !\extension_loaded('apcu')) { +use _PhpScoper5ea00cc67502b\Symfony\Polyfill\Apcu\Apcu; +use function class_exists; +use function extension_loaded; +use function function_exists; +use const APC_ITER_ALL; +use const APC_LIST_ACTIVE; + +if (!extension_loaded('apc') && !extension_loaded('apcu')) { return; } -if (!\function_exists('_PhpScoper5ea00cc67502b\\apcu_add')) { - if (\extension_loaded('Zend Data Cache')) { +if (!function_exists('_PhpScoper5ea00cc67502b\\apcu_add')) { + if (extension_loaded('Zend Data Cache')) { function apcu_add($key, $var = null, $ttl = 0) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Apcu\Apcu::apcu_add($key, $var, $ttl); + return Apcu::apcu_add($key, $var, $ttl); } function apcu_delete($key) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Apcu\Apcu::apcu_delete($key); + return Apcu::apcu_delete($key); } function apcu_exists($keys) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Apcu\Apcu::apcu_exists($keys); + return Apcu::apcu_exists($keys); } function apcu_fetch($key, &$success = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Apcu\Apcu::apcu_fetch($key, $success); + return Apcu::apcu_fetch($key, $success); } function apcu_store($key, $var = null, $ttl = 0) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Apcu\Apcu::apcu_store($key, $var, $ttl); + return Apcu::apcu_store($key, $var, $ttl); } } else { function apcu_add($key, $var = null, $ttl = 0) { - return \_PhpScoper5ea00cc67502b\apc_add($key, $var, $ttl); + return apc_add($key, $var, $ttl); } function apcu_delete($key) { - return \_PhpScoper5ea00cc67502b\apc_delete($key); + return apc_delete($key); } function apcu_exists($keys) { - return \_PhpScoper5ea00cc67502b\apc_exists($keys); + return apc_exists($keys); } function apcu_fetch($key, &$success = null) { - return \_PhpScoper5ea00cc67502b\apc_fetch($key, $success); + return apc_fetch($key, $success); } function apcu_store($key, $var = null, $ttl = 0) { - return \_PhpScoper5ea00cc67502b\apc_store($key, $var, $ttl); + return apc_store($key, $var, $ttl); } } - function apcu_cache_info($limited = \false) + function apcu_cache_info($limited = false) { - return \_PhpScoper5ea00cc67502b\apc_cache_info('user', $limited); + return apc_cache_info('user', $limited); } function apcu_cas($key, $old, $new) { - return \_PhpScoper5ea00cc67502b\apc_cas($key, $old, $new); + return apc_cas($key, $old, $new); } function apcu_clear_cache() { - return \_PhpScoper5ea00cc67502b\apc_clear_cache('user'); + return apc_clear_cache('user'); } - function apcu_dec($key, $step = 1, &$success = \false) + function apcu_dec($key, $step = 1, &$success = false) { - return \_PhpScoper5ea00cc67502b\apc_dec($key, $step, $success); + return apc_dec($key, $step, $success); } - function apcu_inc($key, $step = 1, &$success = \false) + function apcu_inc($key, $step = 1, &$success = false) { - return \_PhpScoper5ea00cc67502b\apc_inc($key, $step, $success); + return apc_inc($key, $step, $success); } - function apcu_sma_info($limited = \false) + function apcu_sma_info($limited = false) { - return \_PhpScoper5ea00cc67502b\apc_sma_info($limited); + return apc_sma_info($limited); } } -if (!\class_exists('_PhpScoper5ea00cc67502b\\APCUIterator', \false) && \class_exists('_PhpScoper5ea00cc67502b\\APCIterator', \false)) { - class APCUIterator extends \_PhpScoper5ea00cc67502b\APCIterator +if (!class_exists('_PhpScoper5ea00cc67502b\\APCUIterator', false) && class_exists('_PhpScoper5ea00cc67502b\\APCIterator', false)) { + class APCUIterator extends APCIterator { - public function __construct($search = null, $format = \APC_ITER_ALL, $chunk_size = 100, $list = \APC_LIST_ACTIVE) + public function __construct($search = null, $format = APC_ITER_ALL, $chunk_size = 100, $list = APC_LIST_ACTIVE) { parent::__construct('user', $search, $format, $chunk_size, $list); } diff --git a/vendor/symfony/polyfill-apcu/index.php b/vendor/symfony/polyfill-apcu/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/polyfill-apcu/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/polyfill-ctype/Ctype.php b/vendor/symfony/polyfill-ctype/Ctype.php index c3b723ce1..3686f310f 100644 --- a/vendor/symfony/polyfill-ctype/Ctype.php +++ b/vendor/symfony/polyfill-ctype/Ctype.php @@ -10,6 +10,11 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Polyfill\Ctype; +use function chr; +use function is_int; +use function is_string; +use function preg_match; + /** * Ctype implementation through regex. * @@ -31,7 +36,7 @@ final class Ctype public static function ctype_alnum($text) { $text = self::convert_int_to_char_for_ctype($text); - return \is_string($text) && '' !== $text && !\preg_match('/[^A-Za-z0-9]/', $text); + return is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text); } /** * Returns TRUE if every character in text is a letter, FALSE otherwise. @@ -45,7 +50,7 @@ public static function ctype_alnum($text) public static function ctype_alpha($text) { $text = self::convert_int_to_char_for_ctype($text); - return \is_string($text) && '' !== $text && !\preg_match('/[^A-Za-z]/', $text); + return is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text); } /** * Returns TRUE if every character in text is a control character from the current locale, FALSE otherwise. @@ -59,7 +64,7 @@ public static function ctype_alpha($text) public static function ctype_cntrl($text) { $text = self::convert_int_to_char_for_ctype($text); - return \is_string($text) && '' !== $text && !\preg_match('/[^\\x00-\\x1f\\x7f]/', $text); + return is_string($text) && '' !== $text && !preg_match('/[^\\x00-\\x1f\\x7f]/', $text); } /** * Returns TRUE if every character in the string text is a decimal digit, FALSE otherwise. @@ -73,7 +78,7 @@ public static function ctype_cntrl($text) public static function ctype_digit($text) { $text = self::convert_int_to_char_for_ctype($text); - return \is_string($text) && '' !== $text && !\preg_match('/[^0-9]/', $text); + return is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text); } /** * Returns TRUE if every character in text is printable and actually creates visible output (no white space), FALSE otherwise. @@ -87,7 +92,7 @@ public static function ctype_digit($text) public static function ctype_graph($text) { $text = self::convert_int_to_char_for_ctype($text); - return \is_string($text) && '' !== $text && !\preg_match('/[^!-~]/', $text); + return is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text); } /** * Returns TRUE if every character in text is a lowercase letter. @@ -101,7 +106,7 @@ public static function ctype_graph($text) public static function ctype_lower($text) { $text = self::convert_int_to_char_for_ctype($text); - return \is_string($text) && '' !== $text && !\preg_match('/[^a-z]/', $text); + return is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text); } /** * Returns TRUE if every character in text will actually create output (including blanks). Returns FALSE if text contains control characters or characters that do not have any output or control function at all. @@ -115,7 +120,7 @@ public static function ctype_lower($text) public static function ctype_print($text) { $text = self::convert_int_to_char_for_ctype($text); - return \is_string($text) && '' !== $text && !\preg_match('/[^ -~]/', $text); + return is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text); } /** * Returns TRUE if every character in text is printable, but neither letter, digit or blank, FALSE otherwise. @@ -129,7 +134,7 @@ public static function ctype_print($text) public static function ctype_punct($text) { $text = self::convert_int_to_char_for_ctype($text); - return \is_string($text) && '' !== $text && !\preg_match('/[^!-\\/\\:-@\\[-`\\{-~]/', $text); + return is_string($text) && '' !== $text && !preg_match('/[^!-\\/\\:-@\\[-`\\{-~]/', $text); } /** * Returns TRUE if every character in text creates some sort of white space, FALSE otherwise. Besides the blank character this also includes tab, vertical tab, line feed, carriage return and form feed characters. @@ -143,7 +148,7 @@ public static function ctype_punct($text) public static function ctype_space($text) { $text = self::convert_int_to_char_for_ctype($text); - return \is_string($text) && '' !== $text && !\preg_match('/[^\\s]/', $text); + return is_string($text) && '' !== $text && !preg_match('/[^\\s]/', $text); } /** * Returns TRUE if every character in text is an uppercase letter. @@ -157,7 +162,7 @@ public static function ctype_space($text) public static function ctype_upper($text) { $text = self::convert_int_to_char_for_ctype($text); - return \is_string($text) && '' !== $text && !\preg_match('/[^A-Z]/', $text); + return is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text); } /** * Returns TRUE if every character in text is a hexadecimal 'digit', that is a decimal digit or a character from [A-Fa-f] , FALSE otherwise. @@ -171,7 +176,7 @@ public static function ctype_upper($text) public static function ctype_xdigit($text) { $text = self::convert_int_to_char_for_ctype($text); - return \is_string($text) && '' !== $text && !\preg_match('/[^A-Fa-f0-9]/', $text); + return is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text); } /** * Converts integers to their char versions according to normal ctype behaviour, if needed. @@ -187,7 +192,7 @@ public static function ctype_xdigit($text) */ private static function convert_int_to_char_for_ctype($int) { - if (!\is_int($int)) { + if (!is_int($int)) { return $int; } if ($int < -128 || $int > 255) { @@ -196,6 +201,6 @@ private static function convert_int_to_char_for_ctype($int) if ($int < 0) { $int += 256; } - return \chr($int); + return chr($int); } } diff --git a/vendor/symfony/polyfill-ctype/bootstrap.php b/vendor/symfony/polyfill-ctype/bootstrap.php index 124f579d0..64eb3ed68 100644 --- a/vendor/symfony/polyfill-ctype/bootstrap.php +++ b/vendor/symfony/polyfill-ctype/bootstrap.php @@ -11,49 +11,52 @@ * file that was distributed with this source code. */ use _PhpScoper5ea00cc67502b\Symfony\Polyfill\Ctype as p; -if (!\function_exists('ctype_alnum')) { +use _PhpScoper5ea00cc67502b\Symfony\Polyfill\Ctype\Ctype; +use function function_exists; + +if (!function_exists('ctype_alnum')) { function ctype_alnum($text) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Ctype\Ctype::ctype_alnum($text); + return Ctype::ctype_alnum($text); } function ctype_alpha($text) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Ctype\Ctype::ctype_alpha($text); + return Ctype::ctype_alpha($text); } function ctype_cntrl($text) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Ctype\Ctype::ctype_cntrl($text); + return Ctype::ctype_cntrl($text); } function ctype_digit($text) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Ctype\Ctype::ctype_digit($text); + return Ctype::ctype_digit($text); } function ctype_graph($text) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Ctype\Ctype::ctype_graph($text); + return Ctype::ctype_graph($text); } function ctype_lower($text) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Ctype\Ctype::ctype_lower($text); + return Ctype::ctype_lower($text); } function ctype_print($text) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Ctype\Ctype::ctype_print($text); + return Ctype::ctype_print($text); } function ctype_punct($text) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Ctype\Ctype::ctype_punct($text); + return Ctype::ctype_punct($text); } function ctype_space($text) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Ctype\Ctype::ctype_space($text); + return Ctype::ctype_space($text); } function ctype_upper($text) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Ctype\Ctype::ctype_upper($text); + return Ctype::ctype_upper($text); } function ctype_xdigit($text) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Ctype\Ctype::ctype_xdigit($text); + return Ctype::ctype_xdigit($text); } } diff --git a/vendor/symfony/polyfill-ctype/index.php b/vendor/symfony/polyfill-ctype/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/polyfill-ctype/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/polyfill-intl-idn/Idn.php b/vendor/symfony/polyfill-intl-idn/Idn.php index b87d9fe49..9ef8a6ab6 100644 --- a/vendor/symfony/polyfill-intl-idn/Idn.php +++ b/vendor/symfony/polyfill-intl-idn/Idn.php @@ -26,6 +26,23 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Polyfill\Intl\Idn; +use function array_unique; +use function count; +use function explode; +use function implode; +use function mb_strlen; +use function mb_strtolower; +use function mb_substr; +use function sort; +use function strlen; +use function strpos; +use function strrpos; +use function strtolower; +use function substr; +use function trigger_error; +use const E_USER_DEPRECATED; +use const PHP_VERSION_ID; + /** * Partial intl implementation in pure PHP. * @@ -48,44 +65,44 @@ final class Idn private static $decodeTable = array('a' => 0, 'b' => 1, 'c' => 2, 'd' => 3, 'e' => 4, 'f' => 5, 'g' => 6, 'h' => 7, 'i' => 8, 'j' => 9, 'k' => 10, 'l' => 11, 'm' => 12, 'n' => 13, 'o' => 14, 'p' => 15, 'q' => 16, 'r' => 17, 's' => 18, 't' => 19, 'u' => 20, 'v' => 21, 'w' => 22, 'x' => 23, 'y' => 24, 'z' => 25, '0' => 26, '1' => 27, '2' => 28, '3' => 29, '4' => 30, '5' => 31, '6' => 32, '7' => 33, '8' => 34, '9' => 35); public static function idn_to_ascii($domain, $options, $variant, &$idna_info = array()) { - if (\PHP_VERSION_ID >= 70200 && self::INTL_IDNA_VARIANT_2003 === $variant) { - @\trigger_error('idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated', \E_USER_DEPRECATED); + if (PHP_VERSION_ID >= 70200 && self::INTL_IDNA_VARIANT_2003 === $variant) { + @trigger_error('idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated', E_USER_DEPRECATED); } if (self::INTL_IDNA_VARIANT_UTS46 === $variant) { - $domain = \mb_strtolower($domain, 'utf-8'); + $domain = mb_strtolower($domain, 'utf-8'); } - $parts = \explode('.', $domain); + $parts = explode('.', $domain); foreach ($parts as $i => &$part) { - if ('' === $part && \count($parts) > 1 + $i) { - return \false; + if ('' === $part && count($parts) > 1 + $i) { + return false; } - if (\false === ($part = self::encodePart($part))) { - return \false; + if (false === ($part = self::encodePart($part))) { + return false; } } - $output = \implode('.', $parts); - $idna_info = array('result' => \strlen($output) > 255 ? \false : $output, 'isTransitionalDifferent' => \false, 'errors' => 0); + $output = implode('.', $parts); + $idna_info = array('result' => strlen($output) > 255 ? false : $output, 'isTransitionalDifferent' => false, 'errors' => 0); return $idna_info['result']; } public static function idn_to_utf8($domain, $options, $variant, &$idna_info = array()) { - if (\PHP_VERSION_ID >= 70200 && self::INTL_IDNA_VARIANT_2003 === $variant) { - @\trigger_error('idn_to_utf8(): INTL_IDNA_VARIANT_2003 is deprecated', \E_USER_DEPRECATED); + if (PHP_VERSION_ID >= 70200 && self::INTL_IDNA_VARIANT_2003 === $variant) { + @trigger_error('idn_to_utf8(): INTL_IDNA_VARIANT_2003 is deprecated', E_USER_DEPRECATED); } - $parts = \explode('.', $domain); + $parts = explode('.', $domain); foreach ($parts as &$part) { - $length = \strlen($part); + $length = strlen($part); if ($length < 1 || 63 < $length) { continue; } - if (0 !== \strpos($part, 'xn--')) { + if (0 !== strpos($part, 'xn--')) { continue; } - $part = \substr($part, 4); + $part = substr($part, 4); $part = self::decodePart($part); } - $output = \implode('.', $parts); - $idna_info = array('result' => \strlen($output) > 255 ? \false : $output, 'isTransitionalDifferent' => \false, 'errors' => 0); + $output = implode('.', $parts); + $idna_info = array('result' => strlen($output) > 255 ? false : $output, 'isTransitionalDifferent' => false, 'errors' => 0); return $idna_info['result']; } private static function encodePart($input) @@ -94,7 +111,7 @@ private static function encodePart($input) $n = 128; $bias = 72; $delta = 0; - $h = $b = \count($codePoints['basic']); + $h = $b = count($codePoints['basic']); $output = ''; foreach ($codePoints['basic'] as $code) { $output .= mb_chr($code, 'utf-8'); @@ -105,10 +122,10 @@ private static function encodePart($input) if ($b > 0) { $output .= '-'; } - $codePoints['nonBasic'] = \array_unique($codePoints['nonBasic']); - \sort($codePoints['nonBasic']); + $codePoints['nonBasic'] = array_unique($codePoints['nonBasic']); + sort($codePoints['nonBasic']); $i = 0; - $length = \mb_strlen($input, 'utf-8'); + $length = mb_strlen($input, 'utf-8'); while ($h < $length) { $m = $codePoints['nonBasic'][$i++]; $delta += ($m - $n) * ($h + 1); @@ -138,14 +155,14 @@ private static function encodePart($input) ++$n; } $output = 'xn--' . $output; - return \strlen($output) < 1 || 63 < \strlen($output) ? \false : \strtolower($output); + return strlen($output) < 1 || 63 < strlen($output) ? false : strtolower($output); } private static function listCodePoints($input) { $codePoints = array('all' => array(), 'basic' => array(), 'nonBasic' => array()); - $length = \mb_strlen($input, 'utf-8'); + $length = mb_strlen($input, 'utf-8'); for ($i = 0; $i < $length; ++$i) { - $char = \mb_substr($input, $i, 1, 'utf-8'); + $char = mb_substr($input, $i, 1, 'utf-8'); $code = mb_ord($char, 'utf-8'); if ($code < 128) { $codePoints['all'][] = $codePoints['basic'][] = $code; @@ -182,14 +199,14 @@ private static function decodePart($input) $i = 0; $bias = 72; $output = ''; - $pos = \strrpos($input, '-'); - if (\false !== $pos) { - $output = \substr($input, 0, $pos++); + $pos = strrpos($input, '-'); + if (false !== $pos) { + $output = substr($input, 0, $pos++); } else { $pos = 0; } - $outputLength = \strlen($output); - $inputLength = \strlen($input); + $outputLength = strlen($output); + $inputLength = strlen($input); while ($pos < $inputLength) { $oldi = $i; $w = 1; @@ -205,7 +222,7 @@ private static function decodePart($input) $bias = self::adapt($i - $oldi, ++$outputLength, 0 === $oldi); $n = $n + (int) ($i / $outputLength); $i = $i % $outputLength; - $output = \mb_substr($output, 0, $i, 'utf-8') . mb_chr($n, 'utf-8') . \mb_substr($output, $i, $outputLength - 1, 'utf-8'); + $output = mb_substr($output, 0, $i, 'utf-8') . mb_chr($n, 'utf-8') . mb_substr($output, $i, $outputLength - 1, 'utf-8'); ++$i; } return $output; diff --git a/vendor/symfony/polyfill-intl-idn/bootstrap.php b/vendor/symfony/polyfill-intl-idn/bootstrap.php index fdd134bb3..4a37c5f75 100644 --- a/vendor/symfony/polyfill-intl-idn/bootstrap.php +++ b/vendor/symfony/polyfill-intl-idn/bootstrap.php @@ -11,62 +11,71 @@ * file that was distributed with this source code. */ use _PhpScoper5ea00cc67502b\Symfony\Polyfill\Intl\Idn as p; -if (!\defined('IDNA_DEFAULT')) { - \define('U_IDNA_PROHIBITED_ERROR', 66560); - \define('U_IDNA_ERROR_START', 66560); - \define('U_IDNA_UNASSIGNED_ERROR', 66561); - \define('U_IDNA_CHECK_BIDI_ERROR', 66562); - \define('U_IDNA_STD3_ASCII_RULES_ERROR', 66563); - \define('U_IDNA_ACE_PREFIX_ERROR', 66564); - \define('U_IDNA_VERIFICATION_ERROR', 66565); - \define('U_IDNA_LABEL_TOO_LONG_ERROR', 66566); - \define('U_IDNA_ZERO_LENGTH_LABEL_ERROR', 66567); - \define('U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR', 66568); - \define('U_IDNA_ERROR_LIMIT', 66569); - \define('U_STRINGPREP_PROHIBITED_ERROR', 66560); - \define('U_STRINGPREP_UNASSIGNED_ERROR', 66561); - \define('U_STRINGPREP_CHECK_BIDI_ERROR', 66562); - \define('IDNA_DEFAULT', 0); - \define('IDNA_ALLOW_UNASSIGNED', 1); - \define('IDNA_USE_STD3_RULES', 2); - \define('IDNA_CHECK_BIDI', 4); - \define('IDNA_CHECK_CONTEXTJ', 8); - \define('IDNA_NONTRANSITIONAL_TO_ASCII', 16); - \define('IDNA_NONTRANSITIONAL_TO_UNICODE', 32); - \define('INTL_IDNA_VARIANT_2003', 0); - \define('INTL_IDNA_VARIANT_UTS46', 1); - \define('IDNA_ERROR_EMPTY_LABEL', 1); - \define('IDNA_ERROR_LABEL_TOO_LONG', 2); - \define('IDNA_ERROR_DOMAIN_NAME_TOO_LONG', 4); - \define('IDNA_ERROR_LEADING_HYPHEN', 8); - \define('IDNA_ERROR_TRAILING_HYPHEN', 16); - \define('IDNA_ERROR_HYPHEN_3_4', 32); - \define('IDNA_ERROR_LEADING_COMBINING_MARK', 64); - \define('IDNA_ERROR_DISALLOWED', 128); - \define('IDNA_ERROR_PUNYCODE', 256); - \define('IDNA_ERROR_LABEL_HAS_DOT', 512); - \define('IDNA_ERROR_INVALID_ACE_LABEL', 1024); - \define('IDNA_ERROR_BIDI', 2048); - \define('IDNA_ERROR_CONTEXTJ', 4096); +use _PhpScoper5ea00cc67502b\Symfony\Polyfill\Intl\Idn\Idn; +use function define; +use function defined; +use function function_exists; +use const IDNA_DEFAULT; +use const INTL_IDNA_VARIANT_2003; +use const INTL_IDNA_VARIANT_UTS46; +use const PHP_VERSION_ID; + +if (!defined('IDNA_DEFAULT')) { + define('U_IDNA_PROHIBITED_ERROR', 66560); + define('U_IDNA_ERROR_START', 66560); + define('U_IDNA_UNASSIGNED_ERROR', 66561); + define('U_IDNA_CHECK_BIDI_ERROR', 66562); + define('U_IDNA_STD3_ASCII_RULES_ERROR', 66563); + define('U_IDNA_ACE_PREFIX_ERROR', 66564); + define('U_IDNA_VERIFICATION_ERROR', 66565); + define('U_IDNA_LABEL_TOO_LONG_ERROR', 66566); + define('U_IDNA_ZERO_LENGTH_LABEL_ERROR', 66567); + define('U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR', 66568); + define('U_IDNA_ERROR_LIMIT', 66569); + define('U_STRINGPREP_PROHIBITED_ERROR', 66560); + define('U_STRINGPREP_UNASSIGNED_ERROR', 66561); + define('U_STRINGPREP_CHECK_BIDI_ERROR', 66562); + define('IDNA_DEFAULT', 0); + define('IDNA_ALLOW_UNASSIGNED', 1); + define('IDNA_USE_STD3_RULES', 2); + define('IDNA_CHECK_BIDI', 4); + define('IDNA_CHECK_CONTEXTJ', 8); + define('IDNA_NONTRANSITIONAL_TO_ASCII', 16); + define('IDNA_NONTRANSITIONAL_TO_UNICODE', 32); + define('INTL_IDNA_VARIANT_2003', 0); + define('INTL_IDNA_VARIANT_UTS46', 1); + define('IDNA_ERROR_EMPTY_LABEL', 1); + define('IDNA_ERROR_LABEL_TOO_LONG', 2); + define('IDNA_ERROR_DOMAIN_NAME_TOO_LONG', 4); + define('IDNA_ERROR_LEADING_HYPHEN', 8); + define('IDNA_ERROR_TRAILING_HYPHEN', 16); + define('IDNA_ERROR_HYPHEN_3_4', 32); + define('IDNA_ERROR_LEADING_COMBINING_MARK', 64); + define('IDNA_ERROR_DISALLOWED', 128); + define('IDNA_ERROR_PUNYCODE', 256); + define('IDNA_ERROR_LABEL_HAS_DOT', 512); + define('IDNA_ERROR_INVALID_ACE_LABEL', 1024); + define('IDNA_ERROR_BIDI', 2048); + define('IDNA_ERROR_CONTEXTJ', 4096); } -if (!\function_exists('idn_to_ascii')) { - if (\PHP_VERSION_ID < 70400) { - function idn_to_ascii($domain, $options = \IDNA_DEFAULT, $variant = \INTL_IDNA_VARIANT_2003, &$idna_info = array()) +if (!function_exists('idn_to_ascii')) { + if (PHP_VERSION_ID < 70400) { + function idn_to_ascii($domain, $options = IDNA_DEFAULT, $variant = INTL_IDNA_VARIANT_2003, &$idna_info = array()) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Intl\Idn\Idn::idn_to_ascii($domain, $options, $variant, $idna_info); + return Idn::idn_to_ascii($domain, $options, $variant, $idna_info); } - function idn_to_utf8($domain, $options = \IDNA_DEFAULT, $variant = \INTL_IDNA_VARIANT_2003, &$idna_info = array()) + function idn_to_utf8($domain, $options = IDNA_DEFAULT, $variant = INTL_IDNA_VARIANT_2003, &$idna_info = array()) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Intl\Idn\Idn::idn_to_utf8($domain, $options, $variant, $idna_info); + return Idn::idn_to_utf8($domain, $options, $variant, $idna_info); } } else { - function idn_to_ascii($domain, $options = \IDNA_DEFAULT, $variant = \INTL_IDNA_VARIANT_UTS46, &$idna_info = array()) + function idn_to_ascii($domain, $options = IDNA_DEFAULT, $variant = INTL_IDNA_VARIANT_UTS46, &$idna_info = array()) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Intl\Idn\Idn::idn_to_ascii($domain, $options, $variant, $idna_info); + return Idn::idn_to_ascii($domain, $options, $variant, $idna_info); } - function idn_to_utf8($domain, $options = \IDNA_DEFAULT, $variant = \INTL_IDNA_VARIANT_UTS46, &$idna_info = array()) + function idn_to_utf8($domain, $options = IDNA_DEFAULT, $variant = INTL_IDNA_VARIANT_UTS46, &$idna_info = array()) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Intl\Idn\Idn::idn_to_utf8($domain, $options, $variant, $idna_info); + return Idn::idn_to_utf8($domain, $options, $variant, $idna_info); } } } diff --git a/vendor/symfony/polyfill-intl-idn/index.php b/vendor/symfony/polyfill-intl-idn/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/polyfill-intl-idn/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/polyfill-mbstring/Mbstring.php b/vendor/symfony/polyfill-mbstring/Mbstring.php index e218d16ba..4efc9fb0b 100644 --- a/vendor/symfony/polyfill-mbstring/Mbstring.php +++ b/vendor/symfony/polyfill-mbstring/Mbstring.php @@ -10,6 +10,62 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring; +use function array_map; +use function array_walk_recursive; +use function base64_decode; +use function base64_encode; +use function chr; +use function count; +use function explode; +use function file_exists; +use function floor; +use function gettype; +use function hexdec; +use function html_entity_decode; +use function htmlentities; +use function iconv; +use function iconv_mime_decode; +use function iconv_strlen; +use function iconv_strpos; +use function iconv_strrpos; +use function iconv_substr; +use function is_array; +use function is_object; +use function is_scalar; +use function mb_convert_encoding; +use function mb_internal_encoding; +use function mb_strlen; +use function mb_substr; +use function method_exists; +use function ord; +use function preg_match; +use function preg_replace; +use function preg_replace_callback; +use function preg_split; +use function sprintf; +use function str_replace; +use function strcasecmp; +use function strlen; +use function strncmp; +use function strpos; +use function strrchr; +use function strrpos; +use function strtolower; +use function strtoupper; +use function substr; +use function substr_count; +use function substr_replace; +use function trigger_error; +use function unpack; +use const E_USER_WARNING; +use const ENT_COMPAT; +use const MB_CASE_LOWER; +use const MB_CASE_TITLE; +use const MB_CASE_UPPER; +use const PHP_INT_MAX; +use const PREG_SPLIT_DELIM_CAPTURE; +use const PREG_SPLIT_NO_EMPTY; + /** * Partial mbstring implementation in PHP, iconv based, UTF-8 centric. * @@ -66,71 +122,71 @@ */ final class Mbstring { - const MB_CASE_FOLD = \PHP_INT_MAX; + const MB_CASE_FOLD = PHP_INT_MAX; private static $encodingList = array('ASCII', 'UTF-8'); private static $language = 'neutral'; private static $internalEncoding = 'UTF-8'; private static $caseFold = array(array('µ', 'ſ', "ͅ", 'ς', "ϐ", "ϑ", "ϕ", "ϖ", "ϰ", "ϱ", "ϵ", "ẛ", "ι"), array('μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "ṡ", 'ι')); public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null) { - if (\is_array($fromEncoding) || \false !== \strpos($fromEncoding, ',')) { + if (is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) { $fromEncoding = self::mb_detect_encoding($s, $fromEncoding); } else { $fromEncoding = self::getEncoding($fromEncoding); } $toEncoding = self::getEncoding($toEncoding); if ('BASE64' === $fromEncoding) { - $s = \base64_decode($s); + $s = base64_decode($s); $fromEncoding = $toEncoding; } if ('BASE64' === $toEncoding) { - return \base64_encode($s); + return base64_encode($s); } if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) { if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) { $fromEncoding = 'Windows-1252'; } if ('UTF-8' !== $fromEncoding) { - $s = \iconv($fromEncoding, 'UTF-8//IGNORE', $s); + $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s); } - return \preg_replace_callback('/[\\x80-\\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s); + return preg_replace_callback('/[\\x80-\\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s); } if ('HTML-ENTITIES' === $fromEncoding) { - $s = \html_entity_decode($s, \ENT_COMPAT, 'UTF-8'); + $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8'); $fromEncoding = 'UTF-8'; } - return \iconv($fromEncoding, $toEncoding . '//IGNORE', $s); + return iconv($fromEncoding, $toEncoding . '//IGNORE', $s); } public static function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) { $vars = array(&$a, &$b, &$c, &$d, &$e, &$f); - $ok = \true; - \array_walk_recursive($vars, function (&$v) use(&$ok, $toEncoding, $fromEncoding) { - if (\false === ($v = \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding))) { - $ok = \false; + $ok = true; + array_walk_recursive($vars, function (&$v) use(&$ok, $toEncoding, $fromEncoding) { + if (false === ($v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding))) { + $ok = false; } }); - return $ok ? $fromEncoding : \false; + return $ok ? $fromEncoding : false; } public static function mb_decode_mimeheader($s) { - return \iconv_mime_decode($s, 2, self::$internalEncoding); + return iconv_mime_decode($s, 2, self::$internalEncoding); } public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null) { - \trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', \E_USER_WARNING); + trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING); } public static function mb_decode_numericentity($s, $convmap, $encoding = null) { - if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) { - \trigger_error('mb_decode_numericentity() expects parameter 1 to be string, ' . \gettype($s) . ' given', \E_USER_WARNING); + if (null !== $s && !is_scalar($s) && !(is_object($s) && method_exists($s, '__toString'))) { + trigger_error('mb_decode_numericentity() expects parameter 1 to be string, ' . gettype($s) . ' given', E_USER_WARNING); return null; } - if (!\is_array($convmap) || !$convmap) { - return \false; + if (!is_array($convmap) || !$convmap) { + return false; } - if (null !== $encoding && !\is_scalar($encoding)) { - \trigger_error('mb_decode_numericentity() expects parameter 3 to be string, ' . \gettype($s) . ' given', \E_USER_WARNING); + if (null !== $encoding && !is_scalar($encoding)) { + trigger_error('mb_decode_numericentity() expects parameter 3 to be string, ' . gettype($s) . ' given', E_USER_WARNING); return ''; // Instead of null (cf. mb_encode_numericentity). } @@ -141,23 +197,23 @@ public static function mb_decode_numericentity($s, $convmap, $encoding = null) $encoding = self::getEncoding($encoding); if ('UTF-8' === $encoding) { $encoding = null; - if (!\preg_match('//u', $s)) { - $s = @\iconv('UTF-8', 'UTF-8//IGNORE', $s); + if (!preg_match('//u', $s)) { + $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s); } } else { - $s = \iconv($encoding, 'UTF-8//IGNORE', $s); + $s = iconv($encoding, 'UTF-8//IGNORE', $s); } - $cnt = \floor(\count($convmap) / 4) * 4; + $cnt = floor(count($convmap) / 4) * 4; for ($i = 0; $i < $cnt; $i += 4) { // collector_decode_htmlnumericentity ignores $convmap[$i + 3] $convmap[$i] += $convmap[$i + 2]; $convmap[$i + 1] += $convmap[$i + 2]; } - $s = \preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use($cnt, $convmap) { - $c = isset($m[2]) ? (int) \hexdec($m[2]) : $m[1]; + $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use($cnt, $convmap) { + $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1]; for ($i = 0; $i < $cnt; $i += 4) { if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_chr($c - $convmap[$i + 2]); + return Mbstring::mb_chr($c - $convmap[$i + 2]); } } return $m[0]; @@ -165,24 +221,24 @@ public static function mb_decode_numericentity($s, $convmap, $encoding = null) if (null === $encoding) { return $s; } - return \iconv('UTF-8', $encoding . '//IGNORE', $s); + return iconv('UTF-8', $encoding . '//IGNORE', $s); } - public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = \false) + public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false) { - if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) { - \trigger_error('mb_encode_numericentity() expects parameter 1 to be string, ' . \gettype($s) . ' given', \E_USER_WARNING); + if (null !== $s && !is_scalar($s) && !(is_object($s) && method_exists($s, '__toString'))) { + trigger_error('mb_encode_numericentity() expects parameter 1 to be string, ' . gettype($s) . ' given', E_USER_WARNING); return null; } - if (!\is_array($convmap) || !$convmap) { - return \false; + if (!is_array($convmap) || !$convmap) { + return false; } - if (null !== $encoding && !\is_scalar($encoding)) { - \trigger_error('mb_encode_numericentity() expects parameter 3 to be string, ' . \gettype($s) . ' given', \E_USER_WARNING); + if (null !== $encoding && !is_scalar($encoding)) { + trigger_error('mb_encode_numericentity() expects parameter 3 to be string, ' . gettype($s) . ' given', E_USER_WARNING); return null; // Instead of '' (cf. mb_decode_numericentity). } - if (null !== $is_hex && !\is_scalar($is_hex)) { - \trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, ' . \gettype($s) . ' given', \E_USER_WARNING); + if (null !== $is_hex && !is_scalar($is_hex)) { + trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, ' . gettype($s) . ' given', E_USER_WARNING); return null; } $s = (string) $s; @@ -192,26 +248,26 @@ public static function mb_encode_numericentity($s, $convmap, $encoding = null, $ $encoding = self::getEncoding($encoding); if ('UTF-8' === $encoding) { $encoding = null; - if (!\preg_match('//u', $s)) { - $s = @\iconv('UTF-8', 'UTF-8//IGNORE', $s); + if (!preg_match('//u', $s)) { + $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s); } } else { - $s = \iconv($encoding, 'UTF-8//IGNORE', $s); + $s = iconv($encoding, 'UTF-8//IGNORE', $s); } - static $ulenMask = array("" => 2, "" => 2, "" => 3, "" => 4); - $cnt = \floor(\count($convmap) / 4) * 4; + static $ulenMask = array("�" => 2, "�" => 2, "�" => 3, "�" => 4); + $cnt = floor(count($convmap) / 4) * 4; $i = 0; - $len = \strlen($s); + $len = strlen($s); $result = ''; while ($i < $len) { - $ulen = $s[$i] < "" ? 1 : $ulenMask[$s[$i] & ""]; - $uchr = \substr($s, $i, $ulen); + $ulen = $s[$i] < "�" ? 1 : $ulenMask[$s[$i] & "�"]; + $uchr = substr($s, $i, $ulen); $i += $ulen; $c = self::mb_ord($uchr); for ($j = 0; $j < $cnt; $j += 4) { if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) { $cOffset = $c + $convmap[$j + 2] & $convmap[$j + 3]; - $result .= $is_hex ? \sprintf('&#x%X;', $cOffset) : '&#' . $cOffset . ';'; + $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#' . $cOffset . ';'; continue 2; } } @@ -220,7 +276,7 @@ public static function mb_encode_numericentity($s, $convmap, $encoding = null, $ if (null === $encoding) { return $result; } - return \iconv('UTF-8', $encoding . '//IGNORE', $result); + return iconv('UTF-8', $encoding . '//IGNORE', $result); } public static function mb_convert_case($s, $mode, $encoding = null) { @@ -231,20 +287,20 @@ public static function mb_convert_case($s, $mode, $encoding = null) $encoding = self::getEncoding($encoding); if ('UTF-8' === $encoding) { $encoding = null; - if (!\preg_match('//u', $s)) { - $s = @\iconv('UTF-8', 'UTF-8//IGNORE', $s); + if (!preg_match('//u', $s)) { + $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s); } } else { - $s = \iconv($encoding, 'UTF-8//IGNORE', $s); + $s = iconv($encoding, 'UTF-8//IGNORE', $s); } - if (\MB_CASE_TITLE == $mode) { + if (MB_CASE_TITLE == $mode) { static $titleRegexp = null; if (null === $titleRegexp) { $titleRegexp = self::getData('titleCaseRegexp'); } - $s = \preg_replace_callback($titleRegexp, array(__CLASS__, 'title_case'), $s); + $s = preg_replace_callback($titleRegexp, array(__CLASS__, 'title_case'), $s); } else { - if (\MB_CASE_UPPER == $mode) { + if (MB_CASE_UPPER == $mode) { static $upper = null; if (null === $upper) { $upper = self::getData('upperCase'); @@ -252,7 +308,7 @@ public static function mb_convert_case($s, $mode, $encoding = null) $map = $upper; } else { if (self::MB_CASE_FOLD === $mode) { - $s = \str_replace(self::$caseFold[0], self::$caseFold[1], $s); + $s = str_replace(self::$caseFold[0], self::$caseFold[1], $s); } static $lower = null; if (null === $lower) { @@ -260,23 +316,23 @@ public static function mb_convert_case($s, $mode, $encoding = null) } $map = $lower; } - static $ulenMask = array("" => 2, "" => 2, "" => 3, "" => 4); + static $ulenMask = array("�" => 2, "�" => 2, "�" => 3, "�" => 4); $i = 0; - $len = \strlen($s); + $len = strlen($s); while ($i < $len) { - $ulen = $s[$i] < "" ? 1 : $ulenMask[$s[$i] & ""]; - $uchr = \substr($s, $i, $ulen); + $ulen = $s[$i] < "�" ? 1 : $ulenMask[$s[$i] & "�"]; + $uchr = substr($s, $i, $ulen); $i += $ulen; if (isset($map[$uchr])) { $uchr = $map[$uchr]; - $nlen = \strlen($uchr); + $nlen = strlen($uchr); if ($nlen == $ulen) { $nlen = $i; do { $s[--$nlen] = $uchr[--$ulen]; } while ($ulen); } else { - $s = \substr_replace($s, $uchr, $i - $ulen, $ulen); + $s = substr_replace($s, $uchr, $i - $ulen, $ulen); $len += $nlen - $ulen; $i += $nlen - $ulen; } @@ -286,7 +342,7 @@ public static function mb_convert_case($s, $mode, $encoding = null) if (null === $encoding) { return $s; } - return \iconv('UTF-8', $encoding . '//IGNORE', $s); + return iconv('UTF-8', $encoding . '//IGNORE', $s); } public static function mb_internal_encoding($encoding = null) { @@ -294,24 +350,24 @@ public static function mb_internal_encoding($encoding = null) return self::$internalEncoding; } $encoding = self::getEncoding($encoding); - if ('UTF-8' === $encoding || \false !== @\iconv($encoding, $encoding, ' ')) { + if ('UTF-8' === $encoding || false !== @iconv($encoding, $encoding, ' ')) { self::$internalEncoding = $encoding; - return \true; + return true; } - return \false; + return false; } public static function mb_language($lang = null) { if (null === $lang) { return self::$language; } - switch ($lang = \strtolower($lang)) { + switch ($lang = strtolower($lang)) { case 'uni': case 'neutral': self::$language = $lang; - return \true; + return true; } - return \false; + return false; } public static function mb_list_encodings() { @@ -319,68 +375,68 @@ public static function mb_list_encodings() } public static function mb_encoding_aliases($encoding) { - switch (\strtoupper($encoding)) { + switch (strtoupper($encoding)) { case 'UTF8': case 'UTF-8': return array('utf8'); } - return \false; + return false; } public static function mb_check_encoding($var = null, $encoding = null) { if (null === $encoding) { if (null === $var) { - return \false; + return false; } $encoding = self::$internalEncoding; } - return self::mb_detect_encoding($var, array($encoding)) || \false !== @\iconv($encoding, $encoding, $var); + return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var); } - public static function mb_detect_encoding($str, $encodingList = null, $strict = \false) + public static function mb_detect_encoding($str, $encodingList = null, $strict = false) { if (null === $encodingList) { $encodingList = self::$encodingList; } else { - if (!\is_array($encodingList)) { - $encodingList = \array_map('trim', \explode(',', $encodingList)); + if (!is_array($encodingList)) { + $encodingList = array_map('trim', explode(',', $encodingList)); } - $encodingList = \array_map('strtoupper', $encodingList); + $encodingList = array_map('strtoupper', $encodingList); } foreach ($encodingList as $enc) { switch ($enc) { case 'ASCII': - if (!\preg_match('/[\\x80-\\xFF]/', $str)) { + if (!preg_match('/[\\x80-\\xFF]/', $str)) { return $enc; } break; case 'UTF8': case 'UTF-8': - if (\preg_match('//u', $str)) { + if (preg_match('//u', $str)) { return 'UTF-8'; } break; default: - if (0 === \strncmp($enc, 'ISO-8859-', 9)) { + if (0 === strncmp($enc, 'ISO-8859-', 9)) { return $enc; } } } - return \false; + return false; } public static function mb_detect_order($encodingList = null) { if (null === $encodingList) { return self::$encodingList; } - if (!\is_array($encodingList)) { - $encodingList = \array_map('trim', \explode(',', $encodingList)); + if (!is_array($encodingList)) { + $encodingList = array_map('trim', explode(',', $encodingList)); } - $encodingList = \array_map('strtoupper', $encodingList); + $encodingList = array_map('strtoupper', $encodingList); foreach ($encodingList as $enc) { switch ($enc) { default: - if (\strncmp($enc, 'ISO-8859-', 9)) { - return \false; + if (strncmp($enc, 'ISO-8859-', 9)) { + return false; } // no break case 'ASCII': @@ -389,34 +445,34 @@ public static function mb_detect_order($encodingList = null) } } self::$encodingList = $encodingList; - return \true; + return true; } public static function mb_strlen($s, $encoding = null) { $encoding = self::getEncoding($encoding); if ('CP850' === $encoding || 'ASCII' === $encoding) { - return \strlen($s); + return strlen($s); } - return @\iconv_strlen($s, $encoding); + return @iconv_strlen($s, $encoding); } public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) { $encoding = self::getEncoding($encoding); if ('CP850' === $encoding || 'ASCII' === $encoding) { - return \strpos($haystack, $needle, $offset); + return strpos($haystack, $needle, $offset); } $needle = (string) $needle; if ('' === $needle) { - \trigger_error(__METHOD__ . ': Empty delimiter', \E_USER_WARNING); - return \false; + trigger_error(__METHOD__ . ': Empty delimiter', E_USER_WARNING); + return false; } - return \iconv_strpos($haystack, $needle, $offset, $encoding); + return iconv_strpos($haystack, $needle, $offset, $encoding); } public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) { $encoding = self::getEncoding($encoding); if ('CP850' === $encoding || 'ASCII' === $encoding) { - return \strrpos($haystack, $needle, $offset); + return strrpos($haystack, $needle, $offset); } if ($offset != (int) $offset) { $offset = 0; @@ -430,21 +486,21 @@ public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = n $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding); } } - $pos = \iconv_strrpos($haystack, $needle, $encoding); - return \false !== $pos ? $offset + $pos : \false; + $pos = iconv_strrpos($haystack, $needle, $encoding); + return false !== $pos ? $offset + $pos : false; } public static function mb_str_split($string, $split_length = 1, $encoding = null) { - if (null !== $string && !\is_scalar($string) && !(\is_object($string) && \method_exists($string, '__toString'))) { - \trigger_error('mb_str_split() expects parameter 1 to be string, ' . \gettype($string) . ' given', \E_USER_WARNING); + if (null !== $string && !is_scalar($string) && !(is_object($string) && method_exists($string, '__toString'))) { + trigger_error('mb_str_split() expects parameter 1 to be string, ' . gettype($string) . ' given', E_USER_WARNING); return null; } if (1 > ($split_length = (int) $split_length)) { - \trigger_error('The length of each segment must be greater than zero', \E_USER_WARNING); - return \false; + trigger_error('The length of each segment must be greater than zero', E_USER_WARNING); + return false; } if (null === $encoding) { - $encoding = \mb_internal_encoding(); + $encoding = mb_internal_encoding(); } if ('UTF-8' === ($encoding = self::getEncoding($encoding))) { $rx = '/('; @@ -453,38 +509,38 @@ public static function mb_str_split($string, $split_length = 1, $encoding = null $split_length -= 65535; } $rx .= '.{' . $split_length . '})/us'; - return \preg_split($rx, $string, null, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY); + return preg_split($rx, $string, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); } $result = array(); - $length = \mb_strlen($string, $encoding); + $length = mb_strlen($string, $encoding); for ($i = 0; $i < $length; $i += $split_length) { - $result[] = \mb_substr($string, $i, $split_length, $encoding); + $result[] = mb_substr($string, $i, $split_length, $encoding); } return $result; } public static function mb_strtolower($s, $encoding = null) { - return self::mb_convert_case($s, \MB_CASE_LOWER, $encoding); + return self::mb_convert_case($s, MB_CASE_LOWER, $encoding); } public static function mb_strtoupper($s, $encoding = null) { - return self::mb_convert_case($s, \MB_CASE_UPPER, $encoding); + return self::mb_convert_case($s, MB_CASE_UPPER, $encoding); } public static function mb_substitute_character($c = null) { - if (0 === \strcasecmp($c, 'none')) { - return \true; + if (0 === strcasecmp($c, 'none')) { + return true; } - return null !== $c ? \false : 'none'; + return null !== $c ? false : 'none'; } public static function mb_substr($s, $start, $length = null, $encoding = null) { $encoding = self::getEncoding($encoding); if ('CP850' === $encoding || 'ASCII' === $encoding) { - return (string) \substr($s, $start, null === $length ? 2147483647 : $length); + return (string) substr($s, $start, null === $length ? 2147483647 : $length); } if ($start < 0) { - $start = \iconv_strlen($s, $encoding) + $start; + $start = iconv_strlen($s, $encoding) + $start; if ($start < 0) { $start = 0; } @@ -492,12 +548,12 @@ public static function mb_substr($s, $start, $length = null, $encoding = null) if (null === $length) { $length = 2147483647; } elseif ($length < 0) { - $length = \iconv_strlen($s, $encoding) + $length - $start; + $length = iconv_strlen($s, $encoding) + $length - $start; if ($length < 0) { return ''; } } - return (string) \iconv_substr($s, $start, $length, $encoding); + return (string) iconv_substr($s, $start, $length, $encoding); } public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) { @@ -505,22 +561,22 @@ public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = n $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding); return self::mb_strpos($haystack, $needle, $offset, $encoding); } - public static function mb_stristr($haystack, $needle, $part = \false, $encoding = null) + public static function mb_stristr($haystack, $needle, $part = false, $encoding = null) { $pos = self::mb_stripos($haystack, $needle, 0, $encoding); return self::getSubpart($pos, $part, $haystack, $encoding); } - public static function mb_strrchr($haystack, $needle, $part = \false, $encoding = null) + public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null) { $encoding = self::getEncoding($encoding); if ('CP850' === $encoding || 'ASCII' === $encoding) { - return \strrchr($haystack, $needle, $part); + return strrchr($haystack, $needle, $part); } $needle = self::mb_substr($needle, 0, 1, $encoding); - $pos = \iconv_strrpos($haystack, $needle, $encoding); + $pos = iconv_strrpos($haystack, $needle, $encoding); return self::getSubpart($pos, $part, $haystack, $encoding); } - public static function mb_strrichr($haystack, $needle, $part = \false, $encoding = null) + public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null) { $needle = self::mb_substr($needle, 0, 1, $encoding); $pos = self::mb_strripos($haystack, $needle, $encoding); @@ -532,16 +588,16 @@ public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding); return self::mb_strrpos($haystack, $needle, $offset, $encoding); } - public static function mb_strstr($haystack, $needle, $part = \false, $encoding = null) + public static function mb_strstr($haystack, $needle, $part = false, $encoding = null) { - $pos = \strpos($haystack, $needle); - if (\false === $pos) { - return \false; + $pos = strpos($haystack, $needle); + if (false === $pos) { + return false; } if ($part) { - return \substr($haystack, 0, $pos); + return substr($haystack, 0, $pos); } - return \substr($haystack, $pos); + return substr($haystack, $pos); } public static function mb_get_info($type = 'all') { @@ -552,11 +608,11 @@ public static function mb_get_info($type = 'all') if (isset($info[$type])) { return $info[$type]; } - return \false; + return false; } public static function mb_http_input($type = '') { - return \false; + return false; } public static function mb_http_output($encoding = null) { @@ -566,14 +622,14 @@ public static function mb_strwidth($s, $encoding = null) { $encoding = self::getEncoding($encoding); if ('UTF-8' !== $encoding) { - $s = \iconv($encoding, 'UTF-8//IGNORE', $s); + $s = iconv($encoding, 'UTF-8//IGNORE', $s); } - $s = \preg_replace('/[\\x{1100}-\\x{115F}\\x{2329}\\x{232A}\\x{2E80}-\\x{303E}\\x{3040}-\\x{A4CF}\\x{AC00}-\\x{D7A3}\\x{F900}-\\x{FAFF}\\x{FE10}-\\x{FE19}\\x{FE30}-\\x{FE6F}\\x{FF00}-\\x{FF60}\\x{FFE0}-\\x{FFE6}\\x{20000}-\\x{2FFFD}\\x{30000}-\\x{3FFFD}]/u', '', $s, -1, $wide); - return ($wide << 1) + \iconv_strlen($s, 'UTF-8'); + $s = preg_replace('/[\\x{1100}-\\x{115F}\\x{2329}\\x{232A}\\x{2E80}-\\x{303E}\\x{3040}-\\x{A4CF}\\x{AC00}-\\x{D7A3}\\x{F900}-\\x{FAFF}\\x{FE10}-\\x{FE19}\\x{FE30}-\\x{FE6F}\\x{FF00}-\\x{FF60}\\x{FFE0}-\\x{FFE6}\\x{20000}-\\x{2FFFD}\\x{30000}-\\x{3FFFD}]/u', '', $s, -1, $wide); + return ($wide << 1) + iconv_strlen($s, 'UTF-8'); } public static function mb_substr_count($haystack, $needle, $encoding = null) { - return \substr_count($haystack, $needle); + return substr_count($haystack, $needle); } public static function mb_output_handler($contents, $status) { @@ -582,28 +638,28 @@ public static function mb_output_handler($contents, $status) public static function mb_chr($code, $encoding = null) { if (0x80 > ($code %= 0x200000)) { - $s = \chr($code); + $s = chr($code); } elseif (0x800 > $code) { - $s = \chr(0xc0 | $code >> 6) . \chr(0x80 | $code & 0x3f); + $s = chr(0xc0 | $code >> 6) . chr(0x80 | $code & 0x3f); } elseif (0x10000 > $code) { - $s = \chr(0xe0 | $code >> 12) . \chr(0x80 | $code >> 6 & 0x3f) . \chr(0x80 | $code & 0x3f); + $s = chr(0xe0 | $code >> 12) . chr(0x80 | $code >> 6 & 0x3f) . chr(0x80 | $code & 0x3f); } else { - $s = \chr(0xf0 | $code >> 18) . \chr(0x80 | $code >> 12 & 0x3f) . \chr(0x80 | $code >> 6 & 0x3f) . \chr(0x80 | $code & 0x3f); + $s = chr(0xf0 | $code >> 18) . chr(0x80 | $code >> 12 & 0x3f) . chr(0x80 | $code >> 6 & 0x3f) . chr(0x80 | $code & 0x3f); } if ('UTF-8' !== ($encoding = self::getEncoding($encoding))) { - $s = \mb_convert_encoding($s, $encoding, 'UTF-8'); + $s = mb_convert_encoding($s, $encoding, 'UTF-8'); } return $s; } public static function mb_ord($s, $encoding = null) { if ('UTF-8' !== ($encoding = self::getEncoding($encoding))) { - $s = \mb_convert_encoding($s, 'UTF-8', $encoding); + $s = mb_convert_encoding($s, 'UTF-8', $encoding); } - if (1 === \strlen($s)) { - return \ord($s); + if (1 === strlen($s)) { + return ord($s); } - $code = ($s = \unpack('C*', \substr($s, 0, 4))) ? $s[1] : 0; + $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0; if (0xf0 <= $code) { return ($code - 0xf0 << 18) + ($s[2] - 0x80 << 12) + ($s[3] - 0x80 << 6) + $s[4] - 0x80; } @@ -617,8 +673,8 @@ public static function mb_ord($s, $encoding = null) } private static function getSubpart($pos, $part, $haystack, $encoding) { - if (\false === $pos) { - return \false; + if (false === $pos) { + return false; } if ($part) { return self::mb_substr($haystack, 0, $pos, $encoding); @@ -629,10 +685,10 @@ private static function html_encoding_callback(array $m) { $i = 1; $entities = ''; - $m = \unpack('C*', \htmlentities($m[0], \ENT_COMPAT, 'UTF-8')); + $m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8')); while (isset($m[$i])) { if (0x80 > $m[$i]) { - $entities .= \chr($m[$i++]); + $entities .= chr($m[$i++]); continue; } if (0xf0 <= $m[$i]) { @@ -648,14 +704,14 @@ private static function html_encoding_callback(array $m) } private static function title_case(array $s) { - return self::mb_convert_case($s[1], \MB_CASE_UPPER, 'UTF-8') . self::mb_convert_case($s[2], \MB_CASE_LOWER, 'UTF-8'); + return self::mb_convert_case($s[1], MB_CASE_UPPER, 'UTF-8') . self::mb_convert_case($s[2], MB_CASE_LOWER, 'UTF-8'); } private static function getData($file) { - if (\file_exists($file = __DIR__ . '/Resources/unidata/' . $file . '.php')) { + if (file_exists($file = __DIR__ . '/Resources/unidata/' . $file . '.php')) { return require $file; } - return \false; + return false; } private static function getEncoding($encoding) { @@ -665,7 +721,7 @@ private static function getEncoding($encoding) if ('UTF-8' === $encoding) { return 'UTF-8'; } - $encoding = \strtoupper($encoding); + $encoding = strtoupper($encoding); if ('8BIT' === $encoding || 'BINARY' === $encoding) { return 'CP850'; } diff --git a/vendor/symfony/polyfill-mbstring/Resources/index.php b/vendor/symfony/polyfill-mbstring/Resources/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/polyfill-mbstring/Resources/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/polyfill-mbstring/Resources/unidata/index.php b/vendor/symfony/polyfill-mbstring/Resources/unidata/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/polyfill-mbstring/Resources/unidata/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/polyfill-mbstring/bootstrap.php b/vendor/symfony/polyfill-mbstring/bootstrap.php index f2462fc52..c40523898 100644 --- a/vendor/symfony/polyfill-mbstring/bootstrap.php +++ b/vendor/symfony/polyfill-mbstring/bootstrap.php @@ -11,157 +11,163 @@ * file that was distributed with this source code. */ use _PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring as p; -if (!\defined('MB_CASE_UPPER')) { - \define('MB_CASE_UPPER', 0); - \define('MB_CASE_LOWER', 1); - \define('MB_CASE_TITLE', 2); +use _PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring; +use function define; +use function defined; +use function function_exists; +use function parse_str; + +if (!defined('MB_CASE_UPPER')) { + define('MB_CASE_UPPER', 0); + define('MB_CASE_LOWER', 1); + define('MB_CASE_TITLE', 2); } -if (!\function_exists('mb_strlen')) { +if (!function_exists('mb_strlen')) { function mb_convert_encoding($s, $to, $from = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_convert_encoding($s, $to, $from); + return Mbstring::mb_convert_encoding($s, $to, $from); } function mb_decode_mimeheader($s) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_decode_mimeheader($s); + return Mbstring::mb_decode_mimeheader($s); } function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); + return Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); } function mb_decode_numericentity($s, $convmap, $enc = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_decode_numericentity($s, $convmap, $enc); + return Mbstring::mb_decode_numericentity($s, $convmap, $enc); } - function mb_encode_numericentity($s, $convmap, $enc = null, $is_hex = \false) + function mb_encode_numericentity($s, $convmap, $enc = null, $is_hex = false) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_encode_numericentity($s, $convmap, $enc, $is_hex); + return Mbstring::mb_encode_numericentity($s, $convmap, $enc, $is_hex); } function mb_convert_case($s, $mode, $enc = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_convert_case($s, $mode, $enc); + return Mbstring::mb_convert_case($s, $mode, $enc); } function mb_internal_encoding($enc = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_internal_encoding($enc); + return Mbstring::mb_internal_encoding($enc); } function mb_language($lang = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_language($lang); + return Mbstring::mb_language($lang); } function mb_list_encodings() { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_list_encodings(); + return Mbstring::mb_list_encodings(); } function mb_encoding_aliases($encoding) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_encoding_aliases($encoding); + return Mbstring::mb_encoding_aliases($encoding); } function mb_check_encoding($var = null, $encoding = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_check_encoding($var, $encoding); + return Mbstring::mb_check_encoding($var, $encoding); } - function mb_detect_encoding($str, $encodingList = null, $strict = \false) + function mb_detect_encoding($str, $encodingList = null, $strict = false) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_detect_encoding($str, $encodingList, $strict); + return Mbstring::mb_detect_encoding($str, $encodingList, $strict); } function mb_detect_order($encodingList = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_detect_order($encodingList); + return Mbstring::mb_detect_order($encodingList); } function mb_parse_str($s, &$result = array()) { - \parse_str($s, $result); + parse_str($s, $result); } function mb_strlen($s, $enc = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_strlen($s, $enc); + return Mbstring::mb_strlen($s, $enc); } function mb_strpos($s, $needle, $offset = 0, $enc = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_strpos($s, $needle, $offset, $enc); + return Mbstring::mb_strpos($s, $needle, $offset, $enc); } function mb_strtolower($s, $enc = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_strtolower($s, $enc); + return Mbstring::mb_strtolower($s, $enc); } function mb_strtoupper($s, $enc = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_strtoupper($s, $enc); + return Mbstring::mb_strtoupper($s, $enc); } function mb_substitute_character($char = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_substitute_character($char); + return Mbstring::mb_substitute_character($char); } function mb_substr($s, $start, $length = 2147483647, $enc = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_substr($s, $start, $length, $enc); + return Mbstring::mb_substr($s, $start, $length, $enc); } function mb_stripos($s, $needle, $offset = 0, $enc = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_stripos($s, $needle, $offset, $enc); + return Mbstring::mb_stripos($s, $needle, $offset, $enc); } - function mb_stristr($s, $needle, $part = \false, $enc = null) + function mb_stristr($s, $needle, $part = false, $enc = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_stristr($s, $needle, $part, $enc); + return Mbstring::mb_stristr($s, $needle, $part, $enc); } - function mb_strrchr($s, $needle, $part = \false, $enc = null) + function mb_strrchr($s, $needle, $part = false, $enc = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_strrchr($s, $needle, $part, $enc); + return Mbstring::mb_strrchr($s, $needle, $part, $enc); } - function mb_strrichr($s, $needle, $part = \false, $enc = null) + function mb_strrichr($s, $needle, $part = false, $enc = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_strrichr($s, $needle, $part, $enc); + return Mbstring::mb_strrichr($s, $needle, $part, $enc); } function mb_strripos($s, $needle, $offset = 0, $enc = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_strripos($s, $needle, $offset, $enc); + return Mbstring::mb_strripos($s, $needle, $offset, $enc); } function mb_strrpos($s, $needle, $offset = 0, $enc = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_strrpos($s, $needle, $offset, $enc); + return Mbstring::mb_strrpos($s, $needle, $offset, $enc); } - function mb_strstr($s, $needle, $part = \false, $enc = null) + function mb_strstr($s, $needle, $part = false, $enc = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_strstr($s, $needle, $part, $enc); + return Mbstring::mb_strstr($s, $needle, $part, $enc); } function mb_get_info($type = 'all') { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_get_info($type); + return Mbstring::mb_get_info($type); } function mb_http_output($enc = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_http_output($enc); + return Mbstring::mb_http_output($enc); } function mb_strwidth($s, $enc = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_strwidth($s, $enc); + return Mbstring::mb_strwidth($s, $enc); } function mb_substr_count($haystack, $needle, $enc = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_substr_count($haystack, $needle, $enc); + return Mbstring::mb_substr_count($haystack, $needle, $enc); } function mb_output_handler($contents, $status) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_output_handler($contents, $status); + return Mbstring::mb_output_handler($contents, $status); } function mb_http_input($type = '') { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_http_input($type); + return Mbstring::mb_http_input($type); } function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f); + return Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f); } } -if (!\function_exists('_PhpScoper5ea00cc67502b\\mb_chr')) { +if (!function_exists('_PhpScoper5ea00cc67502b\\mb_chr')) { function mb_ord($s, $enc = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_ord($s, $enc); + return Mbstring::mb_ord($s, $enc); } function mb_chr($code, $enc = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_chr($code, $enc); + return Mbstring::mb_chr($code, $enc); } function mb_scrub($s, $enc = null) { @@ -169,9 +175,9 @@ function mb_scrub($s, $enc = null) return \mb_convert_encoding($s, $enc, $enc); } } -if (!\function_exists('_PhpScoper5ea00cc67502b\\mb_str_split')) { +if (!function_exists('_PhpScoper5ea00cc67502b\\mb_str_split')) { function mb_str_split($string, $split_length = 1, $encoding = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Mbstring\Mbstring::mb_str_split($string, $split_length, $encoding); + return Mbstring::mb_str_split($string, $split_length, $encoding); } } diff --git a/vendor/symfony/polyfill-mbstring/index.php b/vendor/symfony/polyfill-mbstring/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/polyfill-mbstring/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/polyfill-php70/Php70.php b/vendor/symfony/polyfill-php70/Php70.php index abc2c140d..ba400617a 100644 --- a/vendor/symfony/polyfill-php70/Php70.php +++ b/vendor/symfony/polyfill-php70/Php70.php @@ -10,6 +10,19 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Polyfill\Php70; +use ArithmeticError; +use DivisionByZeroError; +use TypeError; +use function gettype; +use function is_int; +use function is_numeric; +use function preg_replace_callback; +use function restore_error_handler; +use function set_error_handler; +use function sprintf; +use function trigger_error; +use const PHP_INT_MAX; + /** * @author Nicolas Grekas * @@ -22,10 +35,10 @@ public static function intdiv($dividend, $divisor) $dividend = self::intArg($dividend, __FUNCTION__, 1); $divisor = self::intArg($divisor, __FUNCTION__, 2); if (0 === $divisor) { - throw new \DivisionByZeroError('Division by zero'); + throw new DivisionByZeroError('Division by zero'); } - if (-1 === $divisor && ~\PHP_INT_MAX === $dividend) { - throw new \ArithmeticError('Division of PHP_INT_MIN by -1 is not an integer'); + if (-1 === $divisor && ~PHP_INT_MAX === $dividend) { + throw new ArithmeticError('Division of PHP_INT_MIN by -1 is not an integer'); } return ($dividend - $dividend % $divisor) / $divisor; } @@ -37,7 +50,7 @@ public static function preg_replace_callback_array(array $patterns, $subject, $l return $result; } foreach ($patterns as $pattern => $callback) { - $result = \preg_replace_callback($pattern, $callback, $result, $limit, $c); + $result = preg_replace_callback($pattern, $callback, $result, $limit, $c); $count += $c; } return $result; @@ -47,20 +60,20 @@ public static function error_clear_last() static $handler; if (!$handler) { $handler = function () { - return \false; + return false; }; } - \set_error_handler($handler); - @\trigger_error(''); - \restore_error_handler(); + set_error_handler($handler); + @trigger_error(''); + restore_error_handler(); } private static function intArg($value, $caller, $pos) { - if (\is_int($value)) { + if (is_int($value)) { return $value; } - if (!\is_numeric($value) || \PHP_INT_MAX <= ($value += 0) || ~\PHP_INT_MAX >= $value) { - throw new \TypeError(\sprintf('%s() expects parameter %d to be integer, %s given', $caller, $pos, \gettype($value))); + if (!is_numeric($value) || PHP_INT_MAX <= ($value += 0) || ~PHP_INT_MAX >= $value) { + throw new TypeError(sprintf('%s() expects parameter %d to be integer, %s given', $caller, $pos, gettype($value))); } return (int) $value; } diff --git a/vendor/symfony/polyfill-php70/Resources/index.php b/vendor/symfony/polyfill-php70/Resources/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/polyfill-php70/Resources/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php b/vendor/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php index c0d3c34b6..80742f88e 100644 --- a/vendor/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php +++ b/vendor/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php @@ -2,7 +2,9 @@ namespace _PhpScoper5ea00cc67502b; +use function class_alias; + class ArithmeticError extends \Error { } -\class_alias('_PhpScoper5ea00cc67502b\\ArithmeticError', 'ArithmeticError', \false); +class_alias('_PhpScoper5ea00cc67502b\\ArithmeticError', 'ArithmeticError', false); diff --git a/vendor/symfony/polyfill-php70/Resources/stubs/AssertionError.php b/vendor/symfony/polyfill-php70/Resources/stubs/AssertionError.php index 22eed93fd..d1598b903 100644 --- a/vendor/symfony/polyfill-php70/Resources/stubs/AssertionError.php +++ b/vendor/symfony/polyfill-php70/Resources/stubs/AssertionError.php @@ -2,7 +2,9 @@ namespace _PhpScoper5ea00cc67502b; +use function class_alias; + class AssertionError extends \Error { } -\class_alias('_PhpScoper5ea00cc67502b\\AssertionError', 'AssertionError', \false); +class_alias('_PhpScoper5ea00cc67502b\\AssertionError', 'AssertionError', false); diff --git a/vendor/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php b/vendor/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php index 39190d01c..6d9b40a44 100644 --- a/vendor/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php +++ b/vendor/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php @@ -2,7 +2,9 @@ namespace _PhpScoper5ea00cc67502b; +use function class_alias; + class DivisionByZeroError extends \Error { } -\class_alias('_PhpScoper5ea00cc67502b\\DivisionByZeroError', 'DivisionByZeroError', \false); +class_alias('_PhpScoper5ea00cc67502b\\DivisionByZeroError', 'DivisionByZeroError', false); diff --git a/vendor/symfony/polyfill-php70/Resources/stubs/Error.php b/vendor/symfony/polyfill-php70/Resources/stubs/Error.php index f561b496a..54642ce1c 100644 --- a/vendor/symfony/polyfill-php70/Resources/stubs/Error.php +++ b/vendor/symfony/polyfill-php70/Resources/stubs/Error.php @@ -2,7 +2,10 @@ namespace _PhpScoper5ea00cc67502b; -class Error extends \Exception +use Exception; +use function class_alias; + +class Error extends Exception { } -\class_alias('_PhpScoper5ea00cc67502b\\Error', 'Error', \false); +class_alias('_PhpScoper5ea00cc67502b\\Error', 'Error', false); diff --git a/vendor/symfony/polyfill-php70/Resources/stubs/ParseError.php b/vendor/symfony/polyfill-php70/Resources/stubs/ParseError.php index d0d76e8cc..f592e221a 100644 --- a/vendor/symfony/polyfill-php70/Resources/stubs/ParseError.php +++ b/vendor/symfony/polyfill-php70/Resources/stubs/ParseError.php @@ -2,7 +2,9 @@ namespace _PhpScoper5ea00cc67502b; +use function class_alias; + class ParseError extends \Error { } -\class_alias('_PhpScoper5ea00cc67502b\\ParseError', 'ParseError', \false); +class_alias('_PhpScoper5ea00cc67502b\\ParseError', 'ParseError', false); diff --git a/vendor/symfony/polyfill-php70/Resources/stubs/SessionUpdateTimestampHandlerInterface.php b/vendor/symfony/polyfill-php70/Resources/stubs/SessionUpdateTimestampHandlerInterface.php index b1cf934d7..abd2ccba9 100644 --- a/vendor/symfony/polyfill-php70/Resources/stubs/SessionUpdateTimestampHandlerInterface.php +++ b/vendor/symfony/polyfill-php70/Resources/stubs/SessionUpdateTimestampHandlerInterface.php @@ -2,6 +2,8 @@ namespace _PhpScoper5ea00cc67502b; +use function class_alias; + interface SessionUpdateTimestampHandlerInterface { /** @@ -22,4 +24,4 @@ public function validateId($key); */ public function updateTimestamp($key, $val); } -\class_alias('_PhpScoper5ea00cc67502b\\SessionUpdateTimestampHandlerInterface', 'SessionUpdateTimestampHandlerInterface', \false); +class_alias('_PhpScoper5ea00cc67502b\\SessionUpdateTimestampHandlerInterface', 'SessionUpdateTimestampHandlerInterface', false); diff --git a/vendor/symfony/polyfill-php70/Resources/stubs/TypeError.php b/vendor/symfony/polyfill-php70/Resources/stubs/TypeError.php index 04ecc92e2..5914c79c5 100644 --- a/vendor/symfony/polyfill-php70/Resources/stubs/TypeError.php +++ b/vendor/symfony/polyfill-php70/Resources/stubs/TypeError.php @@ -2,7 +2,9 @@ namespace _PhpScoper5ea00cc67502b; +use function class_alias; + class TypeError extends \Error { } -\class_alias('_PhpScoper5ea00cc67502b\\TypeError', 'TypeError', \false); +class_alias('_PhpScoper5ea00cc67502b\\TypeError', 'TypeError', false); diff --git a/vendor/symfony/polyfill-php70/Resources/stubs/index.php b/vendor/symfony/polyfill-php70/Resources/stubs/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/polyfill-php70/Resources/stubs/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/polyfill-php70/bootstrap.php b/vendor/symfony/polyfill-php70/bootstrap.php index 764dbbb95..f330df5cc 100644 --- a/vendor/symfony/polyfill-php70/bootstrap.php +++ b/vendor/symfony/polyfill-php70/bootstrap.php @@ -11,26 +11,33 @@ * file that was distributed with this source code. */ use _PhpScoper5ea00cc67502b\Symfony\Polyfill\Php70 as p; -if (\PHP_VERSION_ID < 70000) { - if (!\defined('PHP_INT_MIN')) { - \define('PHP_INT_MIN', ~\PHP_INT_MAX); +use _PhpScoper5ea00cc67502b\Symfony\Polyfill\Php70\Php70; +use function define; +use function defined; +use function function_exists; +use const PHP_INT_MAX; +use const PHP_VERSION_ID; + +if (PHP_VERSION_ID < 70000) { + if (!defined('PHP_INT_MIN')) { + define('PHP_INT_MIN', ~PHP_INT_MAX); } - if (!\function_exists('intdiv')) { + if (!function_exists('intdiv')) { function intdiv($dividend, $divisor) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Php70\Php70::intdiv($dividend, $divisor); + return Php70::intdiv($dividend, $divisor); } } - if (!\function_exists('preg_replace_callback_array')) { + if (!function_exists('preg_replace_callback_array')) { function preg_replace_callback_array(array $patterns, $subject, $limit = -1, &$count = 0) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Php70\Php70::preg_replace_callback_array($patterns, $subject, $limit, $count); + return Php70::preg_replace_callback_array($patterns, $subject, $limit, $count); } } - if (!\function_exists('error_clear_last')) { + if (!function_exists('error_clear_last')) { function error_clear_last() { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Php70\Php70::error_clear_last(); + return Php70::error_clear_last(); } } } diff --git a/vendor/symfony/polyfill-php70/index.php b/vendor/symfony/polyfill-php70/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/polyfill-php70/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/polyfill-php72/Php72.php b/vendor/symfony/polyfill-php72/Php72.php index 0839d20ca..36d7b8af8 100644 --- a/vendor/symfony/polyfill-php72/Php72.php +++ b/vendor/symfony/polyfill-php72/Php72.php @@ -10,6 +10,35 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Polyfill\Php72; +use function array_map; +use function chr; +use function debug_backtrace; +use function debug_zval_dump; +use function fstat; +use function function_exists; +use function getenv; +use function gettype; +use function hexdec; +use function in_array; +use function is_resource; +use function mb_convert_encoding; +use function ob_get_clean; +use function ob_start; +use function ord; +use function posix_isatty; +use function spl_object_hash; +use function stream_get_meta_data; +use function strlen; +use function substr; +use function trigger_error; +use function unpack; +use const DEBUG_BACKTRACE_IGNORE_ARGS; +use const DIRECTORY_SEPARATOR; +use const E_USER_WARNING; +use const PHP_INT_SIZE; +use const PHP_OS; +use const PHP_VERSION_ID; + /** * @author Nicolas Grekas * @author Dariusz Rumiński @@ -22,39 +51,39 @@ final class Php72 public static function utf8_encode($s) { $s .= $s; - $len = \strlen($s); + $len = strlen($s); for ($i = $len >> 1, $j = 0; $i < $len; ++$i, ++$j) { - switch (\true) { - case $s[$i] < "": + switch (true) { + case $s[$i] < "�": $s[$j] = $s[$i]; break; - case $s[$i] < "": - $s[$j] = ""; + case $s[$i] < "�": + $s[$j] = "�"; $s[++$j] = $s[$i]; break; default: - $s[$j] = ""; - $s[++$j] = \chr(\ord($s[$i]) - 64); + $s[$j] = "�"; + $s[++$j] = chr(ord($s[$i]) - 64); break; } } - return \substr($s, 0, $j); + return substr($s, 0, $j); } public static function utf8_decode($s) { $s = (string) $s; - $len = \strlen($s); + $len = strlen($s); for ($i = 0, $j = 0; $i < $len; ++$i, ++$j) { - switch ($s[$i] & "") { - case "": - case "": - $c = \ord($s[$i] & "\37") << 6 | \ord($s[++$i] & "?"); - $s[$j] = $c < 256 ? \chr($c) : '?'; + switch ($s[$i] & "�") { + case "�": + case "�": + $c = ord($s[$i] & "\37") << 6 | ord($s[++$i] & "?"); + $s[$j] = $c < 256 ? chr($c) : '?'; break; - case "": + case "�": ++$i; // no break - case "": + case "�": $s[$j] = '?'; $i += 2; break; @@ -62,58 +91,58 @@ public static function utf8_decode($s) $s[$j] = $s[$i]; } } - return \substr($s, 0, $j); + return substr($s, 0, $j); } public static function php_os_family() { - if ('\\' === \DIRECTORY_SEPARATOR) { + if ('\\' === DIRECTORY_SEPARATOR) { return 'Windows'; } $map = array('Darwin' => 'Darwin', 'DragonFly' => 'BSD', 'FreeBSD' => 'BSD', 'NetBSD' => 'BSD', 'OpenBSD' => 'BSD', 'Linux' => 'Linux', 'SunOS' => 'Solaris'); - return isset($map[\PHP_OS]) ? $map[\PHP_OS] : 'Unknown'; + return isset($map[PHP_OS]) ? $map[PHP_OS] : 'Unknown'; } public static function spl_object_id($object) { if (null === self::$hashMask) { self::initHashMask(); } - if (null === ($hash = \spl_object_hash($object))) { + if (null === ($hash = spl_object_hash($object))) { return; } - return self::$hashMask ^ \hexdec(\substr($hash, 16 - \PHP_INT_SIZE, \PHP_INT_SIZE)); + return self::$hashMask ^ hexdec(substr($hash, 16 - PHP_INT_SIZE, PHP_INT_SIZE)); } public static function sapi_windows_vt100_support($stream, $enable = null) { - if (!\is_resource($stream)) { - \trigger_error('sapi_windows_vt100_support() expects parameter 1 to be resource, ' . \gettype($stream) . ' given', \E_USER_WARNING); - return \false; + if (!is_resource($stream)) { + trigger_error('sapi_windows_vt100_support() expects parameter 1 to be resource, ' . gettype($stream) . ' given', E_USER_WARNING); + return false; } - $meta = \stream_get_meta_data($stream); + $meta = stream_get_meta_data($stream); if ('STDIO' !== $meta['stream_type']) { - \trigger_error('sapi_windows_vt100_support() was not able to analyze the specified stream', \E_USER_WARNING); - return \false; + trigger_error('sapi_windows_vt100_support() was not able to analyze the specified stream', E_USER_WARNING); + return false; } // We cannot actually disable vt100 support if it is set - if (\false === $enable || !self::stream_isatty($stream)) { - return \false; + if (false === $enable || !self::stream_isatty($stream)) { + return false; } // The native function does not apply to stdin - $meta = \array_map('strtolower', $meta); + $meta = array_map('strtolower', $meta); $stdin = 'php://stdin' === $meta['uri'] || 'php://fd/0' === $meta['uri']; - return !$stdin && (\false !== \getenv('ANSICON') || 'ON' === \getenv('ConEmuANSI') || 'xterm' === \getenv('TERM') || 'Hyper' === \getenv('TERM_PROGRAM')); + return !$stdin && (false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM') || 'Hyper' === getenv('TERM_PROGRAM')); } public static function stream_isatty($stream) { - if (!\is_resource($stream)) { - \trigger_error('stream_isatty() expects parameter 1 to be resource, ' . \gettype($stream) . ' given', \E_USER_WARNING); - return \false; + if (!is_resource($stream)) { + trigger_error('stream_isatty() expects parameter 1 to be resource, ' . gettype($stream) . ' given', E_USER_WARNING); + return false; } - if ('\\' === \DIRECTORY_SEPARATOR) { - $stat = @\fstat($stream); + if ('\\' === DIRECTORY_SEPARATOR) { + $stat = @fstat($stream); // Check if formatted mode is S_IFCHR - return $stat ? 020000 === ($stat['mode'] & 0170000) : \false; + return $stat ? 020000 === ($stat['mode'] & 0170000) : false; } - return \function_exists('posix_isatty') && @\posix_isatty($stream); + return function_exists('posix_isatty') && @posix_isatty($stream); } private static function initHashMask() { @@ -121,46 +150,46 @@ private static function initHashMask() self::$hashMask = -1; // check if we are nested in an output buffering handler to prevent a fatal error with ob_start() below $obFuncs = array('ob_clean', 'ob_end_clean', 'ob_flush', 'ob_end_flush', 'ob_get_contents', 'ob_get_flush'); - foreach (\debug_backtrace(\PHP_VERSION_ID >= 50400 ? \DEBUG_BACKTRACE_IGNORE_ARGS : \false) as $frame) { - if (isset($frame['function'][0]) && !isset($frame['class']) && 'o' === $frame['function'][0] && \in_array($frame['function'], $obFuncs)) { + foreach (debug_backtrace(PHP_VERSION_ID >= 50400 ? DEBUG_BACKTRACE_IGNORE_ARGS : false) as $frame) { + if (isset($frame['function'][0]) && !isset($frame['class']) && 'o' === $frame['function'][0] && in_array($frame['function'], $obFuncs)) { $frame['line'] = 0; break; } } if (!empty($frame['line'])) { - \ob_start(); - \debug_zval_dump($obj); - self::$hashMask = (int) \substr(\ob_get_clean(), 17); + ob_start(); + debug_zval_dump($obj); + self::$hashMask = (int) substr(ob_get_clean(), 17); } - self::$hashMask ^= \hexdec(\substr(\spl_object_hash($obj), 16 - \PHP_INT_SIZE, \PHP_INT_SIZE)); + self::$hashMask ^= hexdec(substr(spl_object_hash($obj), 16 - PHP_INT_SIZE, PHP_INT_SIZE)); } public static function mb_chr($code, $encoding = null) { if (0x80 > ($code %= 0x200000)) { - $s = \chr($code); + $s = chr($code); } elseif (0x800 > $code) { - $s = \chr(0xc0 | $code >> 6) . \chr(0x80 | $code & 0x3f); + $s = chr(0xc0 | $code >> 6) . chr(0x80 | $code & 0x3f); } elseif (0x10000 > $code) { - $s = \chr(0xe0 | $code >> 12) . \chr(0x80 | $code >> 6 & 0x3f) . \chr(0x80 | $code & 0x3f); + $s = chr(0xe0 | $code >> 12) . chr(0x80 | $code >> 6 & 0x3f) . chr(0x80 | $code & 0x3f); } else { - $s = \chr(0xf0 | $code >> 18) . \chr(0x80 | $code >> 12 & 0x3f) . \chr(0x80 | $code >> 6 & 0x3f) . \chr(0x80 | $code & 0x3f); + $s = chr(0xf0 | $code >> 18) . chr(0x80 | $code >> 12 & 0x3f) . chr(0x80 | $code >> 6 & 0x3f) . chr(0x80 | $code & 0x3f); } if ('UTF-8' !== $encoding) { - $s = \mb_convert_encoding($s, $encoding, 'UTF-8'); + $s = mb_convert_encoding($s, $encoding, 'UTF-8'); } return $s; } public static function mb_ord($s, $encoding = null) { if (null == $encoding) { - $s = \mb_convert_encoding($s, 'UTF-8'); + $s = mb_convert_encoding($s, 'UTF-8'); } elseif ('UTF-8' !== $encoding) { - $s = \mb_convert_encoding($s, 'UTF-8', $encoding); + $s = mb_convert_encoding($s, 'UTF-8', $encoding); } - if (1 === \strlen($s)) { - return \ord($s); + if (1 === strlen($s)) { + return ord($s); } - $code = ($s = \unpack('C*', \substr($s, 0, 4))) ? $s[1] : 0; + $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0; if (0xf0 <= $code) { return ($code - 0xf0 << 18) + ($s[2] - 0x80 << 12) + ($s[3] - 0x80 << 6) + $s[4] - 0x80; } diff --git a/vendor/symfony/polyfill-php72/bootstrap.php b/vendor/symfony/polyfill-php72/bootstrap.php index 54227492a..ef834e95f 100644 --- a/vendor/symfony/polyfill-php72/bootstrap.php +++ b/vendor/symfony/polyfill-php72/bootstrap.php @@ -11,46 +11,53 @@ * file that was distributed with this source code. */ use _PhpScoper5ea00cc67502b\Symfony\Polyfill\Php72 as p; -if (\PHP_VERSION_ID < 70200) { - if ('\\' === \DIRECTORY_SEPARATOR && !\function_exists('sapi_windows_vt100_support')) { +use _PhpScoper5ea00cc67502b\Symfony\Polyfill\Php72\Php72; +use function define; +use function defined; +use function function_exists; +use const DIRECTORY_SEPARATOR; +use const PHP_VERSION_ID; + +if (PHP_VERSION_ID < 70200) { + if ('\\' === DIRECTORY_SEPARATOR && !function_exists('sapi_windows_vt100_support')) { function sapi_windows_vt100_support($stream, $enable = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Php72\Php72::sapi_windows_vt100_support($stream, $enable); + return Php72::sapi_windows_vt100_support($stream, $enable); } } - if (!\function_exists('stream_isatty')) { + if (!function_exists('stream_isatty')) { function stream_isatty($stream) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Php72\Php72::stream_isatty($stream); + return Php72::stream_isatty($stream); } } - if (!\function_exists('utf8_encode')) { + if (!function_exists('utf8_encode')) { function utf8_encode($s) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Php72\Php72::utf8_encode($s); + return Php72::utf8_encode($s); } function utf8_decode($s) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Php72\Php72::utf8_decode($s); + return Php72::utf8_decode($s); } } - if (!\function_exists('spl_object_id')) { + if (!function_exists('spl_object_id')) { function spl_object_id($s) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Php72\Php72::spl_object_id($s); + return Php72::spl_object_id($s); } } - if (!\defined('PHP_OS_FAMILY')) { - \define('PHP_OS_FAMILY', \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Php72\Php72::php_os_family()); + if (!defined('PHP_OS_FAMILY')) { + define('PHP_OS_FAMILY', Php72::php_os_family()); } - if (!\function_exists('_PhpScoper5ea00cc67502b\\mb_chr')) { + if (!function_exists('_PhpScoper5ea00cc67502b\\mb_chr')) { function mb_ord($s, $enc = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Php72\Php72::mb_ord($s, $enc); + return Php72::mb_ord($s, $enc); } function mb_chr($code, $enc = null) { - return \_PhpScoper5ea00cc67502b\Symfony\Polyfill\Php72\Php72::mb_chr($code, $enc); + return Php72::mb_chr($code, $enc); } function mb_scrub($s, $enc = null) { diff --git a/vendor/symfony/polyfill-php72/index.php b/vendor/symfony/polyfill-php72/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/polyfill-php72/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/yaml/Command/LintCommand.php b/vendor/symfony/yaml/Command/LintCommand.php index 9c34ad2fa..9b9251cd4 100644 --- a/vendor/symfony/yaml/Command/LintCommand.php +++ b/vendor/symfony/yaml/Command/LintCommand.php @@ -20,13 +20,37 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException; use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser; use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml; +use FilesystemIterator; +use RecursiveDirectoryIterator; +use RecursiveIteratorIterator; +use SplFileInfo; +use function array_walk; +use function call_user_func; +use function count; +use function feof; +use function file_get_contents; +use function fread; +use function ftell; +use function in_array; +use function is_file; +use function is_readable; +use function json_encode; +use function min; +use function restore_error_handler; +use function set_error_handler; +use function sprintf; +use const E_USER_DEPRECATED; +use const JSON_PRETTY_PRINT; +use const JSON_UNESCAPED_SLASHES; +use const STDIN; + /** * Validates YAML files syntax and outputs encountered errors. * * @author Grégoire Pineau * @author Robin Chalas */ -class LintCommand extends \_PhpScoper5ea00cc67502b\Symfony\Component\Console\Command\Command +class LintCommand extends Command { protected static $defaultName = 'lint:yaml'; private $parser; @@ -45,7 +69,7 @@ public function __construct($name = null, $directoryIteratorProvider = null, $is */ protected function configure() { - $this->setDescription('Lints a file and outputs encountered errors')->addArgument('filename', null, 'A file or a directory or STDIN')->addOption('format', null, \_PhpScoper5ea00cc67502b\Symfony\Component\Console\Input\InputOption::VALUE_REQUIRED, 'The output format', 'txt')->addOption('parse-tags', null, \_PhpScoper5ea00cc67502b\Symfony\Component\Console\Input\InputOption::VALUE_NONE, 'Parse custom tags')->setHelp(<<setDescription('Lints a file and outputs encountered errors')->addArgument('filename', null, 'A file or a directory or STDIN')->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format', 'txt')->addOption('parse-tags', null, InputOption::VALUE_NONE, 'Parse custom tags')->setHelp(<<%command.name% command lints a YAML file and outputs to STDOUT the first encountered syntax error. @@ -65,46 +89,46 @@ protected function configure() EOF ); } - protected function execute(\_PhpScoper5ea00cc67502b\Symfony\Component\Console\Input\InputInterface $input, \_PhpScoper5ea00cc67502b\Symfony\Component\Console\Output\OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output) { - $io = new \_PhpScoper5ea00cc67502b\Symfony\Component\Console\Style\SymfonyStyle($input, $output); + $io = new SymfonyStyle($input, $output); $filename = $input->getArgument('filename'); $this->format = $input->getOption('format'); $this->displayCorrectFiles = $output->isVerbose(); - $flags = $input->getOption('parse-tags') ? \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_CUSTOM_TAGS : 0; + $flags = $input->getOption('parse-tags') ? Yaml::PARSE_CUSTOM_TAGS : 0; if (!$filename) { if (!($stdin = $this->getStdin())) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Console\Exception\RuntimeException('Please provide a filename or pipe file content to STDIN.'); + throw new RuntimeException('Please provide a filename or pipe file content to STDIN.'); } return $this->display($io, [$this->validate($stdin, $flags)]); } if (!$this->isReadable($filename)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Console\Exception\RuntimeException(\sprintf('File or directory "%s" is not readable.', $filename)); + throw new RuntimeException(sprintf('File or directory "%s" is not readable.', $filename)); } $filesInfo = []; foreach ($this->getFiles($filename) as $file) { - $filesInfo[] = $this->validate(\file_get_contents($file), $flags, $file); + $filesInfo[] = $this->validate(file_get_contents($file), $flags, $file); } return $this->display($io, $filesInfo); } private function validate($content, $flags, $file = null) { - $prevErrorHandler = \set_error_handler(function ($level, $message, $file, $line) use(&$prevErrorHandler) { - if (\E_USER_DEPRECATED === $level) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException($message, $this->getParser()->getRealCurrentLineNb() + 1); + $prevErrorHandler = set_error_handler(function ($level, $message, $file, $line) use(&$prevErrorHandler) { + if (E_USER_DEPRECATED === $level) { + throw new ParseException($message, $this->getParser()->getRealCurrentLineNb() + 1); } - return $prevErrorHandler ? $prevErrorHandler($level, $message, $file, $line) : \false; + return $prevErrorHandler ? $prevErrorHandler($level, $message, $file, $line) : false; }); try { - $this->getParser()->parse($content, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_CONSTANT | $flags); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException $e) { - return ['file' => $file, 'line' => $e->getParsedLine(), 'valid' => \false, 'message' => $e->getMessage()]; + $this->getParser()->parse($content, Yaml::PARSE_CONSTANT | $flags); + } catch (ParseException $e) { + return ['file' => $file, 'line' => $e->getParsedLine(), 'valid' => false, 'message' => $e->getMessage()]; } finally { - \restore_error_handler(); + restore_error_handler(); } - return ['file' => $file, 'valid' => \true]; + return ['file' => $file, 'valid' => true]; } - private function display(\_PhpScoper5ea00cc67502b\Symfony\Component\Console\Style\SymfonyStyle $io, array $files) + private function display(SymfonyStyle $io, array $files) { switch ($this->format) { case 'txt': @@ -112,49 +136,49 @@ private function display(\_PhpScoper5ea00cc67502b\Symfony\Component\Console\Styl case 'json': return $this->displayJson($io, $files); default: - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Console\Exception\InvalidArgumentException(\sprintf('The format "%s" is not supported.', $this->format)); + throw new InvalidArgumentException(sprintf('The format "%s" is not supported.', $this->format)); } } - private function displayTxt(\_PhpScoper5ea00cc67502b\Symfony\Component\Console\Style\SymfonyStyle $io, array $filesInfo) + private function displayTxt(SymfonyStyle $io, array $filesInfo) { - $countFiles = \count($filesInfo); + $countFiles = count($filesInfo); $erroredFiles = 0; foreach ($filesInfo as $info) { if ($info['valid'] && $this->displayCorrectFiles) { - $io->comment('OK' . ($info['file'] ? \sprintf(' in %s', $info['file']) : '')); + $io->comment('OK' . ($info['file'] ? sprintf(' in %s', $info['file']) : '')); } elseif (!$info['valid']) { ++$erroredFiles; - $io->text(' ERROR ' . ($info['file'] ? \sprintf(' in %s', $info['file']) : '')); - $io->text(\sprintf(' >> %s', $info['message'])); + $io->text(' ERROR ' . ($info['file'] ? sprintf(' in %s', $info['file']) : '')); + $io->text(sprintf(' >> %s', $info['message'])); } } if (0 === $erroredFiles) { - $io->success(\sprintf('All %d YAML files contain valid syntax.', $countFiles)); + $io->success(sprintf('All %d YAML files contain valid syntax.', $countFiles)); } else { - $io->warning(\sprintf('%d YAML files have valid syntax and %d contain errors.', $countFiles - $erroredFiles, $erroredFiles)); + $io->warning(sprintf('%d YAML files have valid syntax and %d contain errors.', $countFiles - $erroredFiles, $erroredFiles)); } - return \min($erroredFiles, 1); + return min($erroredFiles, 1); } - private function displayJson(\_PhpScoper5ea00cc67502b\Symfony\Component\Console\Style\SymfonyStyle $io, array $filesInfo) + private function displayJson(SymfonyStyle $io, array $filesInfo) { $errors = 0; - \array_walk($filesInfo, function (&$v) use(&$errors) { + array_walk($filesInfo, function (&$v) use(&$errors) { $v['file'] = (string) $v['file']; if (!$v['valid']) { ++$errors; } }); - $io->writeln(\json_encode($filesInfo, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES)); - return \min($errors, 1); + $io->writeln(json_encode($filesInfo, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + return min($errors, 1); } private function getFiles($fileOrDirectory) { - if (\is_file($fileOrDirectory)) { - (yield new \SplFileInfo($fileOrDirectory)); + if (is_file($fileOrDirectory)) { + (yield new SplFileInfo($fileOrDirectory)); return; } foreach ($this->getDirectoryIterator($fileOrDirectory) as $file) { - if (!\in_array($file->getExtension(), ['yml', 'yaml'])) { + if (!in_array($file->getExtension(), ['yml', 'yaml'])) { continue; } (yield $file); @@ -165,39 +189,39 @@ private function getFiles($fileOrDirectory) */ private function getStdin() { - if (0 !== \ftell(\STDIN)) { + if (0 !== ftell(STDIN)) { return null; } $inputs = ''; - while (!\feof(\STDIN)) { - $inputs .= \fread(\STDIN, 1024); + while (!feof(STDIN)) { + $inputs .= fread(STDIN, 1024); } return $inputs; } private function getParser() { if (!$this->parser) { - $this->parser = new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser(); + $this->parser = new Parser(); } return $this->parser; } private function getDirectoryIterator($directory) { $default = function ($directory) { - return new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($directory, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), \RecursiveIteratorIterator::LEAVES_ONLY); + return new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory, FilesystemIterator::SKIP_DOTS | FilesystemIterator::FOLLOW_SYMLINKS), RecursiveIteratorIterator::LEAVES_ONLY); }; if (null !== $this->directoryIteratorProvider) { - return \call_user_func($this->directoryIteratorProvider, $directory, $default); + return call_user_func($this->directoryIteratorProvider, $directory, $default); } return $default($directory); } private function isReadable($fileOrDirectory) { $default = function ($fileOrDirectory) { - return \is_readable($fileOrDirectory); + return is_readable($fileOrDirectory); }; if (null !== $this->isReadableProvider) { - return \call_user_func($this->isReadableProvider, $fileOrDirectory, $default); + return call_user_func($this->isReadableProvider, $fileOrDirectory, $default); } return $default($fileOrDirectory); } diff --git a/vendor/symfony/yaml/Command/index.php b/vendor/symfony/yaml/Command/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/yaml/Command/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/yaml/Dumper.php b/vendor/symfony/yaml/Dumper.php index b19940d1e..5cd4371ba 100644 --- a/vendor/symfony/yaml/Dumper.php +++ b/vendor/symfony/yaml/Dumper.php @@ -11,6 +11,23 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Yaml; use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue; +use ArrayObject; +use InvalidArgumentException; +use stdClass; +use function explode; +use function func_get_arg; +use function func_num_args; +use function is_array; +use function is_bool; +use function is_scalar; +use function is_string; +use function sprintf; +use function str_repeat; +use function strpos; +use function substr; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * Dumper dumps PHP variables to YAML strings. * @@ -32,7 +49,7 @@ class Dumper public function __construct($indentation = 4) { if ($indentation < 1) { - throw new \InvalidArgumentException('The indentation must be greater than zero.'); + throw new InvalidArgumentException('The indentation must be greater than zero.'); } $this->indentation = $indentation; } @@ -45,7 +62,7 @@ public function __construct($indentation = 4) */ public function setIndentation($num) { - @\trigger_error('The ' . __METHOD__ . ' method is deprecated since Symfony 3.1 and will be removed in 4.0. Pass the indentation to the constructor instead.', \E_USER_DEPRECATED); + @trigger_error('The ' . __METHOD__ . ' method is deprecated since Symfony 3.1 and will be removed in 4.0. Pass the indentation to the constructor instead.', E_USER_DEPRECATED); $this->indentation = (int) $num; } /** @@ -60,54 +77,54 @@ public function setIndentation($num) */ public function dump($input, $inline = 0, $indent = 0, $flags = 0) { - if (\is_bool($flags)) { - @\trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE flag instead.', \E_USER_DEPRECATED); + if (is_bool($flags)) { + @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED); if ($flags) { - $flags = \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE; + $flags = Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE; } else { $flags = 0; } } - if (\func_num_args() >= 5) { - @\trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::DUMP_OBJECT flag instead.', \E_USER_DEPRECATED); - if (\func_get_arg(4)) { - $flags |= \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_OBJECT; + if (func_num_args() >= 5) { + @trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::DUMP_OBJECT flag instead.', E_USER_DEPRECATED); + if (func_get_arg(4)) { + $flags |= Yaml::DUMP_OBJECT; } } $output = ''; - $prefix = $indent ? \str_repeat(' ', $indent) : ''; - $dumpObjectAsInlineMap = \true; - if (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_OBJECT_AS_MAP & $flags && ($input instanceof \ArrayObject || $input instanceof \stdClass)) { + $prefix = $indent ? str_repeat(' ', $indent) : ''; + $dumpObjectAsInlineMap = true; + if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($input instanceof ArrayObject || $input instanceof stdClass)) { $dumpObjectAsInlineMap = empty((array) $input); } - if ($inline <= 0 || !\is_array($input) && !$input instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue && $dumpObjectAsInlineMap || empty($input)) { - $output .= $prefix . \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::dump($input, $flags); + if ($inline <= 0 || !is_array($input) && !$input instanceof TaggedValue && $dumpObjectAsInlineMap || empty($input)) { + $output .= $prefix . Inline::dump($input, $flags); } else { - $dumpAsMap = \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::isHash($input); + $dumpAsMap = Inline::isHash($input); foreach ($input as $key => $value) { - if ($inline >= 1 && \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value) && \false !== \strpos($value, "\n") && \false === \strpos($value, "\r")) { + if ($inline >= 1 && Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && is_string($value) && false !== strpos($value, "\n") && false === strpos($value, "\r")) { // If the first line starts with a space character, the spec requires a blockIndicationIndicator // http://www.yaml.org/spec/1.2/spec.html#id2793979 - $blockIndentationIndicator = ' ' === \substr($value, 0, 1) ? (string) $this->indentation : ''; - $output .= \sprintf("%s%s%s |%s\n", $prefix, $dumpAsMap ? \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::dump($key, $flags) . ':' : '-', '', $blockIndentationIndicator); - foreach (\explode("\n", $value) as $row) { - $output .= \sprintf("%s%s%s\n", $prefix, \str_repeat(' ', $this->indentation), $row); + $blockIndentationIndicator = ' ' === substr($value, 0, 1) ? (string) $this->indentation : ''; + $output .= sprintf("%s%s%s |%s\n", $prefix, $dumpAsMap ? Inline::dump($key, $flags) . ':' : '-', '', $blockIndentationIndicator); + foreach (explode("\n", $value) as $row) { + $output .= sprintf("%s%s%s\n", $prefix, str_repeat(' ', $this->indentation), $row); } continue; } - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue) { - $output .= \sprintf('%s%s !%s', $prefix, $dumpAsMap ? \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::dump($key, $flags) . ':' : '-', $value->getTag()); - if ($inline >= 1 && \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value->getValue()) && \false !== \strpos($value->getValue(), "\n") && \false === \strpos($value->getValue(), "\r\n")) { + if ($value instanceof TaggedValue) { + $output .= sprintf('%s%s !%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags) . ':' : '-', $value->getTag()); + if ($inline >= 1 && Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && is_string($value->getValue()) && false !== strpos($value->getValue(), "\n") && false === strpos($value->getValue(), "\r\n")) { // If the first line starts with a space character, the spec requires a blockIndicationIndicator // http://www.yaml.org/spec/1.2/spec.html#id2793979 - $blockIndentationIndicator = ' ' === \substr($value->getValue(), 0, 1) ? (string) $this->indentation : ''; - $output .= \sprintf(" |%s\n", $blockIndentationIndicator); - foreach (\explode("\n", $value->getValue()) as $row) { - $output .= \sprintf("%s%s%s\n", $prefix, \str_repeat(' ', $this->indentation), $row); + $blockIndentationIndicator = ' ' === substr($value->getValue(), 0, 1) ? (string) $this->indentation : ''; + $output .= sprintf(" |%s\n", $blockIndentationIndicator); + foreach (explode("\n", $value->getValue()) as $row) { + $output .= sprintf("%s%s%s\n", $prefix, str_repeat(' ', $this->indentation), $row); } continue; } - if ($inline - 1 <= 0 || null === $value->getValue() || \is_scalar($value->getValue())) { + if ($inline - 1 <= 0 || null === $value->getValue() || is_scalar($value->getValue())) { $output .= ' ' . $this->dump($value->getValue(), $inline - 1, 0, $flags) . "\n"; } else { $output .= "\n"; @@ -115,12 +132,12 @@ public function dump($input, $inline = 0, $indent = 0, $flags = 0) } continue; } - $dumpObjectAsInlineMap = \true; - if (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_OBJECT_AS_MAP & $flags && ($value instanceof \ArrayObject || $value instanceof \stdClass)) { + $dumpObjectAsInlineMap = true; + if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($value instanceof ArrayObject || $value instanceof stdClass)) { $dumpObjectAsInlineMap = empty((array) $value); } - $willBeInlined = $inline - 1 <= 0 || !\is_array($value) && $dumpObjectAsInlineMap || empty($value); - $output .= \sprintf('%s%s%s%s', $prefix, $dumpAsMap ? \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::dump($key, $flags) . ':' : '-', $willBeInlined ? ' ' : "\n", $this->dump($value, $inline - 1, $willBeInlined ? 0 : $indent + $this->indentation, $flags)) . ($willBeInlined ? "\n" : ''); + $willBeInlined = $inline - 1 <= 0 || !is_array($value) && $dumpObjectAsInlineMap || empty($value); + $output .= sprintf('%s%s%s%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags) . ':' : '-', $willBeInlined ? ' ' : "\n", $this->dump($value, $inline - 1, $willBeInlined ? 0 : $indent + $this->indentation, $flags)) . ($willBeInlined ? "\n" : ''); } } return $output; diff --git a/vendor/symfony/yaml/Escaper.php b/vendor/symfony/yaml/Escaper.php index 72649c2bb..20fd6db39 100644 --- a/vendor/symfony/yaml/Escaper.php +++ b/vendor/symfony/yaml/Escaper.php @@ -10,6 +10,12 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Yaml; +use function in_array; +use function preg_match; +use function sprintf; +use function str_replace; +use function strtolower; + /** * Escaper encapsulates escaping rules for single and double-quoted * YAML strings. @@ -37,7 +43,7 @@ class Escaper */ public static function requiresDoubleQuoting($value) { - return 0 < \preg_match('/' . self::REGEX_CHARACTER_TO_ESCAPE . '/u', $value); + return 0 < preg_match('/' . self::REGEX_CHARACTER_TO_ESCAPE . '/u', $value); } /** * Escapes and surrounds a PHP value with double quotes. @@ -48,7 +54,7 @@ public static function requiresDoubleQuoting($value) */ public static function escapeWithDoubleQuotes($value) { - return \sprintf('"%s"', \str_replace(self::$escapees, self::$escaped, $value)); + return sprintf('"%s"', str_replace(self::$escapees, self::$escaped, $value)); } /** * Determines if a PHP value would require single quoting in YAML. @@ -61,12 +67,12 @@ public static function requiresSingleQuoting($value) { // Determines if a PHP value is entirely composed of a value that would // require single quoting in YAML. - if (\in_array(\strtolower($value), ['null', '~', 'true', 'false', 'y', 'n', 'yes', 'no', 'on', 'off'])) { - return \true; + if (in_array(strtolower($value), ['null', '~', 'true', 'false', 'y', 'n', 'yes', 'no', 'on', 'off'])) { + return true; } // Determines if the PHP value contains any single characters that would // cause it to require single quoting in YAML. - return 0 < \preg_match('/[ \\s \' " \\: \\{ \\} \\[ \\] , & \\* \\# \\?] | \\A[ \\- ? | < > = ! % @ ` ]/x', $value); + return 0 < preg_match('/[ \\s \' " \\: \\{ \\} \\[ \\] , & \\* \\# \\?] | \\A[ \\- ? | < > = ! % @ ` ]/x', $value); } /** * Escapes and surrounds a PHP value with single quotes. @@ -77,6 +83,6 @@ public static function requiresSingleQuoting($value) */ public static function escapeWithSingleQuotes($value) { - return \sprintf("'%s'", \str_replace('\'', '\'\'', $value)); + return sprintf("'%s'", str_replace('\'', '\'\'', $value)); } } diff --git a/vendor/symfony/yaml/Exception/DumpException.php b/vendor/symfony/yaml/Exception/DumpException.php index 602df6d67..ab4274473 100644 --- a/vendor/symfony/yaml/Exception/DumpException.php +++ b/vendor/symfony/yaml/Exception/DumpException.php @@ -15,6 +15,6 @@ * * @author Fabien Potencier */ -class DumpException extends \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\RuntimeException +class DumpException extends RuntimeException { } diff --git a/vendor/symfony/yaml/Exception/ParseException.php b/vendor/symfony/yaml/Exception/ParseException.php index d457fdd02..65eec946b 100644 --- a/vendor/symfony/yaml/Exception/ParseException.php +++ b/vendor/symfony/yaml/Exception/ParseException.php @@ -10,12 +10,19 @@ */ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception; +use Exception; +use function json_encode; +use function sprintf; +use function substr; +use const JSON_UNESCAPED_SLASHES; +use const JSON_UNESCAPED_UNICODE; + /** * Exception class thrown when an error occurs during parsing. * * @author Fabien Potencier */ -class ParseException extends \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\RuntimeException +class ParseException extends RuntimeException { private $parsedFile; private $parsedLine; @@ -26,9 +33,9 @@ class ParseException extends \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exc * @param int $parsedLine The line where the error occurred * @param string|null $snippet The snippet of code near the problem * @param string|null $parsedFile The file name where the error occurred - * @param \Exception|null $previous The previous exception + * @param Exception|null $previous The previous exception */ - public function __construct($message, $parsedLine = -1, $snippet = null, $parsedFile = null, \Exception $previous = null) + public function __construct($message, $parsedLine = -1, $snippet = null, $parsedFile = null, Exception $previous = null) { $this->parsedFile = $parsedFile; $this->parsedLine = $parsedLine; @@ -99,19 +106,19 @@ public function setParsedLine($parsedLine) private function updateRepr() { $this->message = $this->rawMessage; - $dot = \false; - if ('.' === \substr($this->message, -1)) { - $this->message = \substr($this->message, 0, -1); - $dot = \true; + $dot = false; + if ('.' === substr($this->message, -1)) { + $this->message = substr($this->message, 0, -1); + $dot = true; } if (null !== $this->parsedFile) { - $this->message .= \sprintf(' in %s', \json_encode($this->parsedFile, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE)); + $this->message .= sprintf(' in %s', json_encode($this->parsedFile, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)); } if ($this->parsedLine >= 0) { - $this->message .= \sprintf(' at line %d', $this->parsedLine); + $this->message .= sprintf(' at line %d', $this->parsedLine); } if ($this->snippet) { - $this->message .= \sprintf(' (near "%s")', $this->snippet); + $this->message .= sprintf(' (near "%s")', $this->snippet); } if ($dot) { $this->message .= '.'; diff --git a/vendor/symfony/yaml/Exception/RuntimeException.php b/vendor/symfony/yaml/Exception/RuntimeException.php index 1c91873eb..a618d170b 100644 --- a/vendor/symfony/yaml/Exception/RuntimeException.php +++ b/vendor/symfony/yaml/Exception/RuntimeException.php @@ -15,6 +15,6 @@ * * @author Romain Neutron */ -class RuntimeException extends \RuntimeException implements \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ExceptionInterface +class RuntimeException extends \RuntimeException implements ExceptionInterface { } diff --git a/vendor/symfony/yaml/Exception/index.php b/vendor/symfony/yaml/Exception/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/yaml/Exception/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/yaml/Inline.php b/vendor/symfony/yaml/Inline.php index d75af79bb..0a9a34938 100644 --- a/vendor/symfony/yaml/Inline.php +++ b/vendor/symfony/yaml/Inline.php @@ -13,6 +13,63 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\DumpException; use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException; use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue; +use ArrayObject; +use DateTime; +use DateTimeInterface; +use DateTimeZone; +use InvalidArgumentException; +use stdClass; +use function array_key_exists; +use function base64_decode; +use function base64_encode; +use function constant; +use function ctype_digit; +use function date_default_timezone_get; +use function date_default_timezone_set; +use function defined; +use function floor; +use function func_get_arg; +use function func_num_args; +use function get_resource_type; +use function hexdec; +use function implode; +use function in_array; +use function ini_get; +use function is_array; +use function is_bool; +use function is_float; +use function is_infinite; +use function is_int; +use function is_numeric; +use function is_object; +use function is_resource; +use function is_string; +use function log; +use function ltrim; +use function mb_internal_encoding; +use function octdec; +use function preg_match; +use function preg_replace; +use function rtrim; +use function serialize; +use function setlocale; +use function sprintf; +use function str_ireplace; +use function str_replace; +use function strcspn; +use function strlen; +use function strpos; +use function strspn; +use function strtolower; +use function strtotime; +use function substr; +use function trigger_error; +use function trim; +use function unserialize; +use const E_USER_DEPRECATED; +use const LC_NUMERIC; +use const PREG_OFFSET_CAPTURE; + /** * Inline implements a YAML parser/dumper for the YAML inline syntax. * @@ -25,10 +82,10 @@ class Inline const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*+(?:\\\\.[^"\\\\]*+)*+)"|\'([^\']*+(?:\'\'[^\']*+)*+)\')'; public static $parsedLineNumber = -1; public static $parsedFilename; - private static $exceptionOnInvalidType = \false; - private static $objectSupport = \false; - private static $objectForMap = \false; - private static $constantSupport = \false; + private static $exceptionOnInvalidType = false; + private static $objectSupport = false; + private static $objectForMap = false; + private static $constantSupport = false; /** * @param int $flags * @param int|null $parsedLineNumber @@ -36,10 +93,10 @@ class Inline */ public static function initialize($flags, $parsedLineNumber = null, $parsedFilename = null) { - self::$exceptionOnInvalidType = (bool) (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE & $flags); - self::$objectSupport = (bool) (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_OBJECT & $flags); - self::$objectForMap = (bool) (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_OBJECT_FOR_MAP & $flags); - self::$constantSupport = (bool) (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_CONSTANT & $flags); + self::$exceptionOnInvalidType = (bool) (Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE & $flags); + self::$objectSupport = (bool) (Yaml::PARSE_OBJECT & $flags); + self::$objectForMap = (bool) (Yaml::PARSE_OBJECT_FOR_MAP & $flags); + self::$constantSupport = (bool) (Yaml::PARSE_CONSTANT & $flags); self::$parsedFilename = $parsedFilename; if (null !== $parsedLineNumber) { self::$parsedLineNumber = $parsedLineNumber; @@ -58,39 +115,39 @@ public static function initialize($flags, $parsedLineNumber = null, $parsedFilen */ public static function parse($value, $flags = 0, $references = []) { - if (\is_bool($flags)) { - @\trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE flag instead.', \E_USER_DEPRECATED); + if (is_bool($flags)) { + @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED); if ($flags) { - $flags = \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE; + $flags = Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE; } else { $flags = 0; } } - if (\func_num_args() >= 3 && !\is_array($references)) { - @\trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT flag instead.', \E_USER_DEPRECATED); + if (func_num_args() >= 3 && !is_array($references)) { + @trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT flag instead.', E_USER_DEPRECATED); if ($references) { - $flags |= \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_OBJECT; + $flags |= Yaml::PARSE_OBJECT; } - if (\func_num_args() >= 4) { - @\trigger_error('Passing a boolean flag to toggle object for map support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT_FOR_MAP flag instead.', \E_USER_DEPRECATED); - if (\func_get_arg(3)) { - $flags |= \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_OBJECT_FOR_MAP; + if (func_num_args() >= 4) { + @trigger_error('Passing a boolean flag to toggle object for map support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT_FOR_MAP flag instead.', E_USER_DEPRECATED); + if (func_get_arg(3)) { + $flags |= Yaml::PARSE_OBJECT_FOR_MAP; } } - if (\func_num_args() >= 5) { - $references = \func_get_arg(4); + if (func_num_args() >= 5) { + $references = func_get_arg(4); } else { $references = []; } } self::initialize($flags); - $value = \trim($value); + $value = trim($value); if ('' === $value) { return ''; } - if (2 & (int) \ini_get('mbstring.func_overload')) { - $mbEncoding = \mb_internal_encoding(); - \mb_internal_encoding('ASCII'); + if (2 & (int) ini_get('mbstring.func_overload')) { + $mbEncoding = mb_internal_encoding(); + mb_internal_encoding('ASCII'); } try { $i = 0; @@ -108,16 +165,16 @@ public static function parse($value, $flags = 0, $references = []) $result = self::parseScalar($value, $flags, null, $i, null === $tag, $references); } // some comments are allowed at the end - if (\preg_replace('/\\s+#.*$/A', '', \substr($value, $i))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('Unexpected characters near "%s".', \substr($value, $i)), self::$parsedLineNumber + 1, $value, self::$parsedFilename); + if (preg_replace('/\\s+#.*$/A', '', substr($value, $i))) { + throw new ParseException(sprintf('Unexpected characters near "%s".', substr($value, $i)), self::$parsedLineNumber + 1, $value, self::$parsedFilename); } if (null !== $tag) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue($tag, $result); + return new TaggedValue($tag, $result); } return $result; } finally { if (isset($mbEncoding)) { - \mb_internal_encoding($mbEncoding); + mb_internal_encoding($mbEncoding); } } } @@ -133,83 +190,83 @@ public static function parse($value, $flags = 0, $references = []) */ public static function dump($value, $flags = 0) { - if (\is_bool($flags)) { - @\trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE flag instead.', \E_USER_DEPRECATED); + if (is_bool($flags)) { + @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED); if ($flags) { - $flags = \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE; + $flags = Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE; } else { $flags = 0; } } - if (\func_num_args() >= 3) { - @\trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::DUMP_OBJECT flag instead.', \E_USER_DEPRECATED); - if (\func_get_arg(2)) { - $flags |= \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_OBJECT; + if (func_num_args() >= 3) { + @trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::DUMP_OBJECT flag instead.', E_USER_DEPRECATED); + if (func_get_arg(2)) { + $flags |= Yaml::DUMP_OBJECT; } } - switch (\true) { - case \is_resource($value): - if (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE & $flags) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\DumpException(\sprintf('Unable to dump PHP resources in a YAML file ("%s").', \get_resource_type($value))); + switch (true) { + case is_resource($value): + if (Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE & $flags) { + throw new DumpException(sprintf('Unable to dump PHP resources in a YAML file ("%s").', get_resource_type($value))); } return 'null'; - case $value instanceof \DateTimeInterface: + case $value instanceof DateTimeInterface: return $value->format('c'); - case \is_object($value): - if ($value instanceof \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue) { + case is_object($value): + if ($value instanceof TaggedValue) { return '!' . $value->getTag() . ' ' . self::dump($value->getValue(), $flags); } - if (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_OBJECT & $flags) { - return '!php/object ' . self::dump(\serialize($value)); + if (Yaml::DUMP_OBJECT & $flags) { + return '!php/object ' . self::dump(serialize($value)); } - if (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_OBJECT_AS_MAP & $flags && ($value instanceof \stdClass || $value instanceof \ArrayObject)) { - return self::dumpArray($value, $flags & ~\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE); + if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($value instanceof stdClass || $value instanceof ArrayObject)) { + return self::dumpArray($value, $flags & ~Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE); } - if (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE & $flags) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\DumpException('Object support when dumping a YAML file has been disabled.'); + if (Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE & $flags) { + throw new DumpException('Object support when dumping a YAML file has been disabled.'); } return 'null'; - case \is_array($value): + case is_array($value): return self::dumpArray($value, $flags); case null === $value: return 'null'; - case \true === $value: + case true === $value: return 'true'; - case \false === $value: + case false === $value: return 'false'; - case \ctype_digit($value): - return \is_string($value) ? "'{$value}'" : (int) $value; - case \is_numeric($value): - $locale = \setlocale(\LC_NUMERIC, 0); - if (\false !== $locale) { - \setlocale(\LC_NUMERIC, 'C'); + case ctype_digit($value): + return is_string($value) ? "'{$value}'" : (int) $value; + case is_numeric($value): + $locale = setlocale(LC_NUMERIC, 0); + if (false !== $locale) { + setlocale(LC_NUMERIC, 'C'); } - if (\is_float($value)) { + if (is_float($value)) { $repr = (string) $value; - if (\is_infinite($value)) { - $repr = \str_ireplace('INF', '.Inf', $repr); - } elseif (\floor($value) == $value && $repr == $value) { + if (is_infinite($value)) { + $repr = str_ireplace('INF', '.Inf', $repr); + } elseif (floor($value) == $value && $repr == $value) { // Preserve float data type since storing a whole number will result in integer value. $repr = '!!float ' . $repr; } } else { - $repr = \is_string($value) ? "'{$value}'" : (string) $value; + $repr = is_string($value) ? "'{$value}'" : (string) $value; } - if (\false !== $locale) { - \setlocale(\LC_NUMERIC, $locale); + if (false !== $locale) { + setlocale(LC_NUMERIC, $locale); } return $repr; case '' == $value: return "''"; case self::isBinaryString($value): - return '!!binary ' . \base64_encode($value); - case \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Escaper::requiresDoubleQuoting($value): - return \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Escaper::escapeWithDoubleQuotes($value); - case \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Escaper::requiresSingleQuoting($value): - case \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser::preg_match('{^[0-9]+[_0-9]*$}', $value): - case \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser::preg_match(self::getHexRegex(), $value): - case \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser::preg_match(self::getTimestampRegex(), $value): - return \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Escaper::escapeWithSingleQuotes($value); + return '!!binary ' . base64_encode($value); + case Escaper::requiresDoubleQuoting($value): + return Escaper::escapeWithDoubleQuotes($value); + case Escaper::requiresSingleQuoting($value): + case Parser::preg_match('{^[0-9]+[_0-9]*$}', $value): + case Parser::preg_match(self::getHexRegex(), $value): + case Parser::preg_match(self::getTimestampRegex(), $value): + return Escaper::escapeWithSingleQuotes($value); default: return $value; } @@ -217,24 +274,24 @@ public static function dump($value, $flags = 0) /** * Check if given array is hash or just normal indexed array. * - * @internal - * - * @param array|\ArrayObject|\stdClass $value The PHP array or array-like object to check + * @param array|ArrayObject|stdClass $value The PHP array or array-like object to check * * @return bool true if value is hash array, false otherwise + *@internal + * */ public static function isHash($value) { - if ($value instanceof \stdClass || $value instanceof \ArrayObject) { - return \true; + if ($value instanceof stdClass || $value instanceof ArrayObject) { + return true; } $expectedKey = 0; foreach ($value as $key => $val) { if ($key !== $expectedKey++) { - return \true; + return true; } } - return \false; + return false; } /** * Dumps a PHP array to a YAML string. @@ -247,19 +304,19 @@ public static function isHash($value) private static function dumpArray($value, $flags) { // array - if (($value || \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE & $flags) && !self::isHash($value)) { + if (($value || Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE & $flags) && !self::isHash($value)) { $output = []; foreach ($value as $val) { $output[] = self::dump($val, $flags); } - return \sprintf('[%s]', \implode(', ', $output)); + return sprintf('[%s]', implode(', ', $output)); } // hash $output = []; foreach ($value as $key => $val) { - $output[] = \sprintf('%s: %s', self::dump($key, $flags), self::dump($val, $flags)); + $output[] = sprintf('%s: %s', self::dump($key, $flags), self::dump($val, $flags)); } - return \sprintf('{ %s }', \implode(', ', $output)); + return sprintf('{ %s }', implode(', ', $output)); } /** * Parses a YAML scalar. @@ -277,41 +334,41 @@ private static function dumpArray($value, $flags) * * @internal */ - public static function parseScalar($scalar, $flags = 0, $delimiters = null, &$i = 0, $evaluate = \true, $references = [], $legacyOmittedKeySupport = \false) + public static function parseScalar($scalar, $flags = 0, $delimiters = null, &$i = 0, $evaluate = true, $references = [], $legacyOmittedKeySupport = false) { - if (\in_array($scalar[$i], ['"', "'"])) { + if (in_array($scalar[$i], ['"', "'"])) { // quoted scalar $output = self::parseQuotedScalar($scalar, $i); if (null !== $delimiters) { - $tmp = \ltrim(\substr($scalar, $i), ' '); + $tmp = ltrim(substr($scalar, $i), ' '); if ('' === $tmp) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('Unexpected end of line, expected one of "%s".', \implode('', $delimiters)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + throw new ParseException(sprintf('Unexpected end of line, expected one of "%s".', implode('', $delimiters)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); } - if (!\in_array($tmp[0], $delimiters)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('Unexpected characters (%s).', \substr($scalar, $i)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + if (!in_array($tmp[0], $delimiters)) { + throw new ParseException(sprintf('Unexpected characters (%s).', substr($scalar, $i)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); } } } else { // "normal" string if (!$delimiters) { - $output = \substr($scalar, $i); - $i += \strlen($output); + $output = substr($scalar, $i); + $i += strlen($output); // remove comments - if (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser::preg_match('/[ \\t]+#/', $output, $match, \PREG_OFFSET_CAPTURE)) { - $output = \substr($output, 0, $match[0][1]); + if (Parser::preg_match('/[ \\t]+#/', $output, $match, PREG_OFFSET_CAPTURE)) { + $output = substr($output, 0, $match[0][1]); } - } elseif (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser::preg_match('/^(.' . ($legacyOmittedKeySupport ? '+' : '*') . '?)(' . \implode('|', $delimiters) . ')/', \substr($scalar, $i), $match)) { + } elseif (Parser::preg_match('/^(.' . ($legacyOmittedKeySupport ? '+' : '*') . '?)(' . implode('|', $delimiters) . ')/', substr($scalar, $i), $match)) { $output = $match[1]; - $i += \strlen($output); + $i += strlen($output); } else { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('Malformed inline YAML string: "%s".', $scalar), self::$parsedLineNumber + 1, null, self::$parsedFilename); + throw new ParseException(sprintf('Malformed inline YAML string: "%s".', $scalar), self::$parsedLineNumber + 1, null, self::$parsedFilename); } // a non-quoted string cannot start with @ or ` (reserved) nor with a scalar indicator (| or >) if ($output && ('@' === $output[0] || '`' === $output[0] || '|' === $output[0] || '>' === $output[0])) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('The reserved indicator "%s" cannot start a plain scalar; you need to quote the scalar.', $output[0]), self::$parsedLineNumber + 1, $output, self::$parsedFilename); + throw new ParseException(sprintf('The reserved indicator "%s" cannot start a plain scalar; you need to quote the scalar.', $output[0]), self::$parsedLineNumber + 1, $output, self::$parsedFilename); } if ($output && '%' === $output[0]) { - @\trigger_error(self::getDeprecationMessage(\sprintf('Not quoting the scalar "%s" starting with the "%%" indicator character is deprecated since Symfony 3.1 and will throw a ParseException in 4.0.', $output)), \E_USER_DEPRECATED); + @trigger_error(self::getDeprecationMessage(sprintf('Not quoting the scalar "%s" starting with the "%%" indicator character is deprecated since Symfony 3.1 and will throw a ParseException in 4.0.', $output)), E_USER_DEPRECATED); } if ($evaluate) { $output = self::evaluateScalar($output, $flags, $references); @@ -331,17 +388,17 @@ public static function parseScalar($scalar, $flags = 0, $delimiters = null, &$i */ private static function parseQuotedScalar($scalar, &$i) { - if (!\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser::preg_match('/' . self::REGEX_QUOTED_STRING . '/Au', \substr($scalar, $i), $match)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('Malformed inline YAML string: "%s".', \substr($scalar, $i)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + if (!Parser::preg_match('/' . self::REGEX_QUOTED_STRING . '/Au', substr($scalar, $i), $match)) { + throw new ParseException(sprintf('Malformed inline YAML string: "%s".', substr($scalar, $i)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); } - $output = \substr($match[0], 1, \strlen($match[0]) - 2); - $unescaper = new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Unescaper(); + $output = substr($match[0], 1, strlen($match[0]) - 2); + $unescaper = new Unescaper(); if ('"' == $scalar[$i]) { $output = $unescaper->unescapeDoubleQuotedString($output); } else { $output = $unescaper->unescapeSingleQuotedString($output); } - $i += \strlen($match[0]); + $i += strlen($match[0]); return $output; } /** @@ -359,7 +416,7 @@ private static function parseQuotedScalar($scalar, &$i) private static function parseSequence($sequence, $flags, &$i = 0, $references = []) { $output = []; - $len = \strlen($sequence); + $len = strlen($sequence); ++$i; // [foo, bar, ...] while ($i < $len) { @@ -381,27 +438,27 @@ private static function parseSequence($sequence, $flags, &$i = 0, $references = $value = self::parseMapping($sequence, $flags, $i, $references); break; default: - $isQuoted = \in_array($sequence[$i], ['"', "'"]); + $isQuoted = in_array($sequence[$i], ['"', "'"]); $value = self::parseScalar($sequence, $flags, [',', ']'], $i, null === $tag, $references); // the value can be an array if a reference has been resolved to an array var - if (\is_string($value) && !$isQuoted && \false !== \strpos($value, ': ')) { + if (is_string($value) && !$isQuoted && false !== strpos($value, ': ')) { // embedded mapping? try { $pos = 0; $value = self::parseMapping('{' . $value . '}', $flags, $pos, $references); - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { // no, it's not } } --$i; } if (null !== $tag) { - $value = new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue($tag, $value); + $value = new TaggedValue($tag, $value); } $output[] = $value; ++$i; } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('Malformed inline YAML string: "%s".', $sequence), self::$parsedLineNumber + 1, null, self::$parsedFilename); + throw new ParseException(sprintf('Malformed inline YAML string: "%s".', $sequence), self::$parsedLineNumber + 1, null, self::$parsedFilename); } /** * Parses a YAML mapping. @@ -411,16 +468,16 @@ private static function parseSequence($sequence, $flags, &$i = 0, $references = * @param int &$i * @param array $references * - * @return array|\stdClass + * @return array|stdClass * * @throws ParseException When malformed inline YAML string is parsed */ private static function parseMapping($mapping, $flags, &$i = 0, $references = []) { $output = []; - $len = \strlen($mapping); + $len = strlen($mapping); ++$i; - $allowOverwrite = \false; + $allowOverwrite = false; // {foo: bar, bar:foo, ...} while ($i < $len) { switch ($mapping[$i]) { @@ -435,10 +492,10 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = [] return $output; } // key - $isKeyQuoted = \in_array($mapping[$i], ['"', "'"], \true); - $key = self::parseScalar($mapping, $flags, [':', ' '], $i, \false, [], \true); + $isKeyQuoted = in_array($mapping[$i], ['"', "'"], true); + $key = self::parseScalar($mapping, $flags, [':', ' '], $i, false, [], true); if ('!php/const' === $key) { - $key .= self::parseScalar($mapping, $flags, [':', ' '], $i, \false, [], \true); + $key .= self::parseScalar($mapping, $flags, [':', ' '], $i, false, [], true); if ('!php/const:' === $key && ':' !== $mapping[$i]) { $key = ''; --$i; @@ -446,23 +503,23 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = [] $key = self::evaluateScalar($key, $flags); } } - if (':' !== $key && \false === ($i = \strpos($mapping, ':', $i))) { + if (':' !== $key && false === ($i = strpos($mapping, ':', $i))) { break; } if (':' === $key) { - @\trigger_error(self::getDeprecationMessage('Omitting the key of a mapping is deprecated and will throw a ParseException in 4.0.'), \E_USER_DEPRECATED); + @trigger_error(self::getDeprecationMessage('Omitting the key of a mapping is deprecated and will throw a ParseException in 4.0.'), E_USER_DEPRECATED); } if (!$isKeyQuoted) { $evaluatedKey = self::evaluateScalar($key, $flags, $references); - if ('' !== $key && $evaluatedKey !== $key && !\is_string($evaluatedKey) && !\is_int($evaluatedKey)) { - @\trigger_error(self::getDeprecationMessage('Implicit casting of incompatible mapping keys to strings is deprecated since Symfony 3.3 and will throw \\Symfony\\Component\\Yaml\\Exception\\ParseException in 4.0. Quote your evaluable mapping keys instead.'), \E_USER_DEPRECATED); + if ('' !== $key && $evaluatedKey !== $key && !is_string($evaluatedKey) && !is_int($evaluatedKey)) { + @trigger_error(self::getDeprecationMessage('Implicit casting of incompatible mapping keys to strings is deprecated since Symfony 3.3 and will throw \\Symfony\\Component\\Yaml\\Exception\\ParseException in 4.0. Quote your evaluable mapping keys instead.'), E_USER_DEPRECATED); } } - if (':' !== $key && !$isKeyQuoted && (!isset($mapping[$i + 1]) || !\in_array($mapping[$i + 1], [' ', ',', '[', ']', '{', '}'], \true))) { - @\trigger_error(self::getDeprecationMessage('Using a colon after an unquoted mapping key that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}") is deprecated since Symfony 3.2 and will throw a ParseException in 4.0.'), \E_USER_DEPRECATED); + if (':' !== $key && !$isKeyQuoted && (!isset($mapping[$i + 1]) || !in_array($mapping[$i + 1], [' ', ',', '[', ']', '{', '}'], true))) { + @trigger_error(self::getDeprecationMessage('Using a colon after an unquoted mapping key that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}") is deprecated since Symfony 3.2 and will throw a ParseException in 4.0.'), E_USER_DEPRECATED); } if ('<<' === $key) { - $allowOverwrite = \true; + $allowOverwrite = true; } while ($i < $len) { if (':' === $mapping[$i] || ' ' === $mapping[$i]) { @@ -484,12 +541,12 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = [] } } elseif ($allowOverwrite || !isset($output[$key])) { if (null !== $tag) { - $output[$key] = new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue($tag, $value); + $output[$key] = new TaggedValue($tag, $value); } else { $output[$key] = $value; } } elseif (isset($output[$key])) { - @\trigger_error(self::getDeprecationMessage(\sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since Symfony 3.2 and will throw \\Symfony\\Component\\Yaml\\Exception\\ParseException in 4.0.', $key)), \E_USER_DEPRECATED); + @trigger_error(self::getDeprecationMessage(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since Symfony 3.2 and will throw \\Symfony\\Component\\Yaml\\Exception\\ParseException in 4.0.', $key)), E_USER_DEPRECATED); } break; case '{': @@ -503,12 +560,12 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = [] $output += $value; } elseif ($allowOverwrite || !isset($output[$key])) { if (null !== $tag) { - $output[$key] = new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue($tag, $value); + $output[$key] = new TaggedValue($tag, $value); } else { $output[$key] = $value; } } elseif (isset($output[$key])) { - @\trigger_error(self::getDeprecationMessage(\sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since Symfony 3.2 and will throw \\Symfony\\Component\\Yaml\\Exception\\ParseException in 4.0.', $key)), \E_USER_DEPRECATED); + @trigger_error(self::getDeprecationMessage(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since Symfony 3.2 and will throw \\Symfony\\Component\\Yaml\\Exception\\ParseException in 4.0.', $key)), E_USER_DEPRECATED); } break; default: @@ -521,12 +578,12 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = [] $output += $value; } elseif ($allowOverwrite || !isset($output[$key])) { if (null !== $tag) { - $output[$key] = new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue($tag, $value); + $output[$key] = new TaggedValue($tag, $value); } else { $output[$key] = $value; } } elseif (isset($output[$key])) { - @\trigger_error(self::getDeprecationMessage(\sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since Symfony 3.2 and will throw \\Symfony\\Component\\Yaml\\Exception\\ParseException in 4.0.', $key)), \E_USER_DEPRECATED); + @trigger_error(self::getDeprecationMessage(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since Symfony 3.2 and will throw \\Symfony\\Component\\Yaml\\Exception\\ParseException in 4.0.', $key)), E_USER_DEPRECATED); } --$i; } @@ -534,7 +591,7 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = [] continue 2; } } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('Malformed inline YAML string: "%s".', $mapping), self::$parsedLineNumber + 1, null, self::$parsedFilename); + throw new ParseException(sprintf('Malformed inline YAML string: "%s".', $mapping), self::$parsedLineNumber + 1, null, self::$parsedFilename); } /** * Evaluates scalars and replaces magic values. @@ -549,144 +606,144 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = [] */ private static function evaluateScalar($scalar, $flags, $references = []) { - $scalar = \trim($scalar); - $scalarLower = \strtolower($scalar); - if (0 === \strpos($scalar, '*')) { - if (\false !== ($pos = \strpos($scalar, '#'))) { - $value = \substr($scalar, 1, $pos - 2); + $scalar = trim($scalar); + $scalarLower = strtolower($scalar); + if (0 === strpos($scalar, '*')) { + if (false !== ($pos = strpos($scalar, '#'))) { + $value = substr($scalar, 1, $pos - 2); } else { - $value = \substr($scalar, 1); + $value = substr($scalar, 1); } // an unquoted * - if (\false === $value || '' === $value) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException('A reference must contain at least one character.', self::$parsedLineNumber + 1, $value, self::$parsedFilename); + if (false === $value || '' === $value) { + throw new ParseException('A reference must contain at least one character.', self::$parsedLineNumber + 1, $value, self::$parsedFilename); } - if (!\array_key_exists($value, $references)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('Reference "%s" does not exist.', $value), self::$parsedLineNumber + 1, $value, self::$parsedFilename); + if (!array_key_exists($value, $references)) { + throw new ParseException(sprintf('Reference "%s" does not exist.', $value), self::$parsedLineNumber + 1, $value, self::$parsedFilename); } return $references[$value]; } - switch (\true) { + switch (true) { case 'null' === $scalarLower: case '' === $scalar: case '~' === $scalar: return null; case 'true' === $scalarLower: - return \true; + return true; case 'false' === $scalarLower: - return \false; + return false; case '!' === $scalar[0]: - switch (\true) { - case 0 === \strpos($scalar, '!str'): - @\trigger_error(self::getDeprecationMessage('Support for the !str tag is deprecated since Symfony 3.4. Use the !!str tag instead.'), \E_USER_DEPRECATED); - return (string) \substr($scalar, 5); - case 0 === \strpos($scalar, '!!str '): - return (string) \substr($scalar, 6); - case 0 === \strpos($scalar, '! '): - @\trigger_error(self::getDeprecationMessage('Using the non-specific tag "!" is deprecated since Symfony 3.4 as its behavior will change in 4.0. It will force non-evaluating your values in 4.0. Use plain integers or !!float instead.'), \E_USER_DEPRECATED); - return (int) self::parseScalar(\substr($scalar, 2), $flags); - case 0 === \strpos($scalar, '!php/object:'): + switch (true) { + case 0 === strpos($scalar, '!str'): + @trigger_error(self::getDeprecationMessage('Support for the !str tag is deprecated since Symfony 3.4. Use the !!str tag instead.'), E_USER_DEPRECATED); + return (string) substr($scalar, 5); + case 0 === strpos($scalar, '!!str '): + return (string) substr($scalar, 6); + case 0 === strpos($scalar, '! '): + @trigger_error(self::getDeprecationMessage('Using the non-specific tag "!" is deprecated since Symfony 3.4 as its behavior will change in 4.0. It will force non-evaluating your values in 4.0. Use plain integers or !!float instead.'), E_USER_DEPRECATED); + return (int) self::parseScalar(substr($scalar, 2), $flags); + case 0 === strpos($scalar, '!php/object:'): if (self::$objectSupport) { - @\trigger_error(self::getDeprecationMessage('The !php/object: tag to indicate dumped PHP objects is deprecated since Symfony 3.4 and will be removed in 4.0. Use the !php/object (without the colon) tag instead.'), \E_USER_DEPRECATED); - return \unserialize(\substr($scalar, 12)); + @trigger_error(self::getDeprecationMessage('The !php/object: tag to indicate dumped PHP objects is deprecated since Symfony 3.4 and will be removed in 4.0. Use the !php/object (without the colon) tag instead.'), E_USER_DEPRECATED); + return unserialize(substr($scalar, 12)); } if (self::$exceptionOnInvalidType) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException('Object support when parsing a YAML file has been disabled.', self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + throw new ParseException('Object support when parsing a YAML file has been disabled.', self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); } return null; - case 0 === \strpos($scalar, '!!php/object:'): + case 0 === strpos($scalar, '!!php/object:'): if (self::$objectSupport) { - @\trigger_error(self::getDeprecationMessage('The !!php/object: tag to indicate dumped PHP objects is deprecated since Symfony 3.1 and will be removed in 4.0. Use the !php/object (without the colon) tag instead.'), \E_USER_DEPRECATED); - return \unserialize(\substr($scalar, 13)); + @trigger_error(self::getDeprecationMessage('The !!php/object: tag to indicate dumped PHP objects is deprecated since Symfony 3.1 and will be removed in 4.0. Use the !php/object (without the colon) tag instead.'), E_USER_DEPRECATED); + return unserialize(substr($scalar, 13)); } if (self::$exceptionOnInvalidType) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException('Object support when parsing a YAML file has been disabled.', self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + throw new ParseException('Object support when parsing a YAML file has been disabled.', self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); } return null; - case 0 === \strpos($scalar, '!php/object'): + case 0 === strpos($scalar, '!php/object'): if (self::$objectSupport) { if (!isset($scalar[12])) { - return \false; + return false; } - return \unserialize(self::parseScalar(\substr($scalar, 12))); + return unserialize(self::parseScalar(substr($scalar, 12))); } if (self::$exceptionOnInvalidType) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException('Object support when parsing a YAML file has been disabled.', self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + throw new ParseException('Object support when parsing a YAML file has been disabled.', self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); } return null; - case 0 === \strpos($scalar, '!php/const:'): + case 0 === strpos($scalar, '!php/const:'): if (self::$constantSupport) { - @\trigger_error(self::getDeprecationMessage('The !php/const: tag to indicate dumped PHP constants is deprecated since Symfony 3.4 and will be removed in 4.0. Use the !php/const (without the colon) tag instead.'), \E_USER_DEPRECATED); - if (\defined($const = \substr($scalar, 11))) { - return \constant($const); + @trigger_error(self::getDeprecationMessage('The !php/const: tag to indicate dumped PHP constants is deprecated since Symfony 3.4 and will be removed in 4.0. Use the !php/const (without the colon) tag instead.'), E_USER_DEPRECATED); + if (defined($const = substr($scalar, 11))) { + return constant($const); } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('The constant "%s" is not defined.', $const), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + throw new ParseException(sprintf('The constant "%s" is not defined.', $const), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); } if (self::$exceptionOnInvalidType) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('The string "%s" could not be parsed as a constant. Have you forgotten to pass the "Yaml::PARSE_CONSTANT" flag to the parser?', $scalar), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + throw new ParseException(sprintf('The string "%s" could not be parsed as a constant. Have you forgotten to pass the "Yaml::PARSE_CONSTANT" flag to the parser?', $scalar), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); } return null; - case 0 === \strpos($scalar, '!php/const'): + case 0 === strpos($scalar, '!php/const'): if (self::$constantSupport) { if (!isset($scalar[11])) { return ''; } $i = 0; - if (\defined($const = self::parseScalar(\substr($scalar, 11), 0, null, $i, \false))) { - return \constant($const); + if (defined($const = self::parseScalar(substr($scalar, 11), 0, null, $i, false))) { + return constant($const); } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('The constant "%s" is not defined.', $const), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + throw new ParseException(sprintf('The constant "%s" is not defined.', $const), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); } if (self::$exceptionOnInvalidType) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('The string "%s" could not be parsed as a constant. Have you forgotten to pass the "Yaml::PARSE_CONSTANT" flag to the parser?', $scalar), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + throw new ParseException(sprintf('The string "%s" could not be parsed as a constant. Have you forgotten to pass the "Yaml::PARSE_CONSTANT" flag to the parser?', $scalar), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); } return null; - case 0 === \strpos($scalar, '!!float '): - return (float) \substr($scalar, 8); - case 0 === \strpos($scalar, '!!binary '): - return self::evaluateBinaryScalar(\substr($scalar, 9)); + case 0 === strpos($scalar, '!!float '): + return (float) substr($scalar, 8); + case 0 === strpos($scalar, '!!binary '): + return self::evaluateBinaryScalar(substr($scalar, 9)); default: - @\trigger_error(self::getDeprecationMessage(\sprintf('Using the unquoted scalar value "%s" is deprecated since Symfony 3.3 and will be considered as a tagged value in 4.0. You must quote it.', $scalar)), \E_USER_DEPRECATED); + @trigger_error(self::getDeprecationMessage(sprintf('Using the unquoted scalar value "%s" is deprecated since Symfony 3.3 and will be considered as a tagged value in 4.0. You must quote it.', $scalar)), E_USER_DEPRECATED); } // Optimize for returning strings. // no break - case '+' === $scalar[0] || '-' === $scalar[0] || '.' === $scalar[0] || \is_numeric($scalar[0]): - if (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser::preg_match('{^[+-]?[0-9][0-9_]*$}', $scalar)) { - $scalar = \str_replace('_', '', (string) $scalar); + case '+' === $scalar[0] || '-' === $scalar[0] || '.' === $scalar[0] || is_numeric($scalar[0]): + if (Parser::preg_match('{^[+-]?[0-9][0-9_]*$}', $scalar)) { + $scalar = str_replace('_', '', (string) $scalar); } - switch (\true) { - case \ctype_digit($scalar): + switch (true) { + case ctype_digit($scalar): $raw = $scalar; $cast = (int) $scalar; - return '0' == $scalar[0] ? \octdec($scalar) : ((string) $raw == (string) $cast ? $cast : $raw); - case '-' === $scalar[0] && \ctype_digit(\substr($scalar, 1)): + return '0' == $scalar[0] ? octdec($scalar) : ((string) $raw == (string) $cast ? $cast : $raw); + case '-' === $scalar[0] && ctype_digit(substr($scalar, 1)): $raw = $scalar; $cast = (int) $scalar; - return '0' == $scalar[1] ? -\octdec(\substr($scalar, 1)) : ($raw === (string) $cast ? $cast : $raw); - case \is_numeric($scalar): - case \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser::preg_match(self::getHexRegex(), $scalar): - $scalar = \str_replace('_', '', $scalar); - return '0x' === $scalar[0] . $scalar[1] ? \hexdec($scalar) : (float) $scalar; + return '0' == $scalar[1] ? -octdec(substr($scalar, 1)) : ($raw === (string) $cast ? $cast : $raw); + case is_numeric($scalar): + case Parser::preg_match(self::getHexRegex(), $scalar): + $scalar = str_replace('_', '', $scalar); + return '0x' === $scalar[0] . $scalar[1] ? hexdec($scalar) : (float) $scalar; case '.inf' === $scalarLower: case '.nan' === $scalarLower: - return -\log(0); + return -log(0); case '-.inf' === $scalarLower: - return \log(0); - case \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser::preg_match('/^(-|\\+)?[0-9][0-9,]*(\\.[0-9_]+)?$/', $scalar): - case \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser::preg_match('/^(-|\\+)?[0-9][0-9_]*(\\.[0-9_]+)?$/', $scalar): - if (\false !== \strpos($scalar, ',')) { - @\trigger_error(self::getDeprecationMessage('Using the comma as a group separator for floats is deprecated since Symfony 3.2 and will be removed in 4.0.'), \E_USER_DEPRECATED); + return log(0); + case Parser::preg_match('/^(-|\\+)?[0-9][0-9,]*(\\.[0-9_]+)?$/', $scalar): + case Parser::preg_match('/^(-|\\+)?[0-9][0-9_]*(\\.[0-9_]+)?$/', $scalar): + if (false !== strpos($scalar, ',')) { + @trigger_error(self::getDeprecationMessage('Using the comma as a group separator for floats is deprecated since Symfony 3.2 and will be removed in 4.0.'), E_USER_DEPRECATED); } - return (float) \str_replace([',', '_'], '', $scalar); - case \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser::preg_match(self::getTimestampRegex(), $scalar): - if (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_DATETIME & $flags) { + return (float) str_replace([',', '_'], '', $scalar); + case Parser::preg_match(self::getTimestampRegex(), $scalar): + if (Yaml::PARSE_DATETIME & $flags) { // When no timezone is provided in the parsed date, YAML spec says we must assume UTC. - return new \DateTime($scalar, new \DateTimeZone('UTC')); + return new DateTime($scalar, new DateTimeZone('UTC')); } - $timeZone = \date_default_timezone_get(); - \date_default_timezone_set('UTC'); - $time = \strtotime($scalar); - \date_default_timezone_set($timeZone); + $timeZone = date_default_timezone_get(); + date_default_timezone_set('UTC'); + $time = strtotime($scalar); + date_default_timezone_set($timeZone); return $time; } } @@ -704,24 +761,24 @@ private static function parseTag($value, &$i, $flags) if ('!' !== $value[$i]) { return null; } - $tagLength = \strcspn($value, " \t\n", $i + 1); - $tag = \substr($value, $i + 1, $tagLength); + $tagLength = strcspn($value, " \t\n", $i + 1); + $tag = substr($value, $i + 1, $tagLength); $nextOffset = $i + $tagLength + 1; - $nextOffset += \strspn($value, ' ', $nextOffset); + $nextOffset += strspn($value, ' ', $nextOffset); // Is followed by a scalar - if ((!isset($value[$nextOffset]) || !\in_array($value[$nextOffset], ['[', '{'], \true)) && 'tagged' !== $tag) { + if ((!isset($value[$nextOffset]) || !in_array($value[$nextOffset], ['[', '{'], true)) && 'tagged' !== $tag) { // Manage non-whitelisted scalars in {@link self::evaluateScalar()} return null; } // Built-in tags if ($tag && '!' === $tag[0]) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('The built-in tag "!%s" is not implemented.', $tag), self::$parsedLineNumber + 1, $value, self::$parsedFilename); + throw new ParseException(sprintf('The built-in tag "!%s" is not implemented.', $tag), self::$parsedLineNumber + 1, $value, self::$parsedFilename); } - if (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_CUSTOM_TAGS & $flags) { + if (Yaml::PARSE_CUSTOM_TAGS & $flags) { $i = $nextOffset; return $tag; } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('Tags support is not enabled. Enable the `Yaml::PARSE_CUSTOM_TAGS` flag to use "!%s".', $tag), self::$parsedLineNumber + 1, $value, self::$parsedFilename); + throw new ParseException(sprintf('Tags support is not enabled. Enable the `Yaml::PARSE_CUSTOM_TAGS` flag to use "!%s".', $tag), self::$parsedLineNumber + 1, $value, self::$parsedFilename); } /** * @param string $scalar @@ -732,18 +789,18 @@ private static function parseTag($value, &$i, $flags) */ public static function evaluateBinaryScalar($scalar) { - $parsedBinaryData = self::parseScalar(\preg_replace('/\\s/', '', $scalar)); - if (0 !== \strlen($parsedBinaryData) % 4) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('The normalized base64 encoded data (data without whitespace characters) length must be a multiple of four (%d bytes given).', \strlen($parsedBinaryData)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + $parsedBinaryData = self::parseScalar(preg_replace('/\\s/', '', $scalar)); + if (0 !== strlen($parsedBinaryData) % 4) { + throw new ParseException(sprintf('The normalized base64 encoded data (data without whitespace characters) length must be a multiple of four (%d bytes given).', strlen($parsedBinaryData)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); } - if (!\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser::preg_match('#^[A-Z0-9+/]+={0,2}$#i', $parsedBinaryData)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('The base64 encoded data (%s) contains invalid characters.', $parsedBinaryData), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + if (!Parser::preg_match('#^[A-Z0-9+/]+={0,2}$#i', $parsedBinaryData)) { + throw new ParseException(sprintf('The base64 encoded data (%s) contains invalid characters.', $parsedBinaryData), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); } - return \base64_decode($parsedBinaryData, \true); + return base64_decode($parsedBinaryData, true); } private static function isBinaryString($value) { - return !\preg_match('//u', $value) || \preg_match('/[^\\x00\\x07-\\x0d\\x1B\\x20-\\xff]/', $value); + return !preg_match('//u', $value) || preg_match('/[^\\x00\\x07-\\x0d\\x1B\\x20-\\xff]/', $value); } /** * Gets a regex that matches a YAML date. @@ -780,7 +837,7 @@ private static function getHexRegex() } private static function getDeprecationMessage($message) { - $message = \rtrim($message, '.'); + $message = rtrim($message, '.'); if (null !== self::$parsedFilename) { $message .= ' in ' . self::$parsedFilename; } diff --git a/vendor/symfony/yaml/Parser.php b/vendor/symfony/yaml/Parser.php index 78f419230..11752fc02 100644 --- a/vendor/symfony/yaml/Parser.php +++ b/vendor/symfony/yaml/Parser.php @@ -12,6 +12,54 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException; use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue; +use Exception; +use stdClass; +use Throwable; +use function abs; +use function array_key_exists; +use function array_pop; +use function array_search; +use function array_slice; +use function count; +use function end; +use function explode; +use function file_get_contents; +use function func_get_arg; +use function func_num_args; +use function implode; +use function in_array; +use function ini_get; +use function is_array; +use function is_bool; +use function is_file; +use function is_float; +use function is_int; +use function is_numeric; +use function is_object; +use function is_readable; +use function is_string; +use function ltrim; +use function mb_internal_encoding; +use function preg_last_error; +use function preg_match; +use function preg_replace; +use function rtrim; +use function sprintf; +use function str_replace; +use function strcspn; +use function strlen; +use function strpos; +use function substr; +use function substr_count; +use function trigger_error; +use function trim; +use const E_USER_DEPRECATED; +use const PREG_BACKTRACK_LIMIT_ERROR; +use const PREG_BAD_UTF8_ERROR; +use const PREG_BAD_UTF8_OFFSET_ERROR; +use const PREG_INTERNAL_ERROR; +use const PREG_RECURSION_LIMIT_ERROR; + /** * Parser parses YAML strings to convert them to PHP arrays. * @@ -35,14 +83,14 @@ class Parser private $refsBeingParsed = []; public function __construct() { - if (\func_num_args() > 0) { - @\trigger_error(\sprintf('The constructor arguments $offset, $totalNumberOfLines, $skippedLineNumbers of %s are deprecated and will be removed in 4.0', self::class), \E_USER_DEPRECATED); - $this->offset = \func_get_arg(0); - if (\func_num_args() > 1) { - $this->totalNumberOfLines = \func_get_arg(1); + if (func_num_args() > 0) { + @trigger_error(sprintf('The constructor arguments $offset, $totalNumberOfLines, $skippedLineNumbers of %s are deprecated and will be removed in 4.0', self::class), E_USER_DEPRECATED); + $this->offset = func_get_arg(0); + if (func_num_args() > 1) { + $this->totalNumberOfLines = func_get_arg(1); } - if (\func_num_args() > 2) { - $this->skippedLineNumbers = \func_get_arg(2); + if (func_num_args() > 2) { + $this->skippedLineNumbers = func_get_arg(2); } } } @@ -58,15 +106,15 @@ public function __construct() */ public function parseFile($filename, $flags = 0) { - if (!\is_file($filename)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('File "%s" does not exist.', $filename)); + if (!is_file($filename)) { + throw new ParseException(sprintf('File "%s" does not exist.', $filename)); } - if (!\is_readable($filename)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('File "%s" cannot be read.', $filename)); + if (!is_readable($filename)) { + throw new ParseException(sprintf('File "%s" cannot be read.', $filename)); } $this->filename = $filename; try { - return $this->parse(\file_get_contents($filename), $flags); + return $this->parse(file_get_contents($filename), $flags); } finally { $this->filename = null; } @@ -83,47 +131,47 @@ public function parseFile($filename, $flags = 0) */ public function parse($value, $flags = 0) { - if (\is_bool($flags)) { - @\trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE flag instead.', \E_USER_DEPRECATED); + if (is_bool($flags)) { + @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED); if ($flags) { - $flags = \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE; + $flags = Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE; } else { $flags = 0; } } - if (\func_num_args() >= 3) { - @\trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT flag instead.', \E_USER_DEPRECATED); - if (\func_get_arg(2)) { - $flags |= \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_OBJECT; + if (func_num_args() >= 3) { + @trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT flag instead.', E_USER_DEPRECATED); + if (func_get_arg(2)) { + $flags |= Yaml::PARSE_OBJECT; } } - if (\func_num_args() >= 4) { - @\trigger_error('Passing a boolean flag to toggle object for map support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT_FOR_MAP flag instead.', \E_USER_DEPRECATED); - if (\func_get_arg(3)) { - $flags |= \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_OBJECT_FOR_MAP; + if (func_num_args() >= 4) { + @trigger_error('Passing a boolean flag to toggle object for map support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT_FOR_MAP flag instead.', E_USER_DEPRECATED); + if (func_get_arg(3)) { + $flags |= Yaml::PARSE_OBJECT_FOR_MAP; } } - if (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_KEYS_AS_STRINGS & $flags) { - @\trigger_error('Using the Yaml::PARSE_KEYS_AS_STRINGS flag is deprecated since Symfony 3.4 as it will be removed in 4.0. Quote your keys when they are evaluable instead.', \E_USER_DEPRECATED); + if (Yaml::PARSE_KEYS_AS_STRINGS & $flags) { + @trigger_error('Using the Yaml::PARSE_KEYS_AS_STRINGS flag is deprecated since Symfony 3.4 as it will be removed in 4.0. Quote your keys when they are evaluable instead.', E_USER_DEPRECATED); } - if (\false === \preg_match('//u', $value)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException('The YAML value does not appear to be valid UTF-8.', -1, null, $this->filename); + if (false === preg_match('//u', $value)) { + throw new ParseException('The YAML value does not appear to be valid UTF-8.', -1, null, $this->filename); } $this->refs = []; $mbEncoding = null; $e = null; $data = null; - if (2 & (int) \ini_get('mbstring.func_overload')) { - $mbEncoding = \mb_internal_encoding(); - \mb_internal_encoding('UTF-8'); + if (2 & (int) ini_get('mbstring.func_overload')) { + $mbEncoding = mb_internal_encoding(); + mb_internal_encoding('UTF-8'); } try { $data = $this->doParse($value, $flags); - } catch (\Exception $e) { - } catch (\Throwable $e) { + } catch (Exception $e) { + } catch (Throwable $e) { } if (null !== $mbEncoding) { - \mb_internal_encoding($mbEncoding); + mb_internal_encoding($mbEncoding); } $this->lines = []; $this->currentLine = ''; @@ -140,25 +188,25 @@ private function doParse($value, $flags) $this->currentLineNb = -1; $this->currentLine = ''; $value = $this->cleanup($value); - $this->lines = \explode("\n", $value); + $this->lines = explode("\n", $value); $this->locallySkippedLineNumbers = []; if (null === $this->totalNumberOfLines) { - $this->totalNumberOfLines = \count($this->lines); + $this->totalNumberOfLines = count($this->lines); } if (!$this->moveToNextLine()) { return null; } $data = []; $context = null; - $allowOverwrite = \false; + $allowOverwrite = false; while ($this->isCurrentLineEmpty()) { if (!$this->moveToNextLine()) { return null; } } // Resolves the tag and returns if end of the document - if (null !== ($tag = $this->getLineTag($this->currentLine, $flags, \false)) && !$this->moveToNextLine()) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue($tag, ''); + if (null !== ($tag = $this->getLineTag($this->currentLine, $flags, false)) && !$this->moveToNextLine()) { + return new TaggedValue($tag, ''); } do { if ($this->isCurrentLineEmpty()) { @@ -166,13 +214,13 @@ private function doParse($value, $flags) } // tab? if ("\t" === $this->currentLine[0]) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException('A YAML file cannot contain tabs as indentation.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + throw new ParseException('A YAML file cannot contain tabs as indentation.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); } - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::initialize($flags, $this->getRealCurrentLineNb(), $this->filename); - $isRef = $mergeNode = \false; - if (self::preg_match('#^\\-((?P\\s+)(?P.+))?$#u', \rtrim($this->currentLine), $values)) { + Inline::initialize($flags, $this->getRealCurrentLineNb(), $this->filename); + $isRef = $mergeNode = false; + if (self::preg_match('#^\\-((?P\\s+)(?P.+))?$#u', rtrim($this->currentLine), $values)) { if ($context && 'mapping' == $context) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException('You cannot define a sequence item when in a mapping.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + throw new ParseException('You cannot define a sequence item when in a mapping.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); } $context = 'sequence'; if (isset($values['value']) && self::preg_match('#^&(?P[^ ]+) *(?P.*)#u', $values['value'], $matches)) { @@ -181,19 +229,19 @@ private function doParse($value, $flags) $values['value'] = $matches['value']; } if (isset($values['value'][1]) && '?' === $values['value'][0] && ' ' === $values['value'][1]) { - @\trigger_error($this->getDeprecationMessage('Starting an unquoted string with a question mark followed by a space is deprecated since Symfony 3.3 and will throw \\Symfony\\Component\\Yaml\\Exception\\ParseException in 4.0.'), \E_USER_DEPRECATED); + @trigger_error($this->getDeprecationMessage('Starting an unquoted string with a question mark followed by a space is deprecated since Symfony 3.3 and will throw \\Symfony\\Component\\Yaml\\Exception\\ParseException in 4.0.'), E_USER_DEPRECATED); } // array - if (!isset($values['value']) || '' == \trim($values['value'], ' ') || 0 === \strpos(\ltrim($values['value'], ' '), '#')) { - $data[] = $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(null, \true), $flags); - } elseif (null !== ($subTag = $this->getLineTag(\ltrim($values['value'], ' '), $flags))) { - $data[] = new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue($subTag, $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(null, \true), $flags)); + if (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#')) { + $data[] = $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(null, true), $flags); + } elseif (null !== ($subTag = $this->getLineTag(ltrim($values['value'], ' '), $flags))) { + $data[] = new TaggedValue($subTag, $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(null, true), $flags)); } else { - if (isset($values['leadspaces']) && self::preg_match('#^(?P' . \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::REGEX_QUOTED_STRING . '|[^ \'"\\{\\[].*?) *\\:(\\s+(?P.+?))?\\s*$#u', $this->trimTag($values['value']), $matches)) { + if (isset($values['leadspaces']) && self::preg_match('#^(?P' . Inline::REGEX_QUOTED_STRING . '|[^ \'"\\{\\[].*?) *\\:(\\s+(?P.+?))?\\s*$#u', $this->trimTag($values['value']), $matches)) { // this is a compact notation element, add to next block and parse $block = $values['value']; if ($this->isNextLineIndented()) { - $block .= "\n" . $this->getNextEmbedBlock($this->getCurrentLineIndentation() + \strlen($values['leadspaces']) + 1); + $block .= "\n" . $this->getNextEmbedBlock($this->getCurrentLineIndentation() + strlen($values['leadspaces']) + 1); } $data[] = $this->parseBlock($this->getRealCurrentLineNb(), $block, $flags); } else { @@ -201,52 +249,52 @@ private function doParse($value, $flags) } } if ($isRef) { - $this->refs[$isRef] = \end($data); - \array_pop($this->refsBeingParsed); + $this->refs[$isRef] = end($data); + array_pop($this->refsBeingParsed); } - } elseif (self::preg_match('#^(?P(?:![^\\s]++\\s++)?(?:' . \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::REGEX_QUOTED_STRING . '|(?:!?!php/const:)?[^ \'"\\[\\{!].*?)) *\\:(\\s++(?P.+))?$#u', \rtrim($this->currentLine), $values) && (\false === \strpos($values['key'], ' #') || \in_array($values['key'][0], ['"', "'"]))) { + } elseif (self::preg_match('#^(?P(?:![^\\s]++\\s++)?(?:' . Inline::REGEX_QUOTED_STRING . '|(?:!?!php/const:)?[^ \'"\\[\\{!].*?)) *\\:(\\s++(?P.+))?$#u', rtrim($this->currentLine), $values) && (false === strpos($values['key'], ' #') || in_array($values['key'][0], ['"', "'"]))) { if ($context && 'sequence' == $context) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException('You cannot define a mapping item when in a sequence.', $this->currentLineNb + 1, $this->currentLine, $this->filename); + throw new ParseException('You cannot define a mapping item when in a sequence.', $this->currentLineNb + 1, $this->currentLine, $this->filename); } $context = 'mapping'; try { $i = 0; - $evaluateKey = !(\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_KEYS_AS_STRINGS & $flags); + $evaluateKey = !(Yaml::PARSE_KEYS_AS_STRINGS & $flags); // constants in key will be evaluated anyway - if (isset($values['key'][0]) && '!' === $values['key'][0] && \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_CONSTANT & $flags) { - $evaluateKey = \true; + if (isset($values['key'][0]) && '!' === $values['key'][0] && Yaml::PARSE_CONSTANT & $flags) { + $evaluateKey = true; } - $key = \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parseScalar($values['key'], 0, null, $i, $evaluateKey); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException $e) { + $key = Inline::parseScalar($values['key'], 0, null, $i, $evaluateKey); + } catch (ParseException $e) { $e->setParsedLine($this->getRealCurrentLineNb() + 1); $e->setSnippet($this->currentLine); throw $e; } - if (!\is_string($key) && !\is_int($key)) { - $keyType = \is_numeric($key) ? 'numeric key' : 'non-string key'; - @\trigger_error($this->getDeprecationMessage(\sprintf('Implicit casting of %s to string is deprecated since Symfony 3.3 and will throw \\Symfony\\Component\\Yaml\\Exception\\ParseException in 4.0. Quote your evaluable mapping keys instead.', $keyType)), \E_USER_DEPRECATED); + if (!is_string($key) && !is_int($key)) { + $keyType = is_numeric($key) ? 'numeric key' : 'non-string key'; + @trigger_error($this->getDeprecationMessage(sprintf('Implicit casting of %s to string is deprecated since Symfony 3.3 and will throw \\Symfony\\Component\\Yaml\\Exception\\ParseException in 4.0. Quote your evaluable mapping keys instead.', $keyType)), E_USER_DEPRECATED); } // Convert float keys to strings, to avoid being converted to integers by PHP - if (\is_float($key)) { + if (is_float($key)) { $key = (string) $key; } if ('<<' === $key && (!isset($values['value']) || !self::preg_match('#^&(?P[^ ]+)#u', $values['value'], $refMatches))) { - $mergeNode = \true; - $allowOverwrite = \true; + $mergeNode = true; + $allowOverwrite = true; if (isset($values['value'][0]) && '*' === $values['value'][0]) { - $refName = \substr(\rtrim($values['value']), 1); - if (!\array_key_exists($refName, $this->refs)) { - if (\false !== ($pos = \array_search($refName, $this->refsBeingParsed, \true))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('Circular reference [%s, %s] detected for reference "%s".', \implode(', ', \array_slice($this->refsBeingParsed, $pos)), $refName, $refName), $this->currentLineNb + 1, $this->currentLine, $this->filename); + $refName = substr(rtrim($values['value']), 1); + if (!array_key_exists($refName, $this->refs)) { + if (false !== ($pos = array_search($refName, $this->refsBeingParsed, true))) { + throw new ParseException(sprintf('Circular reference [%s, %s] detected for reference "%s".', implode(', ', array_slice($this->refsBeingParsed, $pos)), $refName, $refName), $this->currentLineNb + 1, $this->currentLine, $this->filename); } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('Reference "%s" does not exist.', $refName), $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + throw new ParseException(sprintf('Reference "%s" does not exist.', $refName), $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); } $refValue = $this->refs[$refName]; - if (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_OBJECT_FOR_MAP & $flags && $refValue instanceof \stdClass) { + if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && $refValue instanceof stdClass) { $refValue = (array) $refValue; } - if (!\is_array($refValue)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + if (!is_array($refValue)) { + throw new ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); } $data += $refValue; // array union @@ -257,22 +305,22 @@ private function doParse($value, $flags) $value = $this->getNextEmbedBlock(); } $parsed = $this->parseBlock($this->getRealCurrentLineNb() + 1, $value, $flags); - if (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_OBJECT_FOR_MAP & $flags && $parsed instanceof \stdClass) { + if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && $parsed instanceof stdClass) { $parsed = (array) $parsed; } - if (!\is_array($parsed)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + if (!is_array($parsed)) { + throw new ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); } if (isset($parsed[0])) { // If the value associated with the merge key is a sequence, then this sequence is expected to contain mapping nodes // and each of these nodes is merged in turn according to its order in the sequence. Keys in mapping nodes earlier // in the sequence override keys specified in later mapping nodes. foreach ($parsed as $parsedItem) { - if (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_OBJECT_FOR_MAP & $flags && $parsedItem instanceof \stdClass) { + if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && $parsedItem instanceof stdClass) { $parsedItem = (array) $parsedItem; } - if (!\is_array($parsedItem)) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException('Merge items must be arrays.', $this->getRealCurrentLineNb() + 1, $parsedItem, $this->filename); + if (!is_array($parsedItem)) { + throw new ParseException('Merge items must be arrays.', $this->getRealCurrentLineNb() + 1, $parsedItem, $this->filename); } $data += $parsedItem; // array union @@ -292,7 +340,7 @@ private function doParse($value, $flags) $subTag = null; if ($mergeNode) { // Merge keys - } elseif (!isset($values['value']) || '' === $values['value'] || 0 === \strpos($values['value'], '#') || null !== ($subTag = $this->getLineTag($values['value'], $flags)) || '<<' === $key) { + } elseif (!isset($values['value']) || '' === $values['value'] || 0 === strpos($values['value'], '#') || null !== ($subTag = $this->getLineTag($values['value'], $flags)) || '<<' === $key) { // hash // if next line is less indented or equal, then it means that the current value is null if (!$this->isNextLineIndented() && !$this->isNextLineUnIndentedCollection()) { @@ -300,18 +348,18 @@ private function doParse($value, $flags) // But overwriting is allowed when a merge node is used in current block. if ($allowOverwrite || !isset($data[$key])) { if (null !== $subTag) { - $data[$key] = new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue($subTag, ''); + $data[$key] = new TaggedValue($subTag, ''); } else { $data[$key] = null; } } else { - @\trigger_error($this->getDeprecationMessage(\sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since Symfony 3.2 and will throw \\Symfony\\Component\\Yaml\\Exception\\ParseException in 4.0.', $key)), \E_USER_DEPRECATED); + @trigger_error($this->getDeprecationMessage(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since Symfony 3.2 and will throw \\Symfony\\Component\\Yaml\\Exception\\ParseException in 4.0.', $key)), E_USER_DEPRECATED); } } else { $value = $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(), $flags); if ('<<' === $key) { $this->refs[$refMatches['ref']] = $value; - if (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_OBJECT_FOR_MAP & $flags && $value instanceof \stdClass) { + if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && $value instanceof stdClass) { $value = (array) $value; } $data += $value; @@ -319,41 +367,41 @@ private function doParse($value, $flags) // Spec: Keys MUST be unique; first one wins. // But overwriting is allowed when a merge node is used in current block. if (null !== $subTag) { - $data[$key] = new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue($subTag, $value); + $data[$key] = new TaggedValue($subTag, $value); } else { $data[$key] = $value; } } else { - @\trigger_error($this->getDeprecationMessage(\sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since Symfony 3.2 and will throw \\Symfony\\Component\\Yaml\\Exception\\ParseException in 4.0.', $key)), \E_USER_DEPRECATED); + @trigger_error($this->getDeprecationMessage(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since Symfony 3.2 and will throw \\Symfony\\Component\\Yaml\\Exception\\ParseException in 4.0.', $key)), E_USER_DEPRECATED); } } } else { - $value = $this->parseValue(\rtrim($values['value']), $flags, $context); + $value = $this->parseValue(rtrim($values['value']), $flags, $context); // Spec: Keys MUST be unique; first one wins. // But overwriting is allowed when a merge node is used in current block. if ($allowOverwrite || !isset($data[$key])) { $data[$key] = $value; } else { - @\trigger_error($this->getDeprecationMessage(\sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since Symfony 3.2 and will throw \\Symfony\\Component\\Yaml\\Exception\\ParseException in 4.0.', $key)), \E_USER_DEPRECATED); + @trigger_error($this->getDeprecationMessage(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since Symfony 3.2 and will throw \\Symfony\\Component\\Yaml\\Exception\\ParseException in 4.0.', $key)), E_USER_DEPRECATED); } } if ($isRef) { $this->refs[$isRef] = $data[$key]; - \array_pop($this->refsBeingParsed); + array_pop($this->refsBeingParsed); } } else { // multiple documents are not supported if ('---' === $this->currentLine) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException('Multiple documents are not supported.', $this->currentLineNb + 1, $this->currentLine, $this->filename); + throw new ParseException('Multiple documents are not supported.', $this->currentLineNb + 1, $this->currentLine, $this->filename); } if ($deprecatedUsage = isset($this->currentLine[1]) && '?' === $this->currentLine[0] && ' ' === $this->currentLine[1]) { - @\trigger_error($this->getDeprecationMessage('Starting an unquoted string with a question mark followed by a space is deprecated since Symfony 3.3 and will throw \\Symfony\\Component\\Yaml\\Exception\\ParseException in 4.0.'), \E_USER_DEPRECATED); + @trigger_error($this->getDeprecationMessage('Starting an unquoted string with a question mark followed by a space is deprecated since Symfony 3.3 and will throw \\Symfony\\Component\\Yaml\\Exception\\ParseException in 4.0.'), E_USER_DEPRECATED); } // 1-liner optionally followed by newline(s) - if (\is_string($value) && $this->lines[0] === \trim($value)) { + if (is_string($value) && $this->lines[0] === trim($value)) { try { - $value = \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse($this->lines[0], $flags, $this->refs); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException $e) { + $value = Inline::parse($this->lines[0], $flags, $this->refs); + } catch (ParseException $e) { $e->setParsedLine($this->getRealCurrentLineNb() + 1); $e->setSnippet($this->currentLine); throw $e; @@ -362,52 +410,52 @@ private function doParse($value, $flags) } // try to parse the value as a multi-line string as a last resort if (0 === $this->currentLineNb) { - $previousLineWasNewline = \false; - $previousLineWasTerminatedWithBackslash = \false; + $previousLineWasNewline = false; + $previousLineWasTerminatedWithBackslash = false; $value = ''; foreach ($this->lines as $line) { - if ('' !== \ltrim($line) && '#' === \ltrim($line)[0]) { + if ('' !== ltrim($line) && '#' === ltrim($line)[0]) { continue; } // If the indentation is not consistent at offset 0, it is to be considered as a ParseError if (0 === $this->offset && !$deprecatedUsage && isset($line[0]) && ' ' === $line[0]) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); } - if ('' === \trim($line)) { + if ('' === trim($line)) { $value .= "\n"; } elseif (!$previousLineWasNewline && !$previousLineWasTerminatedWithBackslash) { $value .= ' '; } - if ('' !== \trim($line) && '\\' === \substr($line, -1)) { - $value .= \ltrim(\substr($line, 0, -1)); - } elseif ('' !== \trim($line)) { - $value .= \trim($line); + if ('' !== trim($line) && '\\' === substr($line, -1)) { + $value .= ltrim(substr($line, 0, -1)); + } elseif ('' !== trim($line)) { + $value .= trim($line); } - if ('' === \trim($line)) { - $previousLineWasNewline = \true; - $previousLineWasTerminatedWithBackslash = \false; - } elseif ('\\' === \substr($line, -1)) { - $previousLineWasNewline = \false; - $previousLineWasTerminatedWithBackslash = \true; + if ('' === trim($line)) { + $previousLineWasNewline = true; + $previousLineWasTerminatedWithBackslash = false; + } elseif ('\\' === substr($line, -1)) { + $previousLineWasNewline = false; + $previousLineWasTerminatedWithBackslash = true; } else { - $previousLineWasNewline = \false; - $previousLineWasTerminatedWithBackslash = \false; + $previousLineWasNewline = false; + $previousLineWasTerminatedWithBackslash = false; } } try { - return \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse(\trim($value)); - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException $e) { + return Inline::parse(trim($value)); + } catch (ParseException $e) { // fall-through to the ParseException thrown below } } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); } } while ($this->moveToNextLine()); if (null !== $tag) { - $data = new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue($tag, $data); + $data = new TaggedValue($tag, $data); } - if (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_OBJECT_FOR_MAP & $flags && !\is_object($data) && 'mapping' === $context) { - $object = new \stdClass(); + if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && !is_object($data) && 'mapping' === $context) { + $object = new stdClass(); foreach ($data as $key => $value) { $object->{$key} = $value; } @@ -457,7 +505,7 @@ public function getRealCurrentLineNb() */ private function getCurrentLineIndentation() { - return \strlen($this->currentLine) - \strlen(\ltrim($this->currentLine, ' ')); + return strlen($this->currentLine) - strlen(ltrim($this->currentLine, ' ')); } /** * Returns the next embed block of YAML. @@ -469,7 +517,7 @@ private function getCurrentLineIndentation() * * @throws ParseException When indentation problem are detected */ - private function getNextEmbedBlock($indentation = null, $inSequence = \false) + private function getNextEmbedBlock($indentation = null, $inSequence = false) { $oldLineIndentation = $this->getCurrentLineIndentation(); if (!$this->moveToNextLine()) { @@ -479,7 +527,7 @@ private function getNextEmbedBlock($indentation = null, $inSequence = \false) $newIndent = null; $movements = 0; do { - $EOF = \false; + $EOF = false; // empty and comment-like lines do not influence the indentation depth if ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()) { $EOF = !$this->moveToNextLine(); @@ -495,14 +543,14 @@ private function getNextEmbedBlock($indentation = null, $inSequence = \false) } $unindentedEmbedBlock = $this->isStringUnIndentedCollectionItem(); if (!$this->isCurrentLineEmpty() && 0 === $newIndent && !$unindentedEmbedBlock) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException('Indentation problem.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + throw new ParseException('Indentation problem.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); } } else { $newIndent = $indentation; } $data = []; if ($this->getCurrentLineIndentation() >= $newIndent) { - $data[] = \substr($this->currentLine, $newIndent); + $data[] = substr($this->currentLine, $newIndent); } elseif ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()) { $data[] = $this->currentLine; } else { @@ -523,21 +571,21 @@ private function getNextEmbedBlock($indentation = null, $inSequence = \false) break; } if ($this->isCurrentLineBlank()) { - $data[] = \substr($this->currentLine, $newIndent); + $data[] = substr($this->currentLine, $newIndent); continue; } if ($indent >= $newIndent) { - $data[] = \substr($this->currentLine, $newIndent); + $data[] = substr($this->currentLine, $newIndent); } elseif ($this->isCurrentLineComment()) { $data[] = $this->currentLine; } elseif (0 == $indent) { $this->moveToPreviousLine(); break; } else { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException('Indentation problem.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + throw new ParseException('Indentation problem.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); } } - return \implode("\n", $data); + return implode("\n", $data); } /** * Moves the parser to the next line. @@ -546,11 +594,11 @@ private function getNextEmbedBlock($indentation = null, $inSequence = \false) */ private function moveToNextLine() { - if ($this->currentLineNb >= \count($this->lines) - 1) { - return \false; + if ($this->currentLineNb >= count($this->lines) - 1) { + return false; } $this->currentLine = $this->lines[++$this->currentLineNb]; - return \true; + return true; } /** * Moves the parser to the previous line. @@ -560,10 +608,10 @@ private function moveToNextLine() private function moveToPreviousLine() { if ($this->currentLineNb < 1) { - return \false; + return false; } $this->currentLine = $this->lines[--$this->currentLineNb]; - return \true; + return true; } /** * Parses a YAML value. @@ -578,30 +626,30 @@ private function moveToPreviousLine() */ private function parseValue($value, $flags, $context) { - if (0 === \strpos($value, '*')) { - if (\false !== ($pos = \strpos($value, '#'))) { - $value = \substr($value, 1, $pos - 2); + if (0 === strpos($value, '*')) { + if (false !== ($pos = strpos($value, '#'))) { + $value = substr($value, 1, $pos - 2); } else { - $value = \substr($value, 1); + $value = substr($value, 1); } - if (!\array_key_exists($value, $this->refs)) { - if (\false !== ($pos = \array_search($value, $this->refsBeingParsed, \true))) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('Circular reference [%s, %s] detected for reference "%s".', \implode(', ', \array_slice($this->refsBeingParsed, $pos)), $value, $value), $this->currentLineNb + 1, $this->currentLine, $this->filename); + if (!array_key_exists($value, $this->refs)) { + if (false !== ($pos = array_search($value, $this->refsBeingParsed, true))) { + throw new ParseException(sprintf('Circular reference [%s, %s] detected for reference "%s".', implode(', ', array_slice($this->refsBeingParsed, $pos)), $value, $value), $this->currentLineNb + 1, $this->currentLine, $this->filename); } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('Reference "%s" does not exist.', $value), $this->currentLineNb + 1, $this->currentLine, $this->filename); + throw new ParseException(sprintf('Reference "%s" does not exist.', $value), $this->currentLineNb + 1, $this->currentLine, $this->filename); } return $this->refs[$value]; } if (self::preg_match('/^(?:' . self::TAG_PATTERN . ' +)?' . self::BLOCK_SCALAR_HEADER_PATTERN . '$/', $value, $matches)) { $modifiers = isset($matches['modifiers']) ? $matches['modifiers'] : ''; - $data = $this->parseBlockScalar($matches['separator'], \preg_replace('#\\d+#', '', $modifiers), (int) \abs((int) $modifiers)); + $data = $this->parseBlockScalar($matches['separator'], preg_replace('#\\d+#', '', $modifiers), (int) abs((int) $modifiers)); if ('' !== $matches['tag']) { if ('!!binary' === $matches['tag']) { - return \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::evaluateBinaryScalar($data); + return Inline::evaluateBinaryScalar($data); } elseif ('tagged' === $matches['tag']) { - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue(\substr($matches['tag'], 1), $data); + return new TaggedValue(substr($matches['tag'], 1), $data); } elseif ('!' !== $matches['tag']) { - @\trigger_error($this->getDeprecationMessage(\sprintf('Using the custom tag "%s" for the value "%s" is deprecated since Symfony 3.3. It will be replaced by an instance of %s in 4.0.', $matches['tag'], $data, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue::class)), \E_USER_DEPRECATED); + @trigger_error($this->getDeprecationMessage(sprintf('Using the custom tag "%s" for the value "%s" is deprecated since Symfony 3.3. It will be replaced by an instance of %s in 4.0.', $matches['tag'], $data, TaggedValue::class)), E_USER_DEPRECATED); } } return $data; @@ -610,7 +658,7 @@ private function parseValue($value, $flags, $context) $quotation = '' !== $value && ('"' === $value[0] || "'" === $value[0]) ? $value[0] : null; // do not take following lines into account when the current line is a quoted single line value if (null !== $quotation && self::preg_match('/^' . $quotation . '.*' . $quotation . '(\\s*#.*)?$/', $value)) { - return \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse($value, $flags, $this->refs); + return Inline::parse($value, $flags, $this->refs); } $lines = []; while ($this->moveToNextLine()) { @@ -619,31 +667,31 @@ private function parseValue($value, $flags, $context) $this->moveToPreviousLine(); break; } - $lines[] = \trim($this->currentLine); + $lines[] = trim($this->currentLine); // quoted string values end with a line that is terminated with the quotation character - if ('' !== $this->currentLine && \substr($this->currentLine, -1) === $quotation) { + if ('' !== $this->currentLine && substr($this->currentLine, -1) === $quotation) { break; } } - for ($i = 0, $linesCount = \count($lines), $previousLineBlank = \false; $i < $linesCount; ++$i) { + for ($i = 0, $linesCount = count($lines), $previousLineBlank = false; $i < $linesCount; ++$i) { if ('' === $lines[$i]) { $value .= "\n"; - $previousLineBlank = \true; + $previousLineBlank = true; } elseif ($previousLineBlank) { $value .= $lines[$i]; - $previousLineBlank = \false; + $previousLineBlank = false; } else { $value .= ' ' . $lines[$i]; - $previousLineBlank = \false; + $previousLineBlank = false; } } - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::$parsedLineNumber = $this->getRealCurrentLineNb(); - $parsedValue = \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse($value, $flags, $this->refs); - if ('mapping' === $context && \is_string($parsedValue) && '"' !== $value[0] && "'" !== $value[0] && '[' !== $value[0] && '{' !== $value[0] && '!' !== $value[0] && \false !== \strpos($parsedValue, ': ')) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException('A colon cannot be used in an unquoted mapping value.', $this->getRealCurrentLineNb() + 1, $value, $this->filename); + Inline::$parsedLineNumber = $this->getRealCurrentLineNb(); + $parsedValue = Inline::parse($value, $flags, $this->refs); + if ('mapping' === $context && is_string($parsedValue) && '"' !== $value[0] && "'" !== $value[0] && '[' !== $value[0] && '{' !== $value[0] && '!' !== $value[0] && false !== strpos($parsedValue, ': ')) { + throw new ParseException('A colon cannot be used in an unquoted mapping value.', $this->getRealCurrentLineNb() + 1, $value, $this->filename); } return $parsedValue; - } catch (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException $e) { + } catch (ParseException $e) { $e->setParsedLine($this->getRealCurrentLineNb() + 1); $e->setSnippet($this->currentLine); throw $e; @@ -677,14 +725,14 @@ private function parseBlockScalar($style, $chomping = '', $indentation = 0) // determine indentation if not specified if (0 === $indentation) { if (self::preg_match('/^ +/', $this->currentLine, $matches)) { - $indentation = \strlen($matches[0]); + $indentation = strlen($matches[0]); } } if ($indentation > 0) { - $pattern = \sprintf('/^ {%d}(.*)$/', $indentation); + $pattern = sprintf('/^ {%d}(.*)$/', $indentation); while ($notEOF && ($isCurrentLineBlank || self::preg_match($pattern, $this->currentLine, $matches))) { - if ($isCurrentLineBlank && \strlen($this->currentLine) > $indentation) { - $blockLines[] = \substr($this->currentLine, $indentation); + if ($isCurrentLineBlank && strlen($this->currentLine) > $indentation) { + $blockLines[] = substr($this->currentLine, $indentation); } elseif ($isCurrentLineBlank) { $blockLines[] = ''; } else { @@ -707,39 +755,39 @@ private function parseBlockScalar($style, $chomping = '', $indentation = 0) // folded style if ('>' === $style) { $text = ''; - $previousLineIndented = \false; - $previousLineBlank = \false; - for ($i = 0, $blockLinesCount = \count($blockLines); $i < $blockLinesCount; ++$i) { + $previousLineIndented = false; + $previousLineBlank = false; + for ($i = 0, $blockLinesCount = count($blockLines); $i < $blockLinesCount; ++$i) { if ('' === $blockLines[$i]) { $text .= "\n"; - $previousLineIndented = \false; - $previousLineBlank = \true; + $previousLineIndented = false; + $previousLineBlank = true; } elseif (' ' === $blockLines[$i][0]) { $text .= "\n" . $blockLines[$i]; - $previousLineIndented = \true; - $previousLineBlank = \false; + $previousLineIndented = true; + $previousLineBlank = false; } elseif ($previousLineIndented) { $text .= "\n" . $blockLines[$i]; - $previousLineIndented = \false; - $previousLineBlank = \false; + $previousLineIndented = false; + $previousLineBlank = false; } elseif ($previousLineBlank || 0 === $i) { $text .= $blockLines[$i]; - $previousLineIndented = \false; - $previousLineBlank = \false; + $previousLineIndented = false; + $previousLineBlank = false; } else { $text .= ' ' . $blockLines[$i]; - $previousLineIndented = \false; - $previousLineBlank = \false; + $previousLineIndented = false; + $previousLineBlank = false; } } } else { - $text = \implode("\n", $blockLines); + $text = implode("\n", $blockLines); } // deal with trailing newlines if ('' === $chomping) { - $text = \preg_replace('/\\n+$/', "\n", $text); + $text = preg_replace('/\\n+$/', "\n", $text); } elseif ('-' === $chomping) { - $text = \preg_replace('/\\n+$/', '', $text); + $text = preg_replace('/\\n+$/', '', $text); } return $text; } @@ -759,7 +807,7 @@ private function isNextLineIndented() } } while (!$EOF && ($this->isCurrentLineEmpty() || $this->isCurrentLineComment())); if ($EOF) { - return \false; + return false; } $ret = $this->getCurrentLineIndentation() > $currentIndentation; for ($i = 0; $i < $movements; ++$i) { @@ -783,7 +831,7 @@ private function isCurrentLineEmpty() */ private function isCurrentLineBlank() { - return '' == \trim($this->currentLine, ' '); + return '' == trim($this->currentLine, ' '); } /** * Returns true if the current line is a comment line. @@ -793,7 +841,7 @@ private function isCurrentLineBlank() private function isCurrentLineComment() { //checking explicitly the first char of the trim is faster than loops or strpos - $ltrimmedLine = \ltrim($this->currentLine, ' '); + $ltrimmedLine = ltrim($this->currentLine, ' '); return '' !== $ltrimmedLine && '#' === $ltrimmedLine[0]; } private function isCurrentLineLastLineInDocument() @@ -809,26 +857,26 @@ private function isCurrentLineLastLineInDocument() */ private function cleanup($value) { - $value = \str_replace(["\r\n", "\r"], "\n", $value); + $value = str_replace(["\r\n", "\r"], "\n", $value); // strip YAML header $count = 0; - $value = \preg_replace('#^\\%YAML[: ][\\d\\.]+.*\\n#u', '', $value, -1, $count); + $value = preg_replace('#^\\%YAML[: ][\\d\\.]+.*\\n#u', '', $value, -1, $count); $this->offset += $count; // remove leading comments - $trimmedValue = \preg_replace('#^(\\#.*?\\n)+#s', '', $value, -1, $count); + $trimmedValue = preg_replace('#^(\\#.*?\\n)+#s', '', $value, -1, $count); if (1 === $count) { // items have been removed, update the offset - $this->offset += \substr_count($value, "\n") - \substr_count($trimmedValue, "\n"); + $this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n"); $value = $trimmedValue; } // remove start of the document marker (---) - $trimmedValue = \preg_replace('#^\\-\\-\\-.*?\\n#s', '', $value, -1, $count); + $trimmedValue = preg_replace('#^\\-\\-\\-.*?\\n#s', '', $value, -1, $count); if (1 === $count) { // items have been removed, update the offset - $this->offset += \substr_count($value, "\n") - \substr_count($trimmedValue, "\n"); + $this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n"); $value = $trimmedValue; // remove end of the document marker (...) - $value = \preg_replace('#\\.\\.\\.\\s*$#', '', $value); + $value = preg_replace('#\\.\\.\\.\\s*$#', '', $value); } return $value; } @@ -848,7 +896,7 @@ private function isNextLineUnIndentedCollection() } } while (!$EOF && ($this->isCurrentLineEmpty() || $this->isCurrentLineComment())); if ($EOF) { - return \false; + return false; } $ret = $this->getCurrentLineIndentation() === $currentIndentation && $this->isStringUnIndentedCollectionItem(); for ($i = 0; $i < $movements; ++$i) { @@ -863,7 +911,7 @@ private function isNextLineUnIndentedCollection() */ private function isStringUnIndentedCollectionItem() { - return '-' === \rtrim($this->currentLine) || 0 === \strpos($this->currentLine, '- '); + return '-' === rtrim($this->currentLine) || 0 === strpos($this->currentLine, '- '); } /** * A local wrapper for `preg_match` which will throw a ParseException if there @@ -880,27 +928,27 @@ private function isStringUnIndentedCollectionItem() */ public static function preg_match($pattern, $subject, &$matches = null, $flags = 0, $offset = 0) { - if (\false === ($ret = \preg_match($pattern, $subject, $matches, $flags, $offset))) { - switch (\preg_last_error()) { - case \PREG_INTERNAL_ERROR: + if (false === ($ret = preg_match($pattern, $subject, $matches, $flags, $offset))) { + switch (preg_last_error()) { + case PREG_INTERNAL_ERROR: $error = 'Internal PCRE error.'; break; - case \PREG_BACKTRACK_LIMIT_ERROR: + case PREG_BACKTRACK_LIMIT_ERROR: $error = 'pcre.backtrack_limit reached.'; break; - case \PREG_RECURSION_LIMIT_ERROR: + case PREG_RECURSION_LIMIT_ERROR: $error = 'pcre.recursion_limit reached.'; break; - case \PREG_BAD_UTF8_ERROR: + case PREG_BAD_UTF8_ERROR: $error = 'Malformed UTF-8 data.'; break; - case \PREG_BAD_UTF8_OFFSET_ERROR: + case PREG_BAD_UTF8_OFFSET_ERROR: $error = 'Offset doesn\'t correspond to the begin of a valid UTF-8 code point.'; break; default: $error = 'Error.'; } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException($error); + throw new ParseException($error); } return $ret; } @@ -913,14 +961,14 @@ public static function preg_match($pattern, $subject, &$matches = null, $flags = private function trimTag($value) { if ('!' === $value[0]) { - return \ltrim(\substr($value, 1, \strcspn($value, " \r\n", 1)), ' '); + return ltrim(substr($value, 1, strcspn($value, " \r\n", 1)), ' '); } return $value; } /** * @return string|null */ - private function getLineTag($value, $flags, $nextLineCheck = \true) + private function getLineTag($value, $flags, $nextLineCheck = true) { if ('' === $value || '!' !== $value[0] || 1 !== self::preg_match('/^' . self::TAG_PATTERN . ' *( +#.*)?$/', $value, $matches)) { return null; @@ -928,19 +976,19 @@ private function getLineTag($value, $flags, $nextLineCheck = \true) if ($nextLineCheck && !$this->isNextLineIndented()) { return null; } - $tag = \substr($matches['tag'], 1); + $tag = substr($matches['tag'], 1); // Built-in tags if ($tag && '!' === $tag[0]) { - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('The built-in tag "!%s" is not implemented.', $tag), $this->getRealCurrentLineNb() + 1, $value, $this->filename); + throw new ParseException(sprintf('The built-in tag "!%s" is not implemented.', $tag), $this->getRealCurrentLineNb() + 1, $value, $this->filename); } - if (\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_CUSTOM_TAGS & $flags) { + if (Yaml::PARSE_CUSTOM_TAGS & $flags) { return $tag; } - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('Tags support is not enabled. You must use the flag `Yaml::PARSE_CUSTOM_TAGS` to use "%s".', $matches['tag']), $this->getRealCurrentLineNb() + 1, $value, $this->filename); + throw new ParseException(sprintf('Tags support is not enabled. You must use the flag `Yaml::PARSE_CUSTOM_TAGS` to use "%s".', $matches['tag']), $this->getRealCurrentLineNb() + 1, $value, $this->filename); } private function getDeprecationMessage($message) { - $message = \rtrim($message, '.'); + $message = rtrim($message, '.'); if (null !== $this->filename) { $message .= ' in ' . $this->filename; } diff --git a/vendor/symfony/yaml/Tag/index.php b/vendor/symfony/yaml/Tag/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/yaml/Tag/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/yaml/Tests/Command/LintCommandTest.php b/vendor/symfony/yaml/Tests/Command/LintCommandTest.php index f4464cb8a..cdc5fe550 100644 --- a/vendor/symfony/yaml/Tests/Command/LintCommandTest.php +++ b/vendor/symfony/yaml/Tests/Command/LintCommandTest.php @@ -15,21 +15,30 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Console\Output\OutputInterface; use _PhpScoper5ea00cc67502b\Symfony\Component\Console\Tester\CommandTester; use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Command\LintCommand; +use function file_exists; +use function file_put_contents; +use function mkdir; +use function rmdir; +use function sys_get_temp_dir; +use function tempnam; +use function trim; +use function unlink; + /** * Tests the YamlLintCommand. * * @author Robin Chalas */ -class LintCommandTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class LintCommandTest extends TestCase { private $files; public function testLintCorrectFile() { $tester = $this->createCommandTester(); $filename = $this->createFile('foo: bar'); - $ret = $tester->execute(['filename' => $filename], ['verbosity' => \_PhpScoper5ea00cc67502b\Symfony\Component\Console\Output\OutputInterface::VERBOSITY_VERBOSE, 'decorated' => \false]); + $ret = $tester->execute(['filename' => $filename], ['verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false]); $this->assertEquals(0, $ret, 'Returns 0 in case of success'); - $this->assertRegExp('/^\\/\\/ OK in /', \trim($tester->getDisplay())); + $this->assertRegExp('/^\\/\\/ OK in /', trim($tester->getDisplay())); } public function testLintIncorrectFile() { @@ -38,16 +47,16 @@ public function testLintIncorrectFile() bar'; $tester = $this->createCommandTester(); $filename = $this->createFile($incorrectContent); - $ret = $tester->execute(['filename' => $filename], ['decorated' => \false]); + $ret = $tester->execute(['filename' => $filename], ['decorated' => false]); $this->assertEquals(1, $ret, 'Returns 1 in case of error'); - $this->assertStringContainsString('Unable to parse at line 3 (near "bar").', \trim($tester->getDisplay())); + $this->assertStringContainsString('Unable to parse at line 3 (near "bar").', trim($tester->getDisplay())); } public function testConstantAsKey() { $yaml = <<createCommandTester()->execute(['filename' => $this->createFile($yaml)], ['verbosity' => \_PhpScoper5ea00cc67502b\Symfony\Component\Console\Output\OutputInterface::VERBOSITY_VERBOSE, 'decorated' => \false]); + $ret = $this->createCommandTester()->execute(['filename' => $this->createFile($yaml)], ['verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false]); $this->assertSame(0, $ret, 'lint:yaml exits with code 0 in case of success'); } public function testCustomTags() @@ -55,7 +64,7 @@ public function testCustomTags() $yaml = <<createCommandTester()->execute(['filename' => $this->createFile($yaml), '--parse-tags' => \true], ['verbosity' => \_PhpScoper5ea00cc67502b\Symfony\Component\Console\Output\OutputInterface::VERBOSITY_VERBOSE, 'decorated' => \false]); + $ret = $this->createCommandTester()->execute(['filename' => $this->createFile($yaml), '--parse-tags' => true], ['verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false]); $this->assertSame(0, $ret, 'lint:yaml exits with code 0 in case of success'); } public function testCustomTagsError() @@ -63,7 +72,7 @@ public function testCustomTagsError() $yaml = <<createCommandTester()->execute(['filename' => $this->createFile($yaml)], ['verbosity' => \_PhpScoper5ea00cc67502b\Symfony\Component\Console\Output\OutputInterface::VERBOSITY_VERBOSE, 'decorated' => \false]); + $ret = $this->createCommandTester()->execute(['filename' => $this->createFile($yaml)], ['verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false]); $this->assertSame(1, $ret, 'lint:yaml exits with code 1 in case of error'); } public function testLintFileNotReadable() @@ -71,16 +80,16 @@ public function testLintFileNotReadable() $this->expectException('RuntimeException'); $tester = $this->createCommandTester(); $filename = $this->createFile(''); - \unlink($filename); - $tester->execute(['filename' => $filename], ['decorated' => \false]); + unlink($filename); + $tester->execute(['filename' => $filename], ['decorated' => false]); } /** * @return string Path to the new file */ private function createFile($content) { - $filename = \tempnam(\sys_get_temp_dir() . '/framework-yml-lint-test', 'sf-'); - \file_put_contents($filename, $content); + $filename = tempnam(sys_get_temp_dir() . '/framework-yml-lint-test', 'sf-'); + file_put_contents($filename, $content); $this->files[] = $filename; return $filename; } @@ -89,24 +98,24 @@ private function createFile($content) */ protected function createCommandTester() { - $application = new \_PhpScoper5ea00cc67502b\Symfony\Component\Console\Application(); - $application->add(new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Command\LintCommand()); + $application = new Application(); + $application->add(new LintCommand()); $command = $application->find('lint:yaml'); - return new \_PhpScoper5ea00cc67502b\Symfony\Component\Console\Tester\CommandTester($command); + return new CommandTester($command); } protected function setUp() { $this->files = []; - @\mkdir(\sys_get_temp_dir() . '/framework-yml-lint-test'); + @mkdir(sys_get_temp_dir() . '/framework-yml-lint-test'); } protected function tearDown() { foreach ($this->files as $file) { - if (\file_exists($file)) { - \unlink($file); + if (file_exists($file)) { + unlink($file); } } - \rmdir(\sys_get_temp_dir() . '/framework-yml-lint-test'); + rmdir(sys_get_temp_dir() . '/framework-yml-lint-test'); } } class Foo diff --git a/vendor/symfony/yaml/Tests/Command/index.php b/vendor/symfony/yaml/Tests/Command/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/yaml/Tests/Command/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/yaml/Tests/DumperTest.php b/vendor/symfony/yaml/Tests/DumperTest.php index 4abb432f6..a1e88fced 100644 --- a/vendor/symfony/yaml/Tests/DumperTest.php +++ b/vendor/symfony/yaml/Tests/DumperTest.php @@ -15,7 +15,14 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser; use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue; use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml; -class DumperTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use ArrayObject; +use stdClass; +use function base64_encode; +use function file_get_contents; +use function preg_split; +use function trim; + +class DumperTest extends TestCase { protected $parser; protected $dumper; @@ -23,8 +30,8 @@ class DumperTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase protected $array = ['' => 'bar', 'foo' => '#bar', 'foo\'bar' => [], 'bar' => [1, 'foo'], 'foobar' => ['foo' => 'bar', 'bar' => [1, 'foo'], 'foobar' => ['foo' => 'bar', 'bar' => [1, 'foo']]]]; protected function setUp() { - $this->parser = new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser(); - $this->dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Dumper(); + $this->parser = new Parser(); + $this->dumper = new Dumper(); $this->path = __DIR__ . '/Fixtures'; } protected function tearDown() @@ -36,7 +43,7 @@ protected function tearDown() } public function testIndentationInConstructor() { - $dumper = new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Dumper(7); + $dumper = new Dumper(7); $expected = <<<'EOF' '': bar foo: '#bar' @@ -87,11 +94,11 @@ public function testSetIndentation() } public function testSpecifications() { - $files = $this->parser->parse(\file_get_contents($this->path . '/index.yml')); + $files = $this->parser->parse(file_get_contents($this->path . '/index.yml')); foreach ($files as $file) { - $yamls = \file_get_contents($this->path . '/' . $file . '.yml'); + $yamls = file_get_contents($this->path . '/' . $file . '.yml'); // split YAMLs documents - foreach (\preg_split('/^---( %YAML\\:1\\.0)?/m', $yamls) as $yaml) { + foreach (preg_split('/^---( %YAML\\:1\\.0)?/m', $yamls) as $yaml) { if (!$yaml) { continue; } @@ -101,7 +108,7 @@ public function testSpecifications() } elseif (isset($test['todo']) && $test['todo']) { // TODO } else { - eval('$expected = ' . \trim($test['php']) . ';'); + eval('$expected = ' . trim($test['php']) . ';'); $this->assertSame($expected, $this->parser->parse($this->dumper->dump($expected, 10)), $test['test']); } } @@ -179,7 +186,7 @@ public function testInlineLevel() } public function testObjectSupportEnabled() { - $dump = $this->dumper->dump(['foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tests\A(), 'bar' => 1], 0, 0, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_OBJECT); + $dump = $this->dumper->dump(['foo' => new A(), 'bar' => 1], 0, 0, Yaml::DUMP_OBJECT); $this->assertEquals('{ foo: !php/object \'O:30:"Symfony\\Component\\Yaml\\Tests\\A":1:{s:1:"a";s:3:"foo";}\', bar: 1 }', $dump, '->dump() is able to dump objects'); } /** @@ -187,18 +194,18 @@ public function testObjectSupportEnabled() */ public function testObjectSupportEnabledPassingTrue() { - $dump = $this->dumper->dump(['foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tests\A(), 'bar' => 1], 0, 0, \false, \true); + $dump = $this->dumper->dump(['foo' => new A(), 'bar' => 1], 0, 0, false, true); $this->assertEquals('{ foo: !php/object \'O:30:"Symfony\\Component\\Yaml\\Tests\\A":1:{s:1:"a";s:3:"foo";}\', bar: 1 }', $dump, '->dump() is able to dump objects'); } public function testObjectSupportDisabledButNoExceptions() { - $dump = $this->dumper->dump(['foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tests\A(), 'bar' => 1]); + $dump = $this->dumper->dump(['foo' => new A(), 'bar' => 1]); $this->assertEquals('{ foo: null, bar: 1 }', $dump, '->dump() does not dump objects when disabled'); } public function testObjectSupportDisabledWithExceptions() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\DumpException'); - $this->dumper->dump(['foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tests\A(), 'bar' => 1], 0, 0, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE); + $this->dumper->dump(['foo' => new A(), 'bar' => 1], 0, 0, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE); } /** * @group legacy @@ -206,19 +213,19 @@ public function testObjectSupportDisabledWithExceptions() public function testObjectSupportDisabledWithExceptionsPassingTrue() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\DumpException'); - $this->dumper->dump(['foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tests\A(), 'bar' => 1], 0, 0, \true); + $this->dumper->dump(['foo' => new A(), 'bar' => 1], 0, 0, true); } public function testEmptyArray() { $dump = $this->dumper->dump([]); $this->assertEquals('{ }', $dump); - $dump = $this->dumper->dump([], 0, 0, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE); + $dump = $this->dumper->dump([], 0, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE); $this->assertEquals('[]', $dump); - $dump = $this->dumper->dump([], 9, 0, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE); + $dump = $this->dumper->dump([], 9, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE); $this->assertEquals('[]', $dump); - $dump = $this->dumper->dump(new \ArrayObject(), 0, 0, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE | \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_OBJECT_AS_MAP); + $dump = $this->dumper->dump(new ArrayObject(), 0, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE | Yaml::DUMP_OBJECT_AS_MAP); $this->assertEquals('{ }', $dump); - $dump = $this->dumper->dump(new \stdClass(), 0, 0, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE | \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_OBJECT_AS_MAP); + $dump = $this->dumper->dump(new stdClass(), 0, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE | Yaml::DUMP_OBJECT_AS_MAP); $this->assertEquals('{ }', $dump); } /** @@ -234,53 +241,53 @@ public function getEscapeSequences() } public function testBinaryDataIsDumpedBase64Encoded() { - $binaryData = \file_get_contents(__DIR__ . '/Fixtures/arrow.gif'); - $expected = '{ data: !!binary ' . \base64_encode($binaryData) . ' }'; + $binaryData = file_get_contents(__DIR__ . '/Fixtures/arrow.gif'); + $expected = '{ data: !!binary ' . base64_encode($binaryData) . ' }'; $this->assertSame($expected, $this->dumper->dump(['data' => $binaryData])); } public function testNonUtf8DataIsDumpedBase64Encoded() { // "für" (ISO-8859-1 encoded) - $this->assertSame('!!binary ZsM/cg==', $this->dumper->dump("f?r")); + $this->assertSame('!!binary ZsM/cg==', $this->dumper->dump("f�?r")); } /** * @dataProvider objectAsMapProvider */ public function testDumpObjectAsMap($object, $expected) { - $yaml = $this->dumper->dump($object, 0, 0, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_OBJECT_AS_MAP); - $this->assertEquals($expected, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::parse($yaml, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_OBJECT_FOR_MAP)); + $yaml = $this->dumper->dump($object, 0, 0, Yaml::DUMP_OBJECT_AS_MAP); + $this->assertEquals($expected, Yaml::parse($yaml, Yaml::PARSE_OBJECT_FOR_MAP)); } public function objectAsMapProvider() { $tests = []; - $bar = new \stdClass(); + $bar = new stdClass(); $bar->class = 'classBar'; $bar->args = ['bar']; - $zar = new \stdClass(); - $foo = new \stdClass(); + $zar = new stdClass(); + $foo = new stdClass(); $foo->bar = $bar; $foo->zar = $zar; - $object = new \stdClass(); + $object = new stdClass(); $object->foo = $foo; $tests['stdClass'] = [$object, $object]; - $arrayObject = new \ArrayObject(); + $arrayObject = new ArrayObject(); $arrayObject['foo'] = 'bar'; $arrayObject['baz'] = 'foobar'; - $parsedArrayObject = new \stdClass(); + $parsedArrayObject = new stdClass(); $parsedArrayObject->foo = 'bar'; $parsedArrayObject->baz = 'foobar'; $tests['ArrayObject'] = [$arrayObject, $parsedArrayObject]; - $a = new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tests\A(); + $a = new A(); $tests['arbitrary-object'] = [$a, null]; return $tests; } public function testDumpingArrayObjectInstancesRespectsInlineLevel() { - $deep = new \ArrayObject(['deep1' => 'd', 'deep2' => 'e']); - $inner = new \ArrayObject(['inner1' => 'b', 'inner2' => 'c', 'inner3' => $deep]); - $outer = new \ArrayObject(['outer1' => 'a', 'outer2' => $inner]); - $yaml = $this->dumper->dump($outer, 2, 0, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_OBJECT_AS_MAP); + $deep = new ArrayObject(['deep1' => 'd', 'deep2' => 'e']); + $inner = new ArrayObject(['inner1' => 'b', 'inner2' => 'c', 'inner3' => $deep]); + $outer = new ArrayObject(['outer1' => 'a', 'outer2' => $inner]); + $yaml = $this->dumper->dump($outer, 2, 0, Yaml::DUMP_OBJECT_AS_MAP); $expected = <<dumper->dump($outer, 0, 0, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_OBJECT_AS_MAP); + $deep = new ArrayObject(['d', 'e']); + $inner = new ArrayObject(['b', 'c', $deep]); + $outer = new ArrayObject(['a', $inner]); + $yaml = $this->dumper->dump($outer, 0, 0, Yaml::DUMP_OBJECT_AS_MAP); $expected = <<dumper->dump($outer, 2, 0, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_OBJECT_AS_MAP); + $deep = new ArrayObject(['d', 'e']); + $inner = new ArrayObject(['b', 'c', $deep]); + $outer = new ArrayObject(['a', $inner]); + $yaml = $this->dumper->dump($outer, 2, 0, Yaml::DUMP_OBJECT_AS_MAP); $expected = <<assertSame('{ }', $this->dumper->dump(new \ArrayObject(), 2, 0, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_OBJECT_AS_MAP)); + $this->assertSame('{ }', $this->dumper->dump(new ArrayObject(), 2, 0, Yaml::DUMP_OBJECT_AS_MAP)); } public function testDumpEmptyStdClassInstanceAsMap() { - $this->assertSame('{ }', $this->dumper->dump(new \stdClass(), 2, 0, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_OBJECT_AS_MAP)); + $this->assertSame('{ }', $this->dumper->dump(new stdClass(), 2, 0, Yaml::DUMP_OBJECT_AS_MAP)); } public function testDumpingStdClassInstancesRespectsInlineLevel() { - $deep = new \stdClass(); + $deep = new stdClass(); $deep->deep1 = 'd'; $deep->deep2 = 'e'; - $inner = new \stdClass(); + $inner = new stdClass(); $inner->inner1 = 'b'; $inner->inner2 = 'c'; $inner->inner3 = $deep; - $outer = new \stdClass(); + $outer = new stdClass(); $outer->outer1 = 'a'; $outer->outer2 = $inner; - $yaml = $this->dumper->dump($outer, 2, 0, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_OBJECT_AS_MAP); + $yaml = $this->dumper->dump($outer, 2, 0, Yaml::DUMP_OBJECT_AS_MAP); $expected = << 'jane']), new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue('user', ['username' => 'john'])]; + $data = [new TaggedValue('user', ['username' => 'jane']), new TaggedValue('user', ['username' => 'john'])]; $yaml = $this->dumper->dump($data, 2); $expected = << 'jane']), new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue('user', ['username' => 'john'])]; + $data = [new TaggedValue('user', ['username' => 'jane']), new TaggedValue('user', ['username' => 'john'])]; $yaml = $this->dumper->dump($data, 1); $expected = << new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue('user', ['username' => 'jane']), 'user2' => new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue('user', ['username' => 'john'])]; + $data = ['user1' => new TaggedValue('user', ['username' => 'jane']), 'user2' => new TaggedValue('user', ['username' => 'john'])]; $yaml = $this->dumper->dump($data, 2); $expected = << new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue('user', ['username' => 'jane']), 'user2' => new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue('user', ['username' => 'john'])]; + $data = ['user1' => new TaggedValue('user', ['username' => 'jane']), 'user2' => new TaggedValue('user', ['username' => 'john'])]; $yaml = $this->dumper->dump($data, 1); $expected = << new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue('user', 'jane'), 'user2' => new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue('user', 'john')]; + $data = ['user1' => new TaggedValue('user', 'jane'), 'user2' => new TaggedValue('user', 'john')]; $expected = << new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue('bar', null)]; + $data = ['foo' => new TaggedValue('bar', null)]; $expected = << new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue('bar', "foo\nline with trailing spaces:\n \nbar\ninteger like line:\n123456789\nempty line:\n\nbaz")]; + $data = ['foo' => new TaggedValue('bar', "foo\nline with trailing spaces:\n \nbar\ninteger like line:\n123456789\nempty line:\n\nbaz")]; $expected = <<assertSame($expected, $this->dumper->dump($data, 2, 0, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK)); + $this->assertSame($expected, $this->dumper->dump($data, 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK)); } public function testDumpingInlinedMultiLineIfRnBreakLineInTaggedValue() { - $data = ['data' => ['foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue('bar', "foo\r\nline with trailing spaces:\n \nbar\ninteger like line:\n123456789\nempty line:\n\nbaz")]]; - $this->assertSame(\file_get_contents(__DIR__ . '/Fixtures/multiple_lines_as_literal_block_for_tagged_values.yml'), $this->dumper->dump($data, 2, 0, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK)); + $data = ['data' => ['foo' => new TaggedValue('bar', "foo\r\nline with trailing spaces:\n \nbar\ninteger like line:\n123456789\nempty line:\n\nbaz")]]; + $this->assertSame(file_get_contents(__DIR__ . '/Fixtures/multiple_lines_as_literal_block_for_tagged_values.yml'), $this->dumper->dump($data, 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK)); } public function testDumpMultiLineStringAsScalarBlock() { $data = ['data' => ['single_line' => 'foo bar baz', 'multi_line' => "foo\nline with trailing spaces:\n \nbar\ninteger like line:\n123456789\nempty line:\n\nbaz", 'multi_line_with_carriage_return' => "foo\nbar\r\nbaz", 'nested_inlined_multi_line_string' => ['inlined_multi_line' => "foo\nbar\r\nempty line:\n\nbaz"]]]; - $this->assertSame(\file_get_contents(__DIR__ . '/Fixtures/multiple_lines_as_literal_block.yml'), $this->dumper->dump($data, 2, 0, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK)); + $this->assertSame(file_get_contents(__DIR__ . '/Fixtures/multiple_lines_as_literal_block.yml'), $this->dumper->dump($data, 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK)); } public function testDumpMultiLineStringAsScalarBlockWhenFirstLineHasLeadingSpace() { $data = ['data' => ['multi_line' => " the first line has leading spaces\nThe second line does not."]]; - $this->assertSame(\file_get_contents(__DIR__ . '/Fixtures/multiple_lines_as_literal_block_leading_space_in_first_line.yml'), $this->dumper->dump($data, 2, 0, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK)); + $this->assertSame(file_get_contents(__DIR__ . '/Fixtures/multiple_lines_as_literal_block_leading_space_in_first_line.yml'), $this->dumper->dump($data, 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK)); } public function testCarriageReturnFollowedByNewlineIsMaintainedWhenDumpingAsMultiLineLiteralBlock() { - $this->assertSame("- \"a\\r\\nb\\nc\"\n", $this->dumper->dump(["a\r\nb\nc"], 2, 0, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK)); + $this->assertSame("- \"a\\r\\nb\\nc\"\n", $this->dumper->dump(["a\r\nb\nc"], 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK)); } public function testCarriageReturnNotFollowedByNewlineIsPreservedWhenDumpingAsMultiLineLiteralBlock() { @@ -460,19 +467,19 @@ public function testCarriageReturnNotFollowedByNewlineIsPreservedWhenDumpingAsMu foo: "bar\n\rbaz: qux" YAML; - $this->assertSame($expected, $this->dumper->dump(['parent' => ['foo' => "bar\n\rbaz: qux"]], 4, 0, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK)); + $this->assertSame($expected, $this->dumper->dump(['parent' => ['foo' => "bar\n\rbaz: qux"]], 4, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK)); } public function testZeroIndentationThrowsException() { $this->expectException('InvalidArgumentException'); $this->expectExceptionMessage('The indentation must be greater than zero'); - new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Dumper(0); + new Dumper(0); } public function testNegativeIndentationThrowsException() { $this->expectException('InvalidArgumentException'); $this->expectExceptionMessage('The indentation must be greater than zero'); - new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Dumper(-4); + new Dumper(-4); } } class A diff --git a/vendor/symfony/yaml/Tests/Fixtures/index.php b/vendor/symfony/yaml/Tests/Fixtures/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/yaml/Tests/Fixtures/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/yaml/Tests/InlineTest.php b/vendor/symfony/yaml/Tests/InlineTest.php index 2c3870226..8fd24720e 100644 --- a/vendor/symfony/yaml/Tests/InlineTest.php +++ b/vendor/symfony/yaml/Tests/InlineTest.php @@ -14,50 +14,66 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException; use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline; use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml; -class InlineTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use DateTime; +use DateTimeImmutable; +use DateTimeZone; +use stdClass; +use function gmmktime; +use function implode; +use function log; +use function serialize; +use function setlocale; +use function sprintf; +use function str_repeat; +use const INF; +use const LC_NUMERIC; +use const PHP_INT_MAX; +use const PHP_VERSION_ID; + +class InlineTest extends TestCase { protected function setUp() { - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::initialize(0, 0); + Inline::initialize(0, 0); } /** * @dataProvider getTestsForParse */ public function testParse($yaml, $value, $flags = 0) { - $this->assertSame($value, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse($yaml, $flags), \sprintf('::parse() converts an inline YAML to a PHP structure (%s)', $yaml)); + $this->assertSame($value, Inline::parse($yaml, $flags), sprintf('::parse() converts an inline YAML to a PHP structure (%s)', $yaml)); } /** * @dataProvider getTestsForParseWithMapObjects */ - public function testParseWithMapObjects($yaml, $value, $flags = \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_OBJECT_FOR_MAP) + public function testParseWithMapObjects($yaml, $value, $flags = Yaml::PARSE_OBJECT_FOR_MAP) { - $actual = \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse($yaml, $flags); - $this->assertSame(\serialize($value), \serialize($actual)); + $actual = Inline::parse($yaml, $flags); + $this->assertSame(serialize($value), serialize($actual)); } /** * @dataProvider getTestsForParsePhpConstants */ public function testParsePhpConstants($yaml, $value) { - $actual = \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse($yaml, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_CONSTANT); + $actual = Inline::parse($yaml, Yaml::PARSE_CONSTANT); $this->assertSame($value, $actual); } public function getTestsForParsePhpConstants() { - return [['!php/const Symfony\\Component\\Yaml\\Yaml::PARSE_CONSTANT', \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_CONSTANT], ['!php/const PHP_INT_MAX', \PHP_INT_MAX], ['[!php/const PHP_INT_MAX]', [\PHP_INT_MAX]], ['{ foo: !php/const PHP_INT_MAX }', ['foo' => \PHP_INT_MAX]], ['{ !php/const PHP_INT_MAX: foo }', [\PHP_INT_MAX => 'foo']], ['!php/const NULL', null]]; + return [['!php/const Symfony\\Component\\Yaml\\Yaml::PARSE_CONSTANT', Yaml::PARSE_CONSTANT], ['!php/const PHP_INT_MAX', PHP_INT_MAX], ['[!php/const PHP_INT_MAX]', [PHP_INT_MAX]], ['{ foo: !php/const PHP_INT_MAX }', ['foo' => PHP_INT_MAX]], ['{ !php/const PHP_INT_MAX: foo }', [PHP_INT_MAX => 'foo']], ['!php/const NULL', null]]; } public function testParsePhpConstantThrowsExceptionWhenUndefined() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\ParseException'); $this->expectExceptionMessage('The constant "WRONG_CONSTANT" is not defined'); - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse('!php/const WRONG_CONSTANT', \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_CONSTANT); + Inline::parse('!php/const WRONG_CONSTANT', Yaml::PARSE_CONSTANT); } public function testParsePhpConstantThrowsExceptionOnInvalidType() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\ParseException'); $this->expectExceptionMessageRegExp('#The string "!php/const PHP_INT_MAX" could not be parsed as a constant.*#'); - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse('!php/const PHP_INT_MAX', \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE); + Inline::parse('!php/const PHP_INT_MAX', Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE); } /** * @group legacy @@ -66,11 +82,11 @@ public function testParsePhpConstantThrowsExceptionOnInvalidType() */ public function testDeprecatedConstantTag($yaml, $expectedValue) { - $this->assertSame($expectedValue, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse($yaml, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_CONSTANT)); + $this->assertSame($expectedValue, Inline::parse($yaml, Yaml::PARSE_CONSTANT)); } public function getTestsForParseLegacyPhpConstants() { - return [['!php/const:Symfony\\Component\\Yaml\\Yaml::PARSE_CONSTANT', \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_CONSTANT], ['!php/const:PHP_INT_MAX', \PHP_INT_MAX], ['[!php/const:PHP_INT_MAX]', [\PHP_INT_MAX]], ['{ foo: !php/const:PHP_INT_MAX }', ['foo' => \PHP_INT_MAX]], ['{ !php/const:PHP_INT_MAX: foo }', [\PHP_INT_MAX => 'foo']], ['!php/const:NULL', null]]; + return [['!php/const:Symfony\\Component\\Yaml\\Yaml::PARSE_CONSTANT', Yaml::PARSE_CONSTANT], ['!php/const:PHP_INT_MAX', PHP_INT_MAX], ['[!php/const:PHP_INT_MAX]', [PHP_INT_MAX]], ['{ foo: !php/const:PHP_INT_MAX }', ['foo' => PHP_INT_MAX]], ['{ !php/const:PHP_INT_MAX: foo }', [PHP_INT_MAX => 'foo']], ['!php/const:NULL', null]]; } /** * @group legacy @@ -78,67 +94,67 @@ public function getTestsForParseLegacyPhpConstants() */ public function testParseWithMapObjectsPassingTrue($yaml, $value) { - $actual = \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse($yaml, \false, \false, \true); - $this->assertSame(\serialize($value), \serialize($actual)); + $actual = Inline::parse($yaml, false, false, true); + $this->assertSame(serialize($value), serialize($actual)); } /** * @dataProvider getTestsForDump */ public function testDump($yaml, $value, $parseFlags = 0) { - $this->assertEquals($yaml, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::dump($value), \sprintf('::dump() converts a PHP structure to an inline YAML (%s)', $yaml)); - $this->assertSame($value, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse(\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::dump($value), $parseFlags), 'check consistency'); + $this->assertEquals($yaml, Inline::dump($value), sprintf('::dump() converts a PHP structure to an inline YAML (%s)', $yaml)); + $this->assertSame($value, Inline::parse(Inline::dump($value), $parseFlags), 'check consistency'); } public function testDumpNumericValueWithLocale() { - $locale = \setlocale(\LC_NUMERIC, 0); - if (\false === $locale) { + $locale = setlocale(LC_NUMERIC, 0); + if (false === $locale) { $this->markTestSkipped('Your platform does not support locales.'); } try { $requiredLocales = ['fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252']; - if (\false === \setlocale(\LC_NUMERIC, $requiredLocales)) { - $this->markTestSkipped('Could not set any of required locales: ' . \implode(', ', $requiredLocales)); + if (false === setlocale(LC_NUMERIC, $requiredLocales)) { + $this->markTestSkipped('Could not set any of required locales: ' . implode(', ', $requiredLocales)); } - $this->assertEquals('1.2', \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::dump(1.2)); - $this->assertStringContainsStringIgnoringCase('fr', \setlocale(\LC_NUMERIC, 0)); + $this->assertEquals('1.2', Inline::dump(1.2)); + $this->assertStringContainsStringIgnoringCase('fr', setlocale(LC_NUMERIC, 0)); } finally { - \setlocale(\LC_NUMERIC, $locale); + setlocale(LC_NUMERIC, $locale); } } public function testHashStringsResemblingExponentialNumericsShouldNotBeChangedToINF() { $value = '686e444'; - $this->assertSame($value, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse(\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::dump($value))); + $this->assertSame($value, Inline::parse(Inline::dump($value))); } public function testParseScalarWithNonEscapedBlackslashShouldThrowException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\ParseException'); $this->expectExceptionMessage('Found unknown escape character "\\V".'); - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse('"Foo\\Var"'); + Inline::parse('"Foo\\Var"'); } public function testParseScalarWithNonEscapedBlackslashAtTheEndShouldThrowException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\ParseException'); - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse('"Foo\\"'); + Inline::parse('"Foo\\"'); } public function testParseScalarWithIncorrectlyQuotedStringShouldThrowException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\ParseException'); $value = "'don't do somthin' like that'"; - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse($value); + Inline::parse($value); } public function testParseScalarWithIncorrectlyDoubleQuotedStringShouldThrowException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\ParseException'); $value = '"don"t do somthin" like that"'; - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse($value); + Inline::parse($value); } public function testParseInvalidMappingKeyShouldThrowException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\ParseException'); $value = '{ "foo " bar": "bar" }'; - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse($value); + Inline::parse($value); } /** * @group legacy @@ -147,35 +163,35 @@ public function testParseInvalidMappingKeyShouldThrowException() */ public function testParseMappingKeyWithColonNotFollowedBySpace() { - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse('{1:""}'); + Inline::parse('{1:""}'); } public function testParseInvalidMappingShouldThrowException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\ParseException'); - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse('[foo] bar'); + Inline::parse('[foo] bar'); } public function testParseInvalidSequenceShouldThrowException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\ParseException'); - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse('{ foo: bar } bar'); + Inline::parse('{ foo: bar } bar'); } public function testParseInvalidTaggedSequenceShouldThrowException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\ParseException'); - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse('!foo { bar: baz } qux', \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_CUSTOM_TAGS); + Inline::parse('!foo { bar: baz } qux', Yaml::PARSE_CUSTOM_TAGS); } public function testParseScalarWithCorrectlyQuotedStringShouldReturnString() { $value = "'don''t do somthin'' like that'"; $expect = "don't do somthin' like that"; - $this->assertSame($expect, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parseScalar($value)); + $this->assertSame($expect, Inline::parseScalar($value)); } /** * @dataProvider getDataForParseReferences */ public function testParseReferences($yaml, $expected) { - $this->assertSame($expected, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse($yaml, 0, ['var' => 'var-value'])); + $this->assertSame($expected, Inline::parse($yaml, 0, ['var' => 'var-value'])); } /** * @group legacy @@ -183,7 +199,7 @@ public function testParseReferences($yaml, $expected) */ public function testParseReferencesAsFifthArgument($yaml, $expected) { - $this->assertSame($expected, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse($yaml, \false, \false, \false, ['var' => 'var-value'])); + $this->assertSame($expected, Inline::parse($yaml, false, false, false, ['var' => 'var-value'])); } public function getDataForParseReferences() { @@ -192,7 +208,7 @@ public function getDataForParseReferences() public function testParseMapReferenceInSequence() { $foo = ['a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian']; - $this->assertSame([$foo], \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse('[*foo]', 0, ['foo' => $foo])); + $this->assertSame([$foo], Inline::parse('[*foo]', 0, ['foo' => $foo])); } /** * @group legacy @@ -200,28 +216,28 @@ public function testParseMapReferenceInSequence() public function testParseMapReferenceInSequenceAsFifthArgument() { $foo = ['a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian']; - $this->assertSame([$foo], \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse('[*foo]', \false, \false, \false, ['foo' => $foo])); + $this->assertSame([$foo], Inline::parse('[*foo]', false, false, false, ['foo' => $foo])); } public function testParseUnquotedAsterisk() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\ParseException'); $this->expectExceptionMessage('A reference must contain at least one character at line 1.'); - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse('{ foo: * }'); + Inline::parse('{ foo: * }'); } public function testParseUnquotedAsteriskFollowedByAComment() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\ParseException'); $this->expectExceptionMessage('A reference must contain at least one character at line 1.'); - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse('{ foo: * #foo }'); + Inline::parse('{ foo: * #foo }'); } /** * @dataProvider getReservedIndicators */ public function testParseUnquotedScalarStartingWithReservedIndicator($indicator) { - $this->expectException(\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException::class); - $this->expectExceptionMessage(\sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo ").', $indicator)); - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse(\sprintf('{ foo: %sfoo }', $indicator)); + $this->expectException(ParseException::class); + $this->expectExceptionMessage(sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo ").', $indicator)); + Inline::parse(sprintf('{ foo: %sfoo }', $indicator)); } public function getReservedIndicators() { @@ -232,9 +248,9 @@ public function getReservedIndicators() */ public function testParseUnquotedScalarStartingWithScalarIndicator($indicator) { - $this->expectException(\_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException::class); - $this->expectExceptionMessage(\sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo ").', $indicator)); - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse(\sprintf('{ foo: %sfoo }', $indicator)); + $this->expectException(ParseException::class); + $this->expectExceptionMessage(sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo ").', $indicator)); + Inline::parse(sprintf('{ foo: %sfoo }', $indicator)); } public function getScalarIndicators() { @@ -247,26 +263,26 @@ public function getScalarIndicators() */ public function testParseUnquotedScalarStartingWithPercentCharacter() { - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse('{ foo: %bar }'); + Inline::parse('{ foo: %bar }'); } /** * @dataProvider getDataForIsHash */ public function testIsHash($array, $expected) { - $this->assertSame($expected, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::isHash($array)); + $this->assertSame($expected, Inline::isHash($array)); } public function getDataForIsHash() { - return [[[], \false], [[1, 2, 3], \false], [[2 => 1, 1 => 2, 0 => 3], \true], [['foo' => 1, 'bar' => 2], \true]]; + return [[[], false], [[1, 2, 3], false], [[2 => 1, 1 => 2, 0 => 3], true], [['foo' => 1, 'bar' => 2], true]]; } public function getTestsForParse() { return [ ['', ''], ['null', null], - ['false', \false], - ['true', \true], + ['false', false], + ['true', true], ['12', 12], ['-12', -12], ['1_2', 12], @@ -280,10 +296,10 @@ public function getTestsForParse() ['0x_4_D_2_', 0x4d2], ['02333', 02333], ['0_2_3_3_3', 02333], - ['.Inf', -\log(0)], - ['-.Inf', \log(0)], + ['.Inf', -log(0)], + ['-.Inf', log(0)], ["'686e444'", '686e444'], - ['686e444', \INF], + ['686e444', INF], ['123456789123456789123456789123456789', '123456789123456789123456789123456789'], ['"foo\\r\\nbar"', "foo\r\nbar"], ["'foo#bar'", 'foo#bar'], @@ -297,21 +313,21 @@ public function getTestsForParse() ["'no'", 'no'], ["'on'", 'on'], ["'off'", 'off'], - ['2007-10-30', \gmmktime(0, 0, 0, 10, 30, 2007)], - ['2007-10-30T02:59:43Z', \gmmktime(2, 59, 43, 10, 30, 2007)], - ['2007-10-30 02:59:43 Z', \gmmktime(2, 59, 43, 10, 30, 2007)], - ['1960-10-30 02:59:43 Z', \gmmktime(2, 59, 43, 10, 30, 1960)], - ['1730-10-30T02:59:43Z', \gmmktime(2, 59, 43, 10, 30, 1730)], + ['2007-10-30', gmmktime(0, 0, 0, 10, 30, 2007)], + ['2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)], + ['2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)], + ['1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)], + ['1730-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 1730)], ['"a \\"string\\" with \'quoted strings inside\'"', 'a "string" with \'quoted strings inside\''], ["'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''], // sequences // urls are no key value mapping. see #3609. Valid yaml "key: value" mappings require a space after the colon - ['[foo, http://urls.are/no/mappings, false, null, 12]', ['foo', 'http://urls.are/no/mappings', \false, null, 12]], - ['[ foo , bar , false , null , 12 ]', ['foo', 'bar', \false, null, 12]], + ['[foo, http://urls.are/no/mappings, false, null, 12]', ['foo', 'http://urls.are/no/mappings', false, null, 12]], + ['[ foo , bar , false , null , 12 ]', ['foo', 'bar', false, null, 12]], ['[\'foo,bar\', \'foo bar\']', ['foo,bar', 'foo bar']], // mappings - ['{foo: bar,bar: foo,"false": false, "null": null,integer: 12}', ['foo' => 'bar', 'bar' => 'foo', 'false' => \false, 'null' => null, 'integer' => 12]], - ['{ foo : bar, bar : foo, "false" : false, "null" : null, integer : 12 }', ['foo' => 'bar', 'bar' => 'foo', 'false' => \false, 'null' => null, 'integer' => 12]], + ['{foo: bar,bar: foo,"false": false, "null": null,integer: 12}', ['foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12]], + ['{ foo : bar, bar : foo, "false" : false, "null" : null, integer : 12 }', ['foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12]], ['{foo: \'bar\', bar: \'foo: bar\'}', ['foo' => 'bar', 'bar' => 'foo: bar']], ['{\'foo\': \'bar\', "bar": \'foo: bar\'}', ['foo' => 'bar', 'bar' => 'foo: bar']], ['{\'foo\'\'\': \'bar\', "bar\\"": \'foo: bar\'}', ['foo\'' => 'bar', 'bar"' => 'foo: bar']], @@ -330,7 +346,7 @@ public function getTestsForParse() ['[foo, [bar, [foo, [bar, foo]], foo]]', ['foo', ['bar', ['foo', ['bar', 'foo']], 'foo']]], ['[foo, {bar: foo, foo: [foo, {bar: foo}]}, [foo, {bar: foo}]]', ['foo', ['bar' => 'foo', 'foo' => ['foo', ['bar' => 'foo']]], ['foo', ['bar' => 'foo']]]], ['[foo, bar: { foo: bar }]', ['foo', '1' => ['bar' => ['foo' => 'bar']]]], - ['[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', ['foo', '@foo.baz', ['%foo%' => 'foo is %foo%', 'bar' => '%foo%'], \true, '@service_container']], + ['[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', ['foo', '@foo.baz', ['%foo%' => 'foo is %foo%', 'bar' => '%foo%'], true, '@service_container']], ]; } public function getTestsForParseWithMapObjects() @@ -338,8 +354,8 @@ public function getTestsForParseWithMapObjects() return [ ['', ''], ['null', null], - ['false', \false], - ['true', \true], + ['false', false], + ['true', true], ['12', 12], ['-12', -12], ['"quoted string"', 'quoted string'], @@ -347,31 +363,31 @@ public function getTestsForParseWithMapObjects() ['12.30e+02', 1230.0], ['0x4D2', 0x4d2], ['02333', 02333], - ['.Inf', -\log(0)], - ['-.Inf', \log(0)], + ['.Inf', -log(0)], + ['-.Inf', log(0)], ["'686e444'", '686e444'], - ['686e444', \INF], + ['686e444', INF], ['123456789123456789123456789123456789', '123456789123456789123456789123456789'], ['"foo\\r\\nbar"', "foo\r\nbar"], ["'foo#bar'", 'foo#bar'], ["'foo # bar'", 'foo # bar'], ["'#cfcfcf'", '#cfcfcf'], ['::form_base.html.twig', '::form_base.html.twig'], - ['2007-10-30', \gmmktime(0, 0, 0, 10, 30, 2007)], - ['2007-10-30T02:59:43Z', \gmmktime(2, 59, 43, 10, 30, 2007)], - ['2007-10-30 02:59:43 Z', \gmmktime(2, 59, 43, 10, 30, 2007)], - ['1960-10-30 02:59:43 Z', \gmmktime(2, 59, 43, 10, 30, 1960)], - ['1730-10-30T02:59:43Z', \gmmktime(2, 59, 43, 10, 30, 1730)], + ['2007-10-30', gmmktime(0, 0, 0, 10, 30, 2007)], + ['2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)], + ['2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)], + ['1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)], + ['1730-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 1730)], ['"a \\"string\\" with \'quoted strings inside\'"', 'a "string" with \'quoted strings inside\''], ["'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''], // sequences // urls are no key value mapping. see #3609. Valid yaml "key: value" mappings require a space after the colon - ['[foo, http://urls.are/no/mappings, false, null, 12]', ['foo', 'http://urls.are/no/mappings', \false, null, 12]], - ['[ foo , bar , false , null , 12 ]', ['foo', 'bar', \false, null, 12]], + ['[foo, http://urls.are/no/mappings, false, null, 12]', ['foo', 'http://urls.are/no/mappings', false, null, 12]], + ['[ foo , bar , false , null , 12 ]', ['foo', 'bar', false, null, 12]], ['[\'foo,bar\', \'foo bar\']', ['foo,bar', 'foo bar']], // mappings - ['{foo: bar,bar: foo,"false": false,"null": null,integer: 12}', (object) ['foo' => 'bar', 'bar' => 'foo', 'false' => \false, 'null' => null, 'integer' => 12], \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_OBJECT_FOR_MAP], - ['{ foo : bar, bar : foo, "false" : false, "null" : null, integer : 12 }', (object) ['foo' => 'bar', 'bar' => 'foo', 'false' => \false, 'null' => null, 'integer' => 12], \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_OBJECT_FOR_MAP], + ['{foo: bar,bar: foo,"false": false,"null": null,integer: 12}', (object) ['foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12], Yaml::PARSE_OBJECT_FOR_MAP], + ['{ foo : bar, bar : foo, "false" : false, "null" : null, integer : 12 }', (object) ['foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12], Yaml::PARSE_OBJECT_FOR_MAP], ['{foo: \'bar\', bar: \'foo: bar\'}', (object) ['foo' => 'bar', 'bar' => 'foo: bar']], ['{\'foo\': \'bar\', "bar": \'foo: bar\'}', (object) ['foo' => 'bar', 'bar' => 'foo: bar']], ['{\'foo\'\'\': \'bar\', "bar\\"": \'foo: bar\'}', (object) ['foo\'' => 'bar', 'bar"' => 'foo: bar']], @@ -388,25 +404,25 @@ public function getTestsForParseWithMapObjects() ['[foo, [bar, [foo, [bar, foo]], foo]]', ['foo', ['bar', ['foo', ['bar', 'foo']], 'foo']]], ['[foo, {bar: foo, foo: [foo, {bar: foo}]}, [foo, {bar: foo}]]', ['foo', (object) ['bar' => 'foo', 'foo' => ['foo', (object) ['bar' => 'foo']]], ['foo', (object) ['bar' => 'foo']]]], ['[foo, bar: { foo: bar }]', ['foo', '1' => (object) ['bar' => (object) ['foo' => 'bar']]]], - ['[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', ['foo', '@foo.baz', (object) ['%foo%' => 'foo is %foo%', 'bar' => '%foo%'], \true, '@service_container']], - ['{}', new \stdClass()], - ['{ foo : bar, bar : {} }', (object) ['foo' => 'bar', 'bar' => new \stdClass()]], - ['{ foo : [], bar : {} }', (object) ['foo' => [], 'bar' => new \stdClass()]], - ['{foo: \'bar\', bar: {} }', (object) ['foo' => 'bar', 'bar' => new \stdClass()]], - ['{\'foo\': \'bar\', "bar": {}}', (object) ['foo' => 'bar', 'bar' => new \stdClass()]], + ['[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', ['foo', '@foo.baz', (object) ['%foo%' => 'foo is %foo%', 'bar' => '%foo%'], true, '@service_container']], + ['{}', new stdClass()], + ['{ foo : bar, bar : {} }', (object) ['foo' => 'bar', 'bar' => new stdClass()]], + ['{ foo : [], bar : {} }', (object) ['foo' => [], 'bar' => new stdClass()]], + ['{foo: \'bar\', bar: {} }', (object) ['foo' => 'bar', 'bar' => new stdClass()]], + ['{\'foo\': \'bar\', "bar": {}}', (object) ['foo' => 'bar', 'bar' => new stdClass()]], ['{\'foo\': \'bar\', "bar": \'{}\'}', (object) ['foo' => 'bar', 'bar' => '{}']], - ['[foo, [{}, {}]]', ['foo', [new \stdClass(), new \stdClass()]]], - ['[foo, [[], {}]]', ['foo', [[], new \stdClass()]]], - ['[foo, [[{}, {}], {}]]', ['foo', [[new \stdClass(), new \stdClass()], new \stdClass()]]], - ['[foo, {bar: {}}]', ['foo', '1' => (object) ['bar' => new \stdClass()]]], + ['[foo, [{}, {}]]', ['foo', [new stdClass(), new stdClass()]]], + ['[foo, [[], {}]]', ['foo', [[], new stdClass()]]], + ['[foo, [[{}, {}], {}]]', ['foo', [[new stdClass(), new stdClass()], new stdClass()]]], + ['[foo, {bar: {}}]', ['foo', '1' => (object) ['bar' => new stdClass()]]], ]; } public function getTestsForDump() { return [ ['null', null], - ['false', \false], - ['true', \true], + ['false', false], + ['true', true], ['12', 12], ["'1_2'", '1_2'], ['_12', '_12'], @@ -417,8 +433,8 @@ public function getTestsForDump() ['1243', 02333], ["'0x_4_D_2_'", '0x_4_D_2_'], ["'0_2_3_3_3'", '0_2_3_3_3'], - ['.Inf', -\log(0)], - ['-.Inf', \log(0)], + ['.Inf', -log(0)], + ['-.Inf', log(0)], ["'686e444'", '686e444'], ['"foo\\r\\nbar"', "foo\r\nbar"], ["'foo#bar'", 'foo#bar'], @@ -435,10 +451,10 @@ public function getTestsForDump() ["'on'", 'on'], ["'off'", 'off'], // sequences - ['[foo, bar, false, null, 12]', ['foo', 'bar', \false, null, 12]], + ['[foo, bar, false, null, 12]', ['foo', 'bar', false, null, 12]], ['[\'foo,bar\', \'foo bar\']', ['foo,bar', 'foo bar']], // mappings - ['{ foo: bar, bar: foo, \'false\': false, \'null\': null, integer: 12 }', ['foo' => 'bar', 'bar' => 'foo', 'false' => \false, 'null' => null, 'integer' => 12]], + ['{ foo: bar, bar: foo, \'false\': false, \'null\': null, integer: 12 }', ['foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12]], ['{ foo: bar, bar: \'foo: bar\' }', ['foo' => 'bar', 'bar' => 'foo: bar']], // nested sequences and mappings ['[foo, [bar, foo]]', ['foo', ['bar', 'foo']]], @@ -446,7 +462,7 @@ public function getTestsForDump() ['{ foo: { bar: foo } }', ['foo' => ['bar' => 'foo']]], ['[foo, { bar: foo }]', ['foo', ['bar' => 'foo']]], ['[foo, { bar: foo, foo: [foo, { bar: foo }] }, [foo, { bar: foo }]]', ['foo', ['bar' => 'foo', 'foo' => ['foo', ['bar' => 'foo']]], ['foo', ['bar' => 'foo']]]], - ['[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', ['foo', '@foo.baz', ['%foo%' => 'foo is %foo%', 'bar' => '%foo%'], \true, '@service_container']], + ['[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', ['foo', '@foo.baz', ['%foo%' => 'foo is %foo%', 'bar' => '%foo%'], true, '@service_container']], ['{ foo: { bar: { 1: 2, baz: 3 } } }', ['foo' => ['bar' => [1 => 2, 'baz' => 3]]]], ]; } @@ -455,22 +471,22 @@ public function getTestsForDump() */ public function testParseTimestampAsUnixTimestampByDefault($yaml, $year, $month, $day, $hour, $minute, $second) { - $this->assertSame(\gmmktime($hour, $minute, $second, $month, $day, $year), \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse($yaml)); + $this->assertSame(gmmktime($hour, $minute, $second, $month, $day, $year), Inline::parse($yaml)); } /** * @dataProvider getTimestampTests */ public function testParseTimestampAsDateTimeObject($yaml, $year, $month, $day, $hour, $minute, $second, $timezone) { - $expected = new \DateTime($yaml); - $expected->setTimeZone(new \DateTimeZone('UTC')); + $expected = new DateTime($yaml); + $expected->setTimeZone(new DateTimeZone('UTC')); $expected->setDate($year, $month, $day); - if (\PHP_VERSION_ID >= 70100) { + if (PHP_VERSION_ID >= 70100) { $expected->setTime($hour, $minute, $second, 1000000 * ($second - (int) $second)); } else { $expected->setTime($hour, $minute, $second); } - $date = \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse($yaml, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_DATETIME); + $date = Inline::parse($yaml, Yaml::PARSE_DATETIME); $this->assertEquals($expected, $date); $this->assertSame($timezone, $date->format('O')); } @@ -483,31 +499,31 @@ public function getTimestampTests() */ public function testParseNestedTimestampListAsDateTimeObject($yaml, $year, $month, $day, $hour, $minute, $second) { - $expected = new \DateTime($yaml); - $expected->setTimeZone(new \DateTimeZone('UTC')); + $expected = new DateTime($yaml); + $expected->setTimeZone(new DateTimeZone('UTC')); $expected->setDate($year, $month, $day); - if (\PHP_VERSION_ID >= 70100) { + if (PHP_VERSION_ID >= 70100) { $expected->setTime($hour, $minute, $second, 1000000 * ($second - (int) $second)); } else { $expected->setTime($hour, $minute, $second); } $expectedNested = ['nested' => [$expected]]; $yamlNested = "{nested: [{$yaml}]}"; - $this->assertEquals($expectedNested, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse($yamlNested, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_DATETIME)); + $this->assertEquals($expectedNested, Inline::parse($yamlNested, Yaml::PARSE_DATETIME)); } /** * @dataProvider getDateTimeDumpTests */ public function testDumpDateTime($dateTime, $expected) { - $this->assertSame($expected, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::dump($dateTime)); + $this->assertSame($expected, Inline::dump($dateTime)); } public function getDateTimeDumpTests() { $tests = []; - $dateTime = new \DateTime('2001-12-15 21:59:43', new \DateTimeZone('UTC')); + $dateTime = new DateTime('2001-12-15 21:59:43', new DateTimeZone('UTC')); $tests['date-time-utc'] = [$dateTime, '2001-12-15T21:59:43+00:00']; - $dateTime = new \DateTimeImmutable('2001-07-15 21:59:43', new \DateTimeZone('Europe/Berlin')); + $dateTime = new DateTimeImmutable('2001-07-15 21:59:43', new DateTimeZone('Europe/Berlin')); $tests['immutable-date-time-europe-berlin'] = [$dateTime, '2001-07-15T21:59:43+02:00']; return $tests; } @@ -516,7 +532,7 @@ public function getDateTimeDumpTests() */ public function testParseBinaryData($data) { - $this->assertSame('Hello world', \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse($data)); + $this->assertSame('Hello world', Inline::parse($data)); } public function getBinaryData() { @@ -529,7 +545,7 @@ public function testParseInvalidBinaryData($data, $expectedMessage) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\ParseException'); $this->expectExceptionMessageRegExp($expectedMessage); - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse($data); + Inline::parse($data); } public function getInvalidBinaryData() { @@ -539,13 +555,13 @@ public function testNotSupportedMissingValue() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\ParseException'); $this->expectExceptionMessage('Malformed inline YAML string: "{this, is not, supported}" at line 1.'); - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse('{this, is not, supported}'); + Inline::parse('{this, is not, supported}'); } public function testVeryLongQuotedStrings() { - $longStringWithQuotes = \str_repeat("x\r\n\\\"x\"x", 1000); - $yamlString = \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::dump(['longStringWithQuotes' => $longStringWithQuotes]); - $arrayFromYaml = \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse($yamlString); + $longStringWithQuotes = str_repeat("x\r\n\\\"x\"x", 1000); + $yamlString = Inline::dump(['longStringWithQuotes' => $longStringWithQuotes]); + $arrayFromYaml = Inline::parse($yamlString); $this->assertEquals($longStringWithQuotes, $arrayFromYaml['longStringWithQuotes']); } /** @@ -554,14 +570,14 @@ public function testVeryLongQuotedStrings() */ public function testOmittedMappingKeyIsParsedAsColon() { - $this->assertSame([':' => 'foo'], \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse('{: foo}')); + $this->assertSame([':' => 'foo'], Inline::parse('{: foo}')); } /** * @dataProvider getTestsForNullValues */ public function testParseMissingMappingValueAsNull($yaml, $expected) { - $this->assertSame($expected, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse($yaml)); + $this->assertSame($expected, Inline::parse($yaml)); } public function getTestsForNullValues() { @@ -569,7 +585,7 @@ public function getTestsForNullValues() } public function testTheEmptyStringIsAValidMappingKey() { - $this->assertSame(['' => 'foo'], \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse('{ "": foo }')); + $this->assertSame(['' => 'foo'], Inline::parse('{ "": foo }')); } /** * @group legacy @@ -578,7 +594,7 @@ public function testTheEmptyStringIsAValidMappingKey() */ public function testImplicitStringCastingOfMappingKeysIsDeprecated($yaml, $expected) { - $this->assertSame($expected, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse($yaml)); + $this->assertSame($expected, Inline::parse($yaml)); } /** * @group legacy @@ -588,7 +604,7 @@ public function testImplicitStringCastingOfMappingKeysIsDeprecated($yaml, $expec */ public function testExplicitStringCastingOfMappingKeys($yaml, $expected) { - $this->assertSame($expected, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::parse($yaml, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_KEYS_AS_STRINGS)); + $this->assertSame($expected, Yaml::parse($yaml, Yaml::PARSE_KEYS_AS_STRINGS)); } public function getNotPhpCompatibleMappingKeyData() { @@ -600,20 +616,20 @@ public function getNotPhpCompatibleMappingKeyData() */ public function testDeprecatedStrTag() { - $this->assertSame(['foo' => 'bar'], \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse('{ foo: !str bar }')); + $this->assertSame(['foo' => 'bar'], Inline::parse('{ foo: !str bar }')); } public function testUnfinishedInlineMap() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\ParseException'); $this->expectExceptionMessage('Unexpected end of line, expected one of ",}" at line 1 (near "{abc: \'def\'").'); - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse("{abc: 'def'"); + Inline::parse("{abc: 'def'"); } /** * @dataProvider getTestsForOctalNumbers */ public function testParseOctalNumbers($expected, $yaml) { - self::assertSame($expected, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse($yaml)); + self::assertSame($expected, Inline::parse($yaml)); } public function getTestsForOctalNumbers() { @@ -624,18 +640,18 @@ public function getTestsForOctalNumbers() */ public function testPhpObjectWithEmptyValue($expected, $value) { - $this->assertSame($expected, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse($value, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_OBJECT)); + $this->assertSame($expected, Inline::parse($value, Yaml::PARSE_OBJECT)); } public function phpObjectTagWithEmptyValueProvider() { - return [[\false, '!php/object'], [\false, '!php/object '], [\false, '!php/object '], [[\false], '[!php/object]'], [[\false], '[!php/object ]'], [[\false, 'foo'], '[!php/object , foo]']]; + return [[false, '!php/object'], [false, '!php/object '], [false, '!php/object '], [[false], '[!php/object]'], [[false], '[!php/object ]'], [[false, 'foo'], '[!php/object , foo]']]; } /** * @dataProvider phpConstTagWithEmptyValueProvider */ public function testPhpConstTagWithEmptyValue($expected, $value) { - $this->assertSame($expected, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Inline::parse($value, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_CONSTANT)); + $this->assertSame($expected, Inline::parse($value, Yaml::PARSE_CONSTANT)); } public function phpConstTagWithEmptyValueProvider() { diff --git a/vendor/symfony/yaml/Tests/ParseExceptionTest.php b/vendor/symfony/yaml/Tests/ParseExceptionTest.php index b6a251998..ba090edab 100644 --- a/vendor/symfony/yaml/Tests/ParseExceptionTest.php +++ b/vendor/symfony/yaml/Tests/ParseExceptionTest.php @@ -12,17 +12,17 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException; -class ParseExceptionTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class ParseExceptionTest extends TestCase { public function testGetMessage() { - $exception = new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException('Error message', 42, 'foo: bar', '/var/www/app/config.yml'); + $exception = new ParseException('Error message', 42, 'foo: bar', '/var/www/app/config.yml'); $message = 'Error message in "/var/www/app/config.yml" at line 42 (near "foo: bar")'; $this->assertEquals($message, $exception->getMessage()); } public function testGetMessageWithUnicodeInFilename() { - $exception = new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException('Error message', 42, 'foo: bar', 'äöü.yml'); + $exception = new ParseException('Error message', 42, 'foo: bar', 'äöü.yml'); $message = 'Error message in "äöü.yml" at line 42 (near "foo: bar")'; $this->assertEquals($message, $exception->getMessage()); } diff --git a/vendor/symfony/yaml/Tests/ParserTest.php b/vendor/symfony/yaml/Tests/ParserTest.php index f2fc03105..454fe895e 100644 --- a/vendor/symfony/yaml/Tests/ParserTest.php +++ b/vendor/symfony/yaml/Tests/ParserTest.php @@ -14,18 +14,40 @@ use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser; use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue; use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml; -class ParserTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +use DateTime; +use DateTimeZone; +use Exception; +use stdClass; +use function call_user_func_array; +use function chmod; +use function file_get_contents; +use function func_get_args; +use function getenv; +use function iconv; +use function implode; +use function preg_split; +use function restore_error_handler; +use function set_error_handler; +use function sprintf; +use function str_repeat; +use function strpbrk; +use function trim; +use function var_export; +use const DIRECTORY_SEPARATOR; +use const E_USER_DEPRECATED; + +class ParserTest extends TestCase { /** @var Parser */ protected $parser; protected function setUp() { - $this->parser = new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser(); + $this->parser = new Parser(); } protected function tearDown() { $this->parser = null; - \chmod(__DIR__ . '/Fixtures/not_readable.yml', 0644); + chmod(__DIR__ . '/Fixtures/not_readable.yml', 0644); } /** * @dataProvider getDataFormSpecifications @@ -34,20 +56,20 @@ public function testSpecifications($expected, $yaml, $comment, $deprecated) { $deprecations = []; if ($deprecated) { - \set_error_handler(function ($type, $msg) use(&$deprecations) { - if (\E_USER_DEPRECATED !== $type) { - \restore_error_handler(); - return \call_user_func_array('PHPUnit\\Util\\ErrorHandler::handleError', \func_get_args()); + set_error_handler(function ($type, $msg) use(&$deprecations) { + if (E_USER_DEPRECATED !== $type) { + restore_error_handler(); + return call_user_func_array('PHPUnit\\Util\\ErrorHandler::handleError', func_get_args()); } $deprecations[] = $msg; return null; }); } - $this->assertEquals($expected, \var_export($this->parser->parse($yaml), \true), $comment); + $this->assertEquals($expected, var_export($this->parser->parse($yaml), true), $comment); if ($deprecated) { - \restore_error_handler(); + restore_error_handler(); $this->assertCount(1, $deprecations); - $this->assertStringContainsString(\true !== $deprecated ? $deprecated : 'Using the comma as a group separator for floats is deprecated since Symfony 3.2 and will be removed in 4.0 on line 1.', $deprecations[0]); + $this->assertStringContainsString(true !== $deprecated ? $deprecated : 'Using the comma as a group separator for floats is deprecated since Symfony 3.2 and will be removed in 4.0 on line 1.', $deprecations[0]); } } public function getDataFormSpecifications() @@ -61,7 +83,7 @@ public function getDataFormSpecifications() */ public function testNonStringMappingKeys($expected, $yaml, $comment) { - $this->assertSame($expected, \var_export($this->parser->parse($yaml, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_KEYS_AS_STRINGS), \true), $comment); + $this->assertSame($expected, var_export($this->parser->parse($yaml, Yaml::PARSE_KEYS_AS_STRINGS), true), $comment); } public function getNonStringMappingKeysData() { @@ -73,7 +95,7 @@ public function getNonStringMappingKeysData() */ public function testLegacyNonStringMappingKeys($expected, $yaml, $comment) { - $this->assertSame($expected, \var_export($this->parser->parse($yaml), \true), $comment); + $this->assertSame($expected, var_export($this->parser->parse($yaml), true), $comment); } public function getLegacyNonStringMappingKeysData() { @@ -87,9 +109,9 @@ public function testTabsInYaml() try { $this->parser->parse($yaml); $this->fail('YAML files must not contain tabs'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertInstanceOf('\\Exception', $e, 'YAML files must not contain tabs'); - $this->assertEquals('A YAML file cannot contain tabs as indentation at line 2 (near "' . \strpbrk($yaml, "\t") . '").', $e->getMessage(), 'YAML files must not contain tabs'); + $this->assertEquals('A YAML file cannot contain tabs as indentation at line 2 (near "' . strpbrk($yaml, "\t") . '").', $e->getMessage(), 'YAML files must not contain tabs'); } } } @@ -357,7 +379,7 @@ public function testObjectSupportEnabled() foo: !php/object O:30:"Symfony\Component\Yaml\Tests\B":1:{s:1:"b";s:3:"foo";} bar: 1 EOF; - $this->assertEquals(['foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tests\B(), 'bar' => 1], $this->parser->parse($input, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_OBJECT), '->parse() is able to parse objects'); + $this->assertEquals(['foo' => new B(), 'bar' => 1], $this->parser->parse($input, Yaml::PARSE_OBJECT), '->parse() is able to parse objects'); } /** * @group legacy @@ -368,7 +390,7 @@ public function testObjectSupportEnabledPassingTrue() foo: !php/object:O:30:"Symfony\Component\Yaml\Tests\B":1:{s:1:"b";s:3:"foo";} bar: 1 EOF; - $this->assertEquals(['foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tests\B(), 'bar' => 1], $this->parser->parse($input, \false, \true), '->parse() is able to parse objects'); + $this->assertEquals(['foo' => new B(), 'bar' => 1], $this->parser->parse($input, false, true), '->parse() is able to parse objects'); } /** * @group legacy @@ -376,7 +398,7 @@ public function testObjectSupportEnabledPassingTrue() */ public function testObjectSupportEnabledWithDeprecatedTag($yaml) { - $this->assertEquals(['foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tests\B(), 'bar' => 1], $this->parser->parse($yaml, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_OBJECT), '->parse() is able to parse objects'); + $this->assertEquals(['foo' => new B(), 'bar' => 1], $this->parser->parse($yaml, Yaml::PARSE_OBJECT), '->parse() is able to parse objects'); } public function deprecatedObjectValueProvider() { @@ -402,7 +424,7 @@ public function testObjectSupportDisabledButNoExceptions($input) */ public function testObjectForMap($yaml, $expected) { - $flags = \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_OBJECT_FOR_MAP; + $flags = Yaml::PARSE_OBJECT_FOR_MAP; $this->assertEquals($expected, $this->parser->parse($yaml, $flags)); } /** @@ -411,7 +433,7 @@ public function testObjectForMap($yaml, $expected) */ public function testObjectForMapEnabledWithMappingUsingBooleanToggles($yaml, $expected) { - $this->assertEquals($expected, $this->parser->parse($yaml, \false, \false, \true)); + $this->assertEquals($expected, $this->parser->parse($yaml, false, false, true)); } public function getObjectForMapTests() { @@ -420,17 +442,17 @@ public function getObjectForMapTests() foo: fiz: [cat] EOF; - $expected = new \stdClass(); - $expected->foo = new \stdClass(); + $expected = new stdClass(); + $expected->foo = new stdClass(); $expected->foo->fiz = ['cat']; $tests['mapping'] = [$yaml, $expected]; $yaml = '{ "foo": "bar", "fiz": "cat" }'; - $expected = new \stdClass(); + $expected = new stdClass(); $expected->foo = 'bar'; $expected->fiz = 'cat'; $tests['inline-mapping'] = [$yaml, $expected]; $yaml = "foo: bar\nbaz: foobar"; - $expected = new \stdClass(); + $expected = new stdClass(); $expected->foo = 'bar'; $expected->baz = 'foobar'; $tests['object-for-map-is-applied-after-parsing'] = [$yaml, $expected]; @@ -439,11 +461,11 @@ public function getObjectForMapTests() - key: one - key: two EOT; - $expected = new \stdClass(); + $expected = new stdClass(); $expected->array = []; - $expected->array[0] = new \stdClass(); + $expected->array[0] = new stdClass(); $expected->array[0]->key = 'one'; - $expected->array[1] = new \stdClass(); + $expected->array[1] = new stdClass(); $expected->array[1]->key = 'two'; $tests['nest-map-and-sequence'] = [$yaml, $expected]; $yaml = <<<'YAML' @@ -451,8 +473,8 @@ public function getObjectForMapTests() 1: one 2: two YAML; - $expected = new \stdClass(); - $expected->map = new \stdClass(); + $expected = new stdClass(); + $expected->map = new stdClass(); $expected->map->{1} = 'one'; $expected->map->{2} = 'two'; $tests['numeric-keys'] = [$yaml, $expected]; @@ -461,8 +483,8 @@ public function getObjectForMapTests() '0': one '1': two YAML; - $expected = new \stdClass(); - $expected->map = new \stdClass(); + $expected = new stdClass(); + $expected->map = new stdClass(); $expected->map->{0} = 'one'; $expected->map->{1} = 'two'; $tests['zero-indexed-numeric-keys'] = [$yaml, $expected]; @@ -474,7 +496,7 @@ public function getObjectForMapTests() public function testObjectsSupportDisabledWithExceptions($yaml) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\ParseException'); - $this->parser->parse($yaml, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE); + $this->parser->parse($yaml, Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE); } public function testCanParseContentWithTrailingSpaces() { @@ -489,7 +511,7 @@ public function testCanParseContentWithTrailingSpaces() public function testObjectsSupportDisabledWithExceptionsUsingBooleanToggles($yaml) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\ParseException'); - $this->parser->parse($yaml, \true); + $this->parser->parse($yaml, true); } public function invalidDumpedObjectProvider() { @@ -508,12 +530,12 @@ public function invalidDumpedObjectProvider() */ public function testNonUtf8Exception() { - $yamls = [\iconv('UTF-8', 'ISO-8859-1', "foo: 'äöüß'"), \iconv('UTF-8', 'ISO-8859-15', "euro: '€'"), \iconv('UTF-8', 'CP1252', "cp1252: '©ÉÇáñ'")]; + $yamls = [iconv('UTF-8', 'ISO-8859-1', "foo: 'äöüß'"), iconv('UTF-8', 'ISO-8859-15', "euro: '€'"), iconv('UTF-8', 'CP1252', "cp1252: '©ÉÇáñ'")]; foreach ($yamls as $yaml) { try { $this->parser->parse($yaml); $this->fail('charsets other than UTF-8 are rejected.'); - } catch (\Exception $e) { + } catch (Exception $e) { $this->assertInstanceOf('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\ParseException', $e, 'charsets other than UTF-8 are rejected.'); } } @@ -547,7 +569,7 @@ public function testMultipleDocumentsNotSupportedException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\ParseException'); $this->expectExceptionMessageRegExp('/^Multiple documents are not supported.+/'); - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::parse(<<<'EOL' + Yaml::parse(<<<'EOL' # Ranking of 1998 home runs --- - Mark McGwire @@ -564,7 +586,7 @@ public function testMultipleDocumentsNotSupportedException() public function testSequenceInAMapping() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\ParseException'); - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::parse(<<<'EOF' + Yaml::parse(<<<'EOF' yaml: hash: me - array stuff @@ -661,7 +683,7 @@ public function testMultiLineStringLastResortParsing() public function testMappingInASequence() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\ParseException'); - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::parse(<<<'EOF' + Yaml::parse(<<<'EOF' yaml: - array stuff hash: me @@ -672,7 +694,7 @@ public function testScalarInSequence() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\ParseException'); $this->expectExceptionMessage('missing colon'); - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::parse(<<<'EOF' + Yaml::parse(<<<'EOF' foo: - bar "missing colon" @@ -702,7 +724,7 @@ public function testMappingDuplicateKeyBlock() child: duplicate EOD; $expected = ['parent' => ['child' => 'first']]; - $this->assertSame($expected, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::parse($input)); + $this->assertSame($expected, Yaml::parse($input)); } /** * @group legacy @@ -714,7 +736,7 @@ public function testMappingDuplicateKeyFlow() parent: { child: duplicate, child: duplicate } EOD; $expected = ['parent' => ['child' => 'first']]; - $this->assertSame($expected, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::parse($input)); + $this->assertSame($expected, Yaml::parse($input)); } /** * @group legacy @@ -724,7 +746,7 @@ public function testMappingDuplicateKeyFlow() */ public function testParseExceptionOnDuplicate($input, $duplicateKey, $lineNumber) { - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::parse($input); + Yaml::parse($input); } public function getParseExceptionOnDuplicateData() { @@ -779,11 +801,11 @@ public function testEmptyValue() $input = <<<'EOF' hash: EOF; - $this->assertEquals(['hash' => null], \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::parse($input)); + $this->assertEquals(['hash' => null], Yaml::parse($input)); } public function testCommentAtTheRootIndent() { - $this->assertEquals(['services' => ['app.foo_service' => ['class' => 'Foo'], 'app/bar_service' => ['class' => 'Bar']]], \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::parse(<<<'EOF' + $this->assertEquals(['services' => ['app.foo_service' => ['class' => 'Foo'], 'app/bar_service' => ['class' => 'Bar']]], Yaml::parse(<<<'EOF' # comment 1 services: # comment 2 @@ -810,7 +832,7 @@ public function testStringBlockWithComments() footer # comment3 EOT -], \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::parse(<<<'EOF' +], Yaml::parse(<<<'EOF' content: | # comment 1 header @@ -837,7 +859,7 @@ public function testFoldedStringBlockWithComments() footer # comment3 EOT -]], \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::parse(<<<'EOF' +]], Yaml::parse(<<<'EOF' - content: | # comment 1 @@ -865,7 +887,7 @@ public function testNestedFoldedStringBlockWithComments() footer # comment3 EOT -]], \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::parse(<<<'EOF' +]], Yaml::parse(<<<'EOF' - title: some title content: | @@ -883,7 +905,7 @@ public function testNestedFoldedStringBlockWithComments() } public function testReferenceResolvingInInlineStrings() { - $this->assertEquals(['var' => 'var-value', 'scalar' => 'var-value', 'list' => ['var-value'], 'list_in_list' => [['var-value']], 'map_in_list' => [['key' => 'var-value']], 'embedded_mapping' => [['key' => 'var-value']], 'map' => ['key' => 'var-value'], 'list_in_map' => ['key' => ['var-value']], 'map_in_map' => ['foo' => ['bar' => 'var-value']]], \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::parse(<<<'EOF' + $this->assertEquals(['var' => 'var-value', 'scalar' => 'var-value', 'list' => ['var-value'], 'list_in_list' => [['var-value']], 'map_in_list' => [['key' => 'var-value']], 'embedded_mapping' => [['key' => 'var-value']], 'map' => ['key' => 'var-value'], 'list_in_map' => ['key' => ['var-value']], 'map_in_map' => ['foo' => ['bar' => 'var-value']]], Yaml::parse(<<<'EOF' var: &var var-value scalar: *var list: [ *var ] @@ -1151,11 +1173,11 @@ public function testParseDateAsMappingValue() $yaml = <<<'EOT' date: 2002-12-14 EOT; - $expectedDate = new \DateTime(); - $expectedDate->setTimeZone(new \DateTimeZone('UTC')); + $expectedDate = new DateTime(); + $expectedDate->setTimeZone(new DateTimeZone('UTC')); $expectedDate->setDate(2002, 12, 14); $expectedDate->setTime(0, 0, 0); - $this->assertEquals(['date' => $expectedDate], $this->parser->parse($yaml, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_DATETIME)); + $this->assertEquals(['date' => $expectedDate], $this->parser->parse($yaml, Yaml::PARSE_DATETIME)); } /** * @param $lineNumber @@ -1165,7 +1187,7 @@ public function testParseDateAsMappingValue() public function testParserThrowsExceptionWithCorrectLineNumber($lineNumber, $yaml) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\ParseException'); - $this->expectExceptionMessage(\sprintf('Unexpected characters near "," at line %d (near "bar: "123",").', $lineNumber)); + $this->expectExceptionMessage(sprintf('Unexpected characters near "," at line %d (near "bar: "123",").', $lineNumber)); $this->parser->parse($yaml); } public function parserThrowsExceptionWithCorrectLineNumberProvider() @@ -1282,60 +1304,60 @@ public function multiLineDataProvider() three EOF; $expected = ['foo' => [['bar' => "one\ntwo three"]]]; - $tests[] = [$yaml, $expected, \false]; + $tests[] = [$yaml, $expected, false]; $yaml = <<<'EOF' bar "foo" EOF; $expected = 'bar "foo"'; - $tests[] = [$yaml, $expected, \false]; + $tests[] = [$yaml, $expected, false]; $yaml = <<<'EOF' bar "foo EOF; $expected = 'bar "foo'; - $tests[] = [$yaml, $expected, \false]; + $tests[] = [$yaml, $expected, false]; $yaml = <<<'EOF' bar 'foo' EOF; $expected = "bar\n'foo'"; - $tests[] = [$yaml, $expected, \false]; + $tests[] = [$yaml, $expected, false]; $yaml = <<<'EOF' bar foo' EOF; $expected = "bar\nfoo'"; - $tests[] = [$yaml, $expected, \false]; + $tests[] = [$yaml, $expected, false]; return $tests; } public function testTaggedInlineMapping() { - $this->assertEquals(new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue('foo', ['foo' => 'bar']), $this->parser->parse('!foo {foo: bar}', \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_CUSTOM_TAGS)); + $this->assertEquals(new TaggedValue('foo', ['foo' => 'bar']), $this->parser->parse('!foo {foo: bar}', Yaml::PARSE_CUSTOM_TAGS)); } /** * @dataProvider taggedValuesProvider */ public function testCustomTagSupport($expected, $yaml) { - $this->assertEquals($expected, $this->parser->parse($yaml, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_CUSTOM_TAGS)); + $this->assertEquals($expected, $this->parser->parse($yaml, Yaml::PARSE_CUSTOM_TAGS)); } public function taggedValuesProvider() { - return ['sequences' => [[new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue('foo', ['yaml']), new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue('quz', ['bar'])], << [[new TaggedValue('foo', ['yaml']), new TaggedValue('quz', ['bar'])], << [new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue('foo', ['foo' => new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue('quz', ['bar']), 'quz' => new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue('foo', ['quz' => 'bar'])]), << [new TaggedValue('foo', ['foo' => new TaggedValue('quz', ['bar']), 'quz' => new TaggedValue('foo', ['quz' => 'bar'])]), << [[new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue('foo', ['foo', 'bar']), new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue('quz', ['foo' => 'bar', 'quz' => new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Tag\TaggedValue('bar', ['one' => 'bar'])])], << [[new TaggedValue('foo', ['foo', 'bar']), new TaggedValue('quz', ['foo' => 'bar', 'quz' => new TaggedValue('bar', ['one' => 'bar'])])], <<parseFile(__DIR__ . '/Fixtures/' . $testsFile); foreach ($files as $file) { - $yamls = \file_get_contents(__DIR__ . '/Fixtures/' . $file . '.yml'); + $yamls = file_get_contents(__DIR__ . '/Fixtures/' . $file . '.yml'); // split YAMLs documents - foreach (\preg_split('/^---( %YAML\\:1\\.0)?/m', $yamls) as $yaml) { + foreach (preg_split('/^---( %YAML\\:1\\.0)?/m', $yamls) as $yaml) { if (!$yaml) { continue; } @@ -1428,8 +1450,8 @@ private function loadTestsFromFixtureFiles($testsFile) if (isset($test['todo']) && $test['todo']) { // TODO } else { - eval('$expected = ' . \trim($test['php']) . ';'); - $tests[] = [\var_export($expected, \true), $test['yaml'], $test['test'], isset($test['deprecated']) ? $test['deprecated'] : \false]; + eval('$expected = ' . trim($test['php']) . ';'); + $tests[] = [var_export($expected, true), $test['yaml'], $test['test'], isset($test['deprecated']) ? $test['deprecated'] : false]; } } } @@ -1437,9 +1459,9 @@ private function loadTestsFromFixtureFiles($testsFile) } public function testCanParseVeryLongValue() { - $longStringWithSpaces = \str_repeat('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ', 20000); + $longStringWithSpaces = str_repeat('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ', 20000); $trickyVal = ['x' => $longStringWithSpaces]; - $yamlString = \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::dump($trickyVal); + $yamlString = Yaml::dump($trickyVal); $arrayFromYaml = $this->parser->parse($yamlString); $this->assertEquals($trickyVal, $arrayFromYaml); } @@ -1470,7 +1492,7 @@ public function testPhpConstantTagMappingKey() to: !php/const 'Symfony\\Component\\Yaml\\Tests\\B::BAZ' YAML; $expected = ['transitions' => ['foo' => ['from' => ['bar'], 'to' => 'baz']]]; - $this->assertSame($expected, $this->parser->parse($yaml, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_CONSTANT)); + $this->assertSame($expected, $this->parser->parse($yaml, Yaml::PARSE_CONSTANT)); } /** * @group legacy @@ -1488,7 +1510,7 @@ public function testDeprecatedPhpConstantTagMappingKey() to: !php/const:Symfony\\Component\\Yaml\\Tests\\B::BAZ YAML; $expected = ['transitions' => ['foo' => ['from' => ['bar'], 'to' => 'baz']]]; - $this->assertSame($expected, $this->parser->parse($yaml, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_CONSTANT)); + $this->assertSame($expected, $this->parser->parse($yaml, Yaml::PARSE_CONSTANT)); } /** * @group legacy @@ -1504,7 +1526,7 @@ public function testPhpConstantTagMappingKeyWithKeysCastToStrings() to: !php/const 'Symfony\\Component\\Yaml\\Tests\\B::BAZ' YAML; $expected = ['transitions' => ['foo' => ['from' => ['bar'], 'to' => 'baz']]]; - $this->assertSame($expected, $this->parser->parse($yaml, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_CONSTANT | \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_KEYS_AS_STRINGS)); + $this->assertSame($expected, $this->parser->parse($yaml, Yaml::PARSE_CONSTANT | Yaml::PARSE_KEYS_AS_STRINGS)); } public function testMergeKeysWhenMappingsAreParsedAsObjects() { @@ -1523,7 +1545,7 @@ public function testMergeKeysWhenMappingsAreParsedAsObjects() <<: [*FOO, *BAR] YAML; $expected = (object) ['foo' => (object) ['bar' => 1], 'bar' => (object) ['baz' => 2, 'bar' => 1], 'baz' => (object) ['baz_foo' => 3, 'baz_bar' => 4], 'foobar' => (object) ['bar' => null, 'baz' => 2]]; - $this->assertEquals($expected, $this->parser->parse($yaml, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_OBJECT_FOR_MAP)); + $this->assertEquals($expected, $this->parser->parse($yaml, Yaml::PARSE_OBJECT_FOR_MAP)); } public function testFilenamesAreParsedAsStringsWithoutFlag() { @@ -1544,14 +1566,14 @@ public function testParsingNotReadableFilesThrowsException() { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\ParseException'); $this->expectExceptionMessageRegExp('#^File ".+/Fixtures/not_readable.yml" cannot be read\\.$#'); - if ('\\' === \DIRECTORY_SEPARATOR) { + if ('\\' === DIRECTORY_SEPARATOR) { $this->markTestSkipped('chmod is not supported on Windows'); } - if (!\getenv('USER') || 'root' === \getenv('USER')) { + if (!getenv('USER') || 'root' === getenv('USER')) { $this->markTestSkipped('This test will fail if run under superuser'); } $file = __DIR__ . '/Fixtures/not_readable.yml'; - \chmod($file, 0200); + chmod($file, 0200); $this->parser->parseFile($file); } public function testParseReferencesOnMergeKeys() @@ -1582,7 +1604,7 @@ public function testParseReferencesOnMergeKeysWithMappingsParsedAsObjects() <<: *quux YAML; $expected = (object) ['mergekeyrefdef' => (object) ['a' => 'foo', 'b' => 'bar', 'c' => 'baz'], 'mergekeyderef' => (object) ['d' => 'quux', 'b' => 'bar', 'c' => 'baz']]; - $this->assertEquals($expected, $this->parser->parse($yaml, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_OBJECT_FOR_MAP)); + $this->assertEquals($expected, $this->parser->parse($yaml, Yaml::PARSE_OBJECT_FOR_MAP)); } public function testEvalRefException() { @@ -1600,7 +1622,7 @@ public function testDetectCircularReferences($yaml) { $this->expectException('_PhpScoper5ea00cc67502b\\Symfony\\Component\\Yaml\\Exception\\ParseException'); $this->expectExceptionMessage('Circular reference [foo, bar, foo] detected'); - $this->parser->parse($yaml, \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::PARSE_CUSTOM_TAGS); + $this->parser->parse($yaml, Yaml::PARSE_CUSTOM_TAGS); } public function circularReferenceProvider() { @@ -1692,7 +1714,7 @@ public function testParseValueWithModifiers() four five YAML; - $this->assertSame(['parameters' => ['abc' => \implode("\n", ['one', 'two', 'three', 'four', 'five'])]], $this->parser->parse($yaml)); + $this->assertSame(['parameters' => ['abc' => implode("\n", ['one', 'two', 'three', 'four', 'five'])]], $this->parser->parse($yaml)); } public function testParseValueWithNegativeModifiers() { @@ -1705,7 +1727,7 @@ public function testParseValueWithNegativeModifiers() four five YAML; - $this->assertSame(['parameters' => ['abc' => \implode("\n", ['one', 'two', 'three', 'four', 'five'])]], $this->parser->parse($yaml)); + $this->assertSame(['parameters' => ['abc' => implode("\n", ['one', 'two', 'three', 'four', 'five'])]], $this->parser->parse($yaml)); } } class B diff --git a/vendor/symfony/yaml/Tests/YamlTest.php b/vendor/symfony/yaml/Tests/YamlTest.php index 47d2bd11b..05dc2b6f1 100644 --- a/vendor/symfony/yaml/Tests/YamlTest.php +++ b/vendor/symfony/yaml/Tests/YamlTest.php @@ -12,25 +12,25 @@ use _PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase; use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml; -class YamlTest extends \_PhpScoper5ea00cc67502b\PHPUnit\Framework\TestCase +class YamlTest extends TestCase { public function testParseAndDump() { $data = ['lorem' => 'ipsum', 'dolor' => 'sit']; - $yml = \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::dump($data); - $parsed = \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::parse($yml); + $yml = Yaml::dump($data); + $parsed = Yaml::parse($yml); $this->assertEquals($data, $parsed); } public function testZeroIndentationThrowsException() { $this->expectException('InvalidArgumentException'); $this->expectExceptionMessage('The indentation must be greater than zero'); - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::dump(['lorem' => 'ipsum', 'dolor' => 'sit'], 2, 0); + Yaml::dump(['lorem' => 'ipsum', 'dolor' => 'sit'], 2, 0); } public function testNegativeIndentationThrowsException() { $this->expectException('InvalidArgumentException'); $this->expectExceptionMessage('The indentation must be greater than zero'); - \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Yaml::dump(['lorem' => 'ipsum', 'dolor' => 'sit'], 2, -4); + Yaml::dump(['lorem' => 'ipsum', 'dolor' => 'sit'], 2, -4); } } diff --git a/vendor/symfony/yaml/Tests/index.php b/vendor/symfony/yaml/Tests/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/yaml/Tests/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/vendor/symfony/yaml/Unescaper.php b/vendor/symfony/yaml/Unescaper.php index abab3d800..1562f6e7f 100644 --- a/vendor/symfony/yaml/Unescaper.php +++ b/vendor/symfony/yaml/Unescaper.php @@ -11,6 +11,13 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Yaml; use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException; +use function chr; +use function hexdec; +use function preg_replace_callback; +use function sprintf; +use function str_replace; +use function substr; + /** * Unescaper encapsulates unescaping rules for single and double-quoted * YAML strings. @@ -34,7 +41,7 @@ class Unescaper */ public function unescapeSingleQuotedString($value) { - return \str_replace('\'\'', '\'', $value); + return str_replace('\'\'', '\'', $value); } /** * Unescapes a double quoted string. @@ -49,7 +56,7 @@ public function unescapeDoubleQuotedString($value) return $this->unescapeCharacter($match[0]); }; // evaluate the string - return \preg_replace_callback('/' . self::REGEX_ESCAPED_CHARACTER . '/u', $callback, $value); + return preg_replace_callback('/' . self::REGEX_ESCAPED_CHARACTER . '/u', $callback, $value); } /** * Unescapes a character that was found in a double-quoted string. @@ -102,13 +109,13 @@ private function unescapeCharacter($value) // U+2029 PARAGRAPH SEPARATOR return "
"; case 'x': - return self::utf8chr(\hexdec(\substr($value, 2, 2))); + return self::utf8chr(hexdec(substr($value, 2, 2))); case 'u': - return self::utf8chr(\hexdec(\substr($value, 2, 4))); + return self::utf8chr(hexdec(substr($value, 2, 4))); case 'U': - return self::utf8chr(\hexdec(\substr($value, 2, 8))); + return self::utf8chr(hexdec(substr($value, 2, 8))); default: - throw new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException(\sprintf('Found unknown escape character "%s".', $value)); + throw new ParseException(sprintf('Found unknown escape character "%s".', $value)); } } /** @@ -121,14 +128,14 @@ private function unescapeCharacter($value) private static function utf8chr($c) { if (0x80 > ($c %= 0x200000)) { - return \chr($c); + return chr($c); } if (0x800 > $c) { - return \chr(0xc0 | $c >> 6) . \chr(0x80 | $c & 0x3f); + return chr(0xc0 | $c >> 6) . chr(0x80 | $c & 0x3f); } if (0x10000 > $c) { - return \chr(0xe0 | $c >> 12) . \chr(0x80 | $c >> 6 & 0x3f) . \chr(0x80 | $c & 0x3f); + return chr(0xe0 | $c >> 12) . chr(0x80 | $c >> 6 & 0x3f) . chr(0x80 | $c & 0x3f); } - return \chr(0xf0 | $c >> 18) . \chr(0x80 | $c >> 12 & 0x3f) . \chr(0x80 | $c >> 6 & 0x3f) . \chr(0x80 | $c & 0x3f); + return chr(0xf0 | $c >> 18) . chr(0x80 | $c >> 12 & 0x3f) . chr(0x80 | $c >> 6 & 0x3f) . chr(0x80 | $c & 0x3f); } } diff --git a/vendor/symfony/yaml/Yaml.php b/vendor/symfony/yaml/Yaml.php index 8c8aa0202..cfbb0d86b 100644 --- a/vendor/symfony/yaml/Yaml.php +++ b/vendor/symfony/yaml/Yaml.php @@ -11,6 +11,12 @@ namespace _PhpScoper5ea00cc67502b\Symfony\Component\Yaml; use _PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Exception\ParseException; +use function func_get_arg; +use function func_num_args; +use function is_bool; +use function trigger_error; +use const E_USER_DEPRECATED; + /** * Yaml offers convenience methods to load and dump YAML. * @@ -52,7 +58,7 @@ class Yaml */ public static function parseFile($filename, $flags = 0) { - $yaml = new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser(); + $yaml = new Parser(); return $yaml->parseFile($filename, $flags); } /** @@ -73,27 +79,27 @@ public static function parseFile($filename, $flags = 0) */ public static function parse($input, $flags = 0) { - if (\is_bool($flags)) { - @\trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the PARSE_EXCEPTION_ON_INVALID_TYPE flag instead.', \E_USER_DEPRECATED); + if (is_bool($flags)) { + @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the PARSE_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED); if ($flags) { $flags = self::PARSE_EXCEPTION_ON_INVALID_TYPE; } else { $flags = 0; } } - if (\func_num_args() >= 3) { - @\trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the PARSE_OBJECT flag instead.', \E_USER_DEPRECATED); - if (\func_get_arg(2)) { + if (func_num_args() >= 3) { + @trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the PARSE_OBJECT flag instead.', E_USER_DEPRECATED); + if (func_get_arg(2)) { $flags |= self::PARSE_OBJECT; } } - if (\func_num_args() >= 4) { - @\trigger_error('Passing a boolean flag to toggle object for map support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT_FOR_MAP flag instead.', \E_USER_DEPRECATED); - if (\func_get_arg(3)) { + if (func_num_args() >= 4) { + @trigger_error('Passing a boolean flag to toggle object for map support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT_FOR_MAP flag instead.', E_USER_DEPRECATED); + if (func_get_arg(3)) { $flags |= self::PARSE_OBJECT_FOR_MAP; } } - $yaml = new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Parser(); + $yaml = new Parser(); return $yaml->parse($input, $flags); } /** @@ -111,21 +117,21 @@ public static function parse($input, $flags = 0) */ public static function dump($input, $inline = 2, $indent = 4, $flags = 0) { - if (\is_bool($flags)) { - @\trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the DUMP_EXCEPTION_ON_INVALID_TYPE flag instead.', \E_USER_DEPRECATED); + if (is_bool($flags)) { + @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the DUMP_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED); if ($flags) { $flags = self::DUMP_EXCEPTION_ON_INVALID_TYPE; } else { $flags = 0; } } - if (\func_num_args() >= 5) { - @\trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the DUMP_OBJECT flag instead.', \E_USER_DEPRECATED); - if (\func_get_arg(4)) { + if (func_num_args() >= 5) { + @trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the DUMP_OBJECT flag instead.', E_USER_DEPRECATED); + if (func_get_arg(4)) { $flags |= self::DUMP_OBJECT; } } - $yaml = new \_PhpScoper5ea00cc67502b\Symfony\Component\Yaml\Dumper($indent); + $yaml = new Dumper($indent); return $yaml->dump($input, $inline, 0, $flags); } } diff --git a/vendor/symfony/yaml/index.php b/vendor/symfony/yaml/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/vendor/symfony/yaml/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/views/js/admin/index.php b/views/js/admin/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/views/js/admin/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/views/js/dist/index.php b/views/js/dist/index.php new file mode 100644 index 000000000..97775fe0f --- /dev/null +++ b/views/js/dist/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/views/js/front/payment_fee.js b/views/js/front/payment_fee.js index c30d127b2..0a544aaa6 100644 --- a/views/js/front/payment_fee.js +++ b/views/js/front/payment_fee.js @@ -1,38 +1,71 @@ -$(document).ready(function () { - displayPaymentFee(); - function displayPaymentFee() { - var paymentFees = $('input[name="payment-fee-price-display"]'); - paymentFees.each(function () { - var $prev = $(this).closest('.js-payment-option-form').prev(); - if ($prev.hasClass('additional-information')) { - $prev.prev().find('label').append("" + $(this).val() + ""); - } else { - $prev.find('label').append("" + $(this).val() + ""); - } - }); - } - - $('input[name="payment-option"]').on('change', function () { - var $nextDiv = $(this).closest('.payment-option').parent().next(); - var paymentFee; - if ($nextDiv.hasClass('js-payment-option-form')) { - paymentFee = $nextDiv.find('input[name="payment-fee-price"]').val(); - } else { - paymentFee = $nextDiv.next().find('input[name="payment-fee-price"]').val(); - } - - $.ajax({ - url: ajaxUrl, - method: 'GET', - data: { - 'paymentFee': paymentFee, - ajax: 1, - action: 'getTotalCartPrice' - }, - success: function (response) { - response = jQuery.parseJSON(response); - $('.card-block.cart-summary-totals').replaceWith(response.cart_summary_totals); - } - }) - }) +/** + * Copyright (c) 2012-2020, Mollie B.V. + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * @author Mollie B.V. + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + * @codingStandardsIgnoreStart + */ +$(document).ready(function () { + displayPaymentFee(); + function displayPaymentFee() { + var paymentFees = $('input[name="payment-fee-price-display"]'); + paymentFees.each(function () { + var $prev = $(this).closest('.js-payment-option-form').prev(); + if ($prev.hasClass('additional-information')) { + $prev.prev().find('label').append("" + $(this).val() + ""); + } else { + $prev.find('label').append("" + $(this).val() + ""); + } + }); + } + + $('input[name="payment-option"]').on('change', function () { + var $nextDiv = $(this).closest('.payment-option').parent().next(); + var paymentFee; + if ($nextDiv.hasClass('js-payment-option-form')) { + paymentFee = $nextDiv.find('input[name="payment-fee-price"]').val(); + } else { + paymentFee = $nextDiv.next().find('input[name="payment-fee-price"]').val(); + } + + $.ajax({ + url: ajaxUrl, + method: 'GET', + data: { + 'paymentFee': paymentFee, + ajax: 1, + action: 'getTotalCartPrice' + }, + success: function (response) { + response = jQuery.parseJSON(response); + $('.card-block.cart-summary-totals').replaceWith(response.cart_summary_totals); + } + }) + }) }); \ No newline at end of file diff --git a/views/js/src/back/carrierconfig/components/CarrierConfig.tsx b/views/js/src/back/carrierconfig/components/CarrierConfig.tsx index 575e3a49c..a7c85e830 100644 --- a/views/js/src/back/carrierconfig/components/CarrierConfig.tsx +++ b/views/js/src/back/carrierconfig/components/CarrierConfig.tsx @@ -1,169 +1,169 @@ -/** - * Copyright (c) 2012-2020, Mollie B.V. - * All rights reserved. - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. - * - * @author Mollie B.V. - * @copyright Mollie B.V. - * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php - * @category Mollie - * @package Mollie - * @link https://www.mollie.nl - */ -import React, { ReactElement, Suspense, useEffect, useState, lazy } from 'react'; -import cx from 'classnames'; -import { cloneDeep, find, forEach, isEmpty } from 'lodash'; - -import axios from '@shared/axios'; -import LoadingDots from '@shared/components/LoadingDots'; -import { - IMollieCarrierConfig, - IMollieCarrierConfigItem, - IMollieCarrierConfigItems, - ITranslations, -} from '@shared/globals'; - -const ConfigCarrierError = lazy(() => import(/* webpackChunkName: "carrierconfig" */ '@carrierconfig/components/CarrierConfigError')); - -interface IProps { - config: IMollieCarrierConfig; - translations: ITranslations; - target: string; -} - -export default function CarrierConfig(props: IProps): ReactElement<{}> { - const [carriers, setCarriers] = useState>(undefined); - const [message, setMessage] = useState(undefined); - - async function _init(): Promise { - const { config: { ajaxEndpoint } } = props; - try { - const { data: { carriers } = { carriers: null } } = await axios.get(ajaxEndpoint); - setCarriers(carriers); - } catch (e) { - console.error(e); - setCarriers(null); - setMessage((e && e instanceof Error) ? e.message : 'Check the browser console for errors'); - } - } - - function _carrierConfig(): IMollieCarrierConfigItems { - const carrierConfig: IMollieCarrierConfigItems = {}; - forEach(carriers, (carrier: IMollieCarrierConfigItem) => { - carrierConfig[carrier.id_carrier] = carrier; - }); - - return carrierConfig; - } - - function _updateCarrierConfig(id: string, key: string, value: string|null): void { - const newCarriers = cloneDeep(carriers); - const config = find(newCarriers, (item: IMollieCarrierConfigItem) => item.id_carrier === id); - if (typeof config === 'undefined') { - return; - } - config[key] = value; - - setCarriers(newCarriers); - } - - useEffect(() => { - _init().then(); - }, []); - - const { translations, target, config: { legacy } } = props; - - if (typeof carriers === 'undefined') { - return ; - } - - if (!Array.isArray(carriers) || (Array.isArray(carriers) && isEmpty(carriers))) { - return ( - - - - ); - } - - return ( - <> -
      - {translations.hereYouCanConfigureCarriers} -
      {translations.youCanUseTheFollowingVariables} -
        -
      • @ : {translations.shippingNumber}
      • -
      • %%shipping_number%% : {translations.shippingNumber}
      • -
      • %%invoice.country_iso%%: {translations.invoiceCountryCode}
      • -
      • %%invoice.postcode%% : {translations.invoicePostcode}
      • -
      • %%delivery.country_iso%%: {translations.deliveryCountryCode}
      • -
      • %%delivery.postcode%% : {translations.deliveryPostcode}
      • -
      • %%lang_iso%% : {translations.languageCode}
      • -
      -
      - - - - - - - - - - {carriers.map((carrier) => ( - - - - - - ))} - -
      {translations.name}{translations.urlSource}{translations.customUrl}
      - {carrier.name} - - - - _updateCarrierConfig(carrier.id_carrier, 'custom_url', value)} - /> -
      - - - ); -} +/** + * Copyright (c) 2012-2020, Mollie B.V. + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * @author Mollie B.V. + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + */ +import React, { ReactElement, Suspense, useEffect, useState, lazy } from 'react'; +import cx from 'classnames'; +import { cloneDeep, find, forEach, isEmpty } from 'lodash'; + +import axios from '@shared/axios'; +import LoadingDots from '@shared/components/LoadingDots'; +import { + IMollieCarrierConfig, + IMollieCarrierConfigItem, + IMollieCarrierConfigItems, + ITranslations, +} from '@shared/globals'; + +const ConfigCarrierError = lazy(() => import(/* webpackChunkName: "carrierconfig" */ '@carrierconfig/components/CarrierConfigError')); + +interface IProps { + config: IMollieCarrierConfig; + translations: ITranslations; + target: string; +} + +export default function CarrierConfig(props: IProps): ReactElement<{}> { + const [carriers, setCarriers] = useState>(undefined); + const [message, setMessage] = useState(undefined); + + async function _init(): Promise { + const { config: { ajaxEndpoint } } = props; + try { + const { data: { carriers } = { carriers: null } } = await axios.get(ajaxEndpoint); + setCarriers(carriers); + } catch (e) { + console.error(e); + setCarriers(null); + setMessage((e && e instanceof Error) ? e.message : 'Check the browser console for errors'); + } + } + + function _carrierConfig(): IMollieCarrierConfigItems { + const carrierConfig: IMollieCarrierConfigItems = {}; + forEach(carriers, (carrier: IMollieCarrierConfigItem) => { + carrierConfig[carrier.id_carrier] = carrier; + }); + + return carrierConfig; + } + + function _updateCarrierConfig(id: string, key: string, value: string|null): void { + const newCarriers = cloneDeep(carriers); + const config = find(newCarriers, (item: IMollieCarrierConfigItem) => item.id_carrier === id); + if (typeof config === 'undefined') { + return; + } + config[key] = value; + + setCarriers(newCarriers); + } + + useEffect(() => { + _init().then(); + }, []); + + const { translations, target, config: { legacy } } = props; + + if (typeof carriers === 'undefined') { + return ; + } + + if (!Array.isArray(carriers) || (Array.isArray(carriers) && isEmpty(carriers))) { + return ( + + + + ); + } + + return ( + <> +
      + {translations.hereYouCanConfigureCarriers} +
      {translations.youCanUseTheFollowingVariables} +
        +
      • @ : {translations.shippingNumber}
      • +
      • %%shipping_number%% : {translations.shippingNumber}
      • +
      • %%invoice.country_iso%%: {translations.invoiceCountryCode}
      • +
      • %%invoice.postcode%% : {translations.invoicePostcode}
      • +
      • %%delivery.country_iso%%: {translations.deliveryCountryCode}
      • +
      • %%delivery.postcode%% : {translations.deliveryPostcode}
      • +
      • %%lang_iso%% : {translations.languageCode}
      • +
      +
      + + + + + + + + + + {carriers.map((carrier) => ( + + + + + + ))} + +
      {translations.name}{translations.urlSource}{translations.customUrl}
      + {carrier.name} + + + + _updateCarrierConfig(carrier.id_carrier, 'custom_url', value)} + /> +
      + + + ); +} diff --git a/views/js/src/back/carrierconfig/components/CarrierConfigError.tsx b/views/js/src/back/carrierconfig/components/CarrierConfigError.tsx index 4ca4136b6..e19bb3881 100644 --- a/views/js/src/back/carrierconfig/components/CarrierConfigError.tsx +++ b/views/js/src/back/carrierconfig/components/CarrierConfigError.tsx @@ -1,82 +1,82 @@ -/** - * Copyright (c) 2012-2020, Mollie B.V. - * All rights reserved. - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. - * - * @author Mollie B.V. - * @copyright Mollie B.V. - * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php - * @category Mollie - * @package Mollie - * @link https://www.mollie.nl - */ -import React, { ReactElement, useCallback } from 'react'; -import cx from 'classnames'; -import { faRedoAlt } from '@fortawesome/free-solid-svg-icons'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import styled from 'styled-components'; - -import { IMollieCarrierConfig, ITranslations } from '@shared/globals'; -import { useMappedState } from 'redux-react-hook'; - -interface IProps { - retry: Function; - message?: string; -} - -const Code = styled.code` - font-size: 14px!important; -` as any; - -export default function ConfigCarrierError({ retry, message }: IProps): ReactElement<{}> { - const { translations, config: { legacy } }: Partial = useCallback(useMappedState((state: IMollieCarriersState): any => ({ - translations: state.translations, - config: state.config, - })), []); - - return ( -
      - {translations.unableToLoadCarriers}  - {message && <>

      {translations.error}: {message}

      } - -
      - ); -} +/** + * Copyright (c) 2012-2020, Mollie B.V. + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * @author Mollie B.V. + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + */ +import React, { ReactElement, useCallback } from 'react'; +import cx from 'classnames'; +import { faRedoAlt } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import styled from 'styled-components'; + +import { IMollieCarrierConfig, ITranslations } from '@shared/globals'; +import { useMappedState } from 'redux-react-hook'; + +interface IProps { + retry: Function; + message?: string; +} + +const Code = styled.code` + font-size: 14px!important; +` as any; + +export default function ConfigCarrierError({ retry, message }: IProps): ReactElement<{}> { + const { translations, config: { legacy } }: Partial = useCallback(useMappedState((state: IMollieCarriersState): any => ({ + translations: state.translations, + config: state.config, + })), []); + + return ( +
      + {translations.unableToLoadCarriers}  + {message && <>

      {translations.error}: {message}

      } + +
      + ); +} diff --git a/views/js/src/back/carrierconfig/components/index.php b/views/js/src/back/carrierconfig/components/index.php index a950d02f4..729abf520 100644 --- a/views/js/src/back/carrierconfig/components/index.php +++ b/views/js/src/back/carrierconfig/components/index.php @@ -1,11 +1,11 @@ - - * @copyright Mollie B.V. - * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php - * @category Mollie - * @package Mollie - * @link https://www.mollie.nl - */ -import React from 'react'; -import { StoreContext } from 'redux-react-hook'; -import { render } from 'react-dom'; - -import { IMollieCarrierConfig, ITranslations } from '@shared/globals'; - -export default ( - target: string, - config: IMollieCarrierConfig, - translations: ITranslations -) => { - (async function() { - const [ - { default: store }, - { updateConfig, updateTranslations }, - { default: CarrierConfig }, - ] = await Promise.all([ - import(/* webpackChunkName: "carrierconfig" */ '@carrierconfig/store'), - import(/* webpackChunkName: "carrierconfig" */ '@carrierconfig/store/actions'), - import(/* webpackChunkName: "carrierconfig" */ '@carrierconfig/components/CarrierConfig'), - ]); - - store.dispatch(updateConfig(config)); - store.dispatch(updateTranslations(translations)); - - return render( - ( - - - - ), - document.getElementById(`${target}_container`) - ); - }()); -}; +/** + * Copyright (c) 2012-2020, Mollie B.V. + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * @author Mollie B.V. + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + */ +import React from 'react'; +import { StoreContext } from 'redux-react-hook'; +import { render } from 'react-dom'; + +import { IMollieCarrierConfig, ITranslations } from '@shared/globals'; + +export default ( + target: string, + config: IMollieCarrierConfig, + translations: ITranslations +) => { + (async function() { + const [ + { default: store }, + { updateConfig, updateTranslations }, + { default: CarrierConfig }, + ] = await Promise.all([ + import(/* webpackChunkName: "carrierconfig" */ '@carrierconfig/store'), + import(/* webpackChunkName: "carrierconfig" */ '@carrierconfig/store/actions'), + import(/* webpackChunkName: "carrierconfig" */ '@carrierconfig/components/CarrierConfig'), + ]); + + store.dispatch(updateConfig(config)); + store.dispatch(updateTranslations(translations)); + + return render( + ( + + + + ), + document.getElementById(`${target}_container`) + ); + }()); +}; diff --git a/views/js/src/back/carrierconfig/store/actions.ts b/views/js/src/back/carrierconfig/store/actions.ts index c659e9824..2251648dc 100644 --- a/views/js/src/back/carrierconfig/store/actions.ts +++ b/views/js/src/back/carrierconfig/store/actions.ts @@ -1,58 +1,58 @@ -/** - * Copyright (c) 2012-2020, Mollie B.V. - * All rights reserved. - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. - * - * @author Mollie B.V. - * @copyright Mollie B.V. - * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php - * @category Mollie - * @package Mollie - * @link https://www.mollie.nl - */ -// Action types -import { IMollieCarrierConfig, ITranslations } from '@shared/globals'; - -export enum ReduxActionTypes { - updateTranslations = 'UPDATE_MOLLIE_CARRIER_TRANSLATIONS', - updateConfig = 'UPDATE_MOLLIE_CARRIER_CONFIG', -} - -// Action creators -export interface IUpdateTranslationsAction { - type: string; - translations: ITranslations; -} - -export interface IUpdateCarrierConfigAction { - type: string; - config: IMollieCarrierConfig; -} - -export function updateTranslations(translations: ITranslations): IUpdateTranslationsAction { - return { type: ReduxActionTypes.updateTranslations, translations }; -} - -export function updateConfig(config: IMollieCarrierConfig): IUpdateCarrierConfigAction { - return { type: ReduxActionTypes.updateConfig, config }; -} +/** + * Copyright (c) 2012-2020, Mollie B.V. + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * @author Mollie B.V. + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + */ +// Action types +import { IMollieCarrierConfig, ITranslations } from '@shared/globals'; + +export enum ReduxActionTypes { + updateTranslations = 'UPDATE_MOLLIE_CARRIER_TRANSLATIONS', + updateConfig = 'UPDATE_MOLLIE_CARRIER_CONFIG', +} + +// Action creators +export interface IUpdateTranslationsAction { + type: string; + translations: ITranslations; +} + +export interface IUpdateCarrierConfigAction { + type: string; + config: IMollieCarrierConfig; +} + +export function updateTranslations(translations: ITranslations): IUpdateTranslationsAction { + return { type: ReduxActionTypes.updateTranslations, translations }; +} + +export function updateConfig(config: IMollieCarrierConfig): IUpdateCarrierConfigAction { + return { type: ReduxActionTypes.updateConfig, config }; +} diff --git a/views/js/src/back/carrierconfig/store/carriers.ts b/views/js/src/back/carrierconfig/store/carriers.ts index a4f04794e..3a1602828 100644 --- a/views/js/src/back/carrierconfig/store/carriers.ts +++ b/views/js/src/back/carrierconfig/store/carriers.ts @@ -1,69 +1,69 @@ -/** - * Copyright (c) 2012-2020, Mollie B.V. - * All rights reserved. - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. - * - * @author Mollie B.V. - * @copyright Mollie B.V. - * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php - * @category Mollie - * @package Mollie - * @link https://www.mollie.nl - */ -import { combineReducers } from 'redux'; - -import { IUpdateCarrierConfigAction, IUpdateTranslationsAction, ReduxActionTypes } from '@carrierconfig/store/actions'; -import { IMollieCarrierConfig, IMollieCarrierConfigItem, ITranslations } from '@shared/globals'; - -declare global { - interface IMollieCarriersState { - translations: ITranslations; - config: IMollieCarrierConfig; - carriers: Array; - } -} - -const translations = (state: any = {}, action: IUpdateTranslationsAction): ITranslations => { - switch (action.type) { - case ReduxActionTypes.updateTranslations: - return action.translations; - default: - return state; - } -}; - -const config = (state: any = {}, action: IUpdateCarrierConfigAction): IMollieCarrierConfig => { - switch (action.type) { - case ReduxActionTypes.updateConfig: - return action.config; - default: - return state; - } -}; - -const checkoutApp = combineReducers({ - translations, - config, -}); - -export default checkoutApp; +/** + * Copyright (c) 2012-2020, Mollie B.V. + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * @author Mollie B.V. + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + */ +import { combineReducers } from 'redux'; + +import { IUpdateCarrierConfigAction, IUpdateTranslationsAction, ReduxActionTypes } from '@carrierconfig/store/actions'; +import { IMollieCarrierConfig, IMollieCarrierConfigItem, ITranslations } from '@shared/globals'; + +declare global { + interface IMollieCarriersState { + translations: ITranslations; + config: IMollieCarrierConfig; + carriers: Array; + } +} + +const translations = (state: any = {}, action: IUpdateTranslationsAction): ITranslations => { + switch (action.type) { + case ReduxActionTypes.updateTranslations: + return action.translations; + default: + return state; + } +}; + +const config = (state: any = {}, action: IUpdateCarrierConfigAction): IMollieCarrierConfig => { + switch (action.type) { + case ReduxActionTypes.updateConfig: + return action.config; + default: + return state; + } +}; + +const checkoutApp = combineReducers({ + translations, + config, +}); + +export default checkoutApp; diff --git a/views/js/src/back/carrierconfig/store/index.php b/views/js/src/back/carrierconfig/store/index.php index a950d02f4..729abf520 100644 --- a/views/js/src/back/carrierconfig/store/index.php +++ b/views/js/src/back/carrierconfig/store/index.php @@ -1,11 +1,11 @@ - - * @copyright Mollie B.V. - * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php - * @category Mollie - * @package Mollie - * @link https://www.mollie.nl - */ -import { createStore, Store } from 'redux'; - -import carriersApp from '@carrierconfig/store/carriers'; - -declare let window: any; - -let store: Store; -const devTools = window.__REDUX_DEVTOOLS_EXTENSION__; - -store = createStore( - carriersApp, - devTools && devTools(), -); - -export default store; +/** + * Copyright (c) 2012-2020, Mollie B.V. + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * @author Mollie B.V. + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + */ +import { createStore, Store } from 'redux'; + +import carriersApp from '@carrierconfig/store/carriers'; + +declare let window: any; + +let store: Store; +const devTools = window.__REDUX_DEVTOOLS_EXTENSION__; + +store = createStore( + carriersApp, + devTools && devTools(), +); + +export default store; diff --git a/views/js/src/back/methodconfig/components/PaymentMethod.tsx b/views/js/src/back/methodconfig/components/PaymentMethod.tsx index 977b13ec2..f64b464b4 100644 --- a/views/js/src/back/methodconfig/components/PaymentMethod.tsx +++ b/views/js/src/back/methodconfig/components/PaymentMethod.tsx @@ -1,275 +1,275 @@ -/** - * Copyright (c) 2012-2020, Mollie B.V. - * All rights reserved. - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. - * - * @author Mollie B.V. - * @copyright Mollie B.V. - * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php - * @category Mollie - * @package Mollie - * @link https://www.mollie.nl - */ -import React, { ReactElement, useEffect } from 'react'; -import styled from 'styled-components'; -import { SortableElement } from 'react-sortable-hoc'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { faChevronDown, faChevronUp, faExclamationTriangle } from '@fortawesome/free-solid-svg-icons'; - -import Switch from '@methodconfig/components/Switch'; -import { IMollieMethodConfig, ITranslations } from '@shared/globals'; - -interface IProps { - position: number; - max: number; - enabled: boolean; - available: boolean; - tipEnableSSL: boolean; - name: string; - code: string; - imageUrl: string; - translations: ITranslations; - config: IMollieMethodConfig; - - moveMethod: Function; - onToggle: Function; -} - -declare let $: any; - -const Li = styled.li` -cursor: move!important; --webkit-touch-callout: none; /* iOS Safari */ - -webkit-user-select: none; /* Safari */ - -khtml-user-select: none; /* Konqueror HTML */ - -moz-user-select: none; /* Firefox */ - -ms-user-select: none; /* Internet Explorer/Edge */ - user-select: none; /* Non-prefixed version, currently - supported by Chrome and Opera */ - -border: 1px solid #0c95fd; -border-bottom-width: ${(props: any) => props.last ? '1px' : '2px'}; -background-color: #fff; -display: table; -width: 100%; -padding: 5px 0; -margin-bottom: -1px; -${({ legacy }: any) => legacy ? 'width: calc(100% - 2px);' : ''} -` as any; - -const PositionColumn = styled.div` -display: table-cell; -width: 80px!important; -vertical-align: middle!important; -text-align: right!important; -` as any; - -const IconColumn = styled.div` -display: table-cell; -width: 75px; -text-align: left; -vertical-align: middle; -` as any; - -const InfoColumn = styled.div` -display: table-cell; -height: 50px; -vertical-align: middle; -box-sizing: border-box; -` as any; - -const PositionIndicator = styled.span` -border: solid 1px #ccc; -background-color: #eee; -padding: 0; -font-size: 1.4em; -color: #aaa; -cursor: move; -text-shadow: #fff 1px 1px; --webkit-border-radius: 3px; -border-radius: 3px; --webkit-box-shadow: rgba(0,0,0,0.2) 0 1px 3px inset; -box-shadow: rgba(0,0,0,0.2) 0 1px 3px inset; -display: block; -width: 40px; -text-align: center; -margin: 0 auto; -${({ legacy }: any) => legacy ? 'height: 24px;line-height: 24px;' : ''} -` as any; - -const ArrowButton = styled.button` -padding: 1px 5px; -font-size: 11px; -line-height: 1.5; -border-radius: 3px; -color: #363A41; -display: inline-block; -margin-bottom: 0; -font-weight: normal; -text-align: center; -vertical-align: middle; -cursor: pointer; -background: #2eacce none; -border: 1px solid #0000; -white-space: nowrap; -font-family: inherit; -width: 26px!important; -margin-top: 6px!important; -margin-right: 2px!important; - -:hover { - background-color: #008abd; - -webkit-box-shadow: none; - box-shadow: none; -} - -:disabled { - background-color: #2eacce; - border-color: #2eacce; - cursor: not-allowed; - opacity: .65; - filter: alpha(opacity=65); - -webkit-box-shadow: none; - box-shadow: none; -} -${({ legacy }: any) => legacy ? 'height: 20px;line-height: 20px;' : ''} -` as any; - -const ButtonBox = styled.div` -margin: 0 auto; -text-align: center; -` as any; - -function PaymentMethod({ - enabled, - onToggle, - code, - translations, - position, - max, - name, - imageUrl, - moveMethod, - available, - tipEnableSSL, - config: { legacy } -}: IProps -): ReactElement<{}> { - function _toggleMethod(enabled: boolean): void { - onToggle(code, enabled); - } - - useEffect(() => { - if (typeof $ !== 'undefined' && typeof $.prototype.tooltip === 'function') { - $('[data-toggle=tooltip]').tooltip(); - } - }); - - return ( -
    • = max} legacy={legacy}> - - {position + 1} - - { - e.preventDefault(); - moveMethod({ - oldIndex: position - 1, - newIndex: position, - }); - }} - > - - - = max} - onClick={(e: any) => { - e.preventDefault(); - moveMethod({ - oldIndex: position + 1, - newIndex: position, - }); - }} - > - - - - - - {name} - - -
      - - {name} - -
      - {!available && tipEnableSSL &&( -

      - {translations.notAvailable} -

      - )} - {!available && !tipEnableSSL &&( -

      - {translations.notAvailable} -

      - )} - {available && - _toggleMethod(!!value)} - legacy={legacy} - /> - } -
      -
    • - ); -} - -export default SortableElement(PaymentMethod); +/** + * Copyright (c) 2012-2020, Mollie B.V. + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * @author Mollie B.V. + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + */ +import React, { ReactElement, useEffect } from 'react'; +import styled from 'styled-components'; +import { SortableElement } from 'react-sortable-hoc'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { faChevronDown, faChevronUp, faExclamationTriangle } from '@fortawesome/free-solid-svg-icons'; + +import Switch from '@methodconfig/components/Switch'; +import { IMollieMethodConfig, ITranslations } from '@shared/globals'; + +interface IProps { + position: number; + max: number; + enabled: boolean; + available: boolean; + tipEnableSSL: boolean; + name: string; + code: string; + imageUrl: string; + translations: ITranslations; + config: IMollieMethodConfig; + + moveMethod: Function; + onToggle: Function; +} + +declare let $: any; + +const Li = styled.li` +cursor: move!important; +-webkit-touch-callout: none; /* iOS Safari */ + -webkit-user-select: none; /* Safari */ + -khtml-user-select: none; /* Konqueror HTML */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* Internet Explorer/Edge */ + user-select: none; /* Non-prefixed version, currently + supported by Chrome and Opera */ + +border: 1px solid #0c95fd; +border-bottom-width: ${(props: any) => props.last ? '1px' : '2px'}; +background-color: #fff; +display: table; +width: 100%; +padding: 5px 0; +margin-bottom: -1px; +${({ legacy }: any) => legacy ? 'width: calc(100% - 2px);' : ''} +` as any; + +const PositionColumn = styled.div` +display: table-cell; +width: 80px!important; +vertical-align: middle!important; +text-align: right!important; +` as any; + +const IconColumn = styled.div` +display: table-cell; +width: 75px; +text-align: left; +vertical-align: middle; +` as any; + +const InfoColumn = styled.div` +display: table-cell; +height: 50px; +vertical-align: middle; +box-sizing: border-box; +` as any; + +const PositionIndicator = styled.span` +border: solid 1px #ccc; +background-color: #eee; +padding: 0; +font-size: 1.4em; +color: #aaa; +cursor: move; +text-shadow: #fff 1px 1px; +-webkit-border-radius: 3px; +border-radius: 3px; +-webkit-box-shadow: rgba(0,0,0,0.2) 0 1px 3px inset; +box-shadow: rgba(0,0,0,0.2) 0 1px 3px inset; +display: block; +width: 40px; +text-align: center; +margin: 0 auto; +${({ legacy }: any) => legacy ? 'height: 24px;line-height: 24px;' : ''} +` as any; + +const ArrowButton = styled.button` +padding: 1px 5px; +font-size: 11px; +line-height: 1.5; +border-radius: 3px; +color: #363A41; +display: inline-block; +margin-bottom: 0; +font-weight: normal; +text-align: center; +vertical-align: middle; +cursor: pointer; +background: #2eacce none; +border: 1px solid #0000; +white-space: nowrap; +font-family: inherit; +width: 26px!important; +margin-top: 6px!important; +margin-right: 2px!important; + +:hover { + background-color: #008abd; + -webkit-box-shadow: none; + box-shadow: none; +} + +:disabled { + background-color: #2eacce; + border-color: #2eacce; + cursor: not-allowed; + opacity: .65; + filter: alpha(opacity=65); + -webkit-box-shadow: none; + box-shadow: none; +} +${({ legacy }: any) => legacy ? 'height: 20px;line-height: 20px;' : ''} +` as any; + +const ButtonBox = styled.div` +margin: 0 auto; +text-align: center; +` as any; + +function PaymentMethod({ + enabled, + onToggle, + code, + translations, + position, + max, + name, + imageUrl, + moveMethod, + available, + tipEnableSSL, + config: { legacy } +}: IProps +): ReactElement<{}> { + function _toggleMethod(enabled: boolean): void { + onToggle(code, enabled); + } + + useEffect(() => { + if (typeof $ !== 'undefined' && typeof $.prototype.tooltip === 'function') { + $('[data-toggle=tooltip]').tooltip(); + } + }); + + return ( +
    • = max} legacy={legacy}> + + {position + 1} + + { + e.preventDefault(); + moveMethod({ + oldIndex: position - 1, + newIndex: position, + }); + }} + > + + + = max} + onClick={(e: any) => { + e.preventDefault(); + moveMethod({ + oldIndex: position + 1, + newIndex: position, + }); + }} + > + + + + + + {name} + + +
      + + {name} + +
      + {!available && tipEnableSSL &&( +

      + {translations.notAvailable} +

      + )} + {!available && !tipEnableSSL &&( +

      + {translations.notAvailable} +

      + )} + {available && + _toggleMethod(!!value)} + legacy={legacy} + /> + } +
      +
    • + ); +} + +export default SortableElement(PaymentMethod); diff --git a/views/js/src/back/methodconfig/components/PaymentMethodConfig.tsx b/views/js/src/back/methodconfig/components/PaymentMethodConfig.tsx index 8e20f8db6..f1a6034e8 100644 --- a/views/js/src/back/methodconfig/components/PaymentMethodConfig.tsx +++ b/views/js/src/back/methodconfig/components/PaymentMethodConfig.tsx @@ -1,85 +1,85 @@ -/** - * Copyright (c) 2012-2020, Mollie B.V. - * All rights reserved. - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. - * - * @author Mollie B.V. - * @copyright Mollie B.V. - * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php - * @category Mollie - * @package Mollie - * @link https://www.mollie.nl - */ -import React, { ReactElement, useEffect, useState } from 'react'; -import { isEmpty } from 'lodash'; - -import PaymentMethods from '@methodconfig/components/PaymentMethods'; -import PaymentMethodsError from '@methodconfig/components/PaymentMethodsError'; -import axios from '@shared/axios'; -import { IMollieMethodConfig, IMolliePaymentMethodItem, ITranslations } from '@shared/globals'; -import LoadingDots from '@shared/components/LoadingDots'; - -interface IProps { - config: IMollieMethodConfig; - translations: ITranslations; - target: string; -} - -export default function PaymentMethodConfig(props: IProps): ReactElement<{}> { - const [methods, setMethods] = useState>(undefined); - const [message, setMessage] = useState(undefined); - - async function _init(): Promise { - try { - const { config: { ajaxEndpoint } } = props; - const { data: { methods: newMethods, message: newMessage } = { methods: null, message: '' } } = await axios.post(ajaxEndpoint, { - resource: 'orders', - action: 'retrieve', - }); - - setMethods(newMethods); - setMessage(newMessage); - } catch (e) { - setMethods(null); - setMessage((e instanceof Error && typeof e.message !== 'undefined') ? e.message : 'Check the browser console for errors'); - } - } - - useEffect(() => { - _init().then(); - }, []); - - const { target, translations, config } = props; - - if (typeof methods === 'undefined') { - return ; - } - - if (methods === null || !Array.isArray(methods) || (Array.isArray(methods) && isEmpty(methods))) { - return ; - } - - return ( - - ); -} +/** + * Copyright (c) 2012-2020, Mollie B.V. + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * @author Mollie B.V. + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + */ +import React, { ReactElement, useEffect, useState } from 'react'; +import { isEmpty } from 'lodash'; + +import PaymentMethods from '@methodconfig/components/PaymentMethods'; +import PaymentMethodsError from '@methodconfig/components/PaymentMethodsError'; +import axios from '@shared/axios'; +import { IMollieMethodConfig, IMolliePaymentMethodItem, ITranslations } from '@shared/globals'; +import LoadingDots from '@shared/components/LoadingDots'; + +interface IProps { + config: IMollieMethodConfig; + translations: ITranslations; + target: string; +} + +export default function PaymentMethodConfig(props: IProps): ReactElement<{}> { + const [methods, setMethods] = useState>(undefined); + const [message, setMessage] = useState(undefined); + + async function _init(): Promise { + try { + const { config: { ajaxEndpoint } } = props; + const { data: { methods: newMethods, message: newMessage } = { methods: null, message: '' } } = await axios.post(ajaxEndpoint, { + resource: 'orders', + action: 'retrieve', + }); + + setMethods(newMethods); + setMessage(newMessage); + } catch (e) { + setMethods(null); + setMessage((e instanceof Error && typeof e.message !== 'undefined') ? e.message : 'Check the browser console for errors'); + } + } + + useEffect(() => { + _init().then(); + }, []); + + const { target, translations, config } = props; + + if (typeof methods === 'undefined') { + return ; + } + + if (methods === null || !Array.isArray(methods) || (Array.isArray(methods) && isEmpty(methods))) { + return ; + } + + return ( + + ); +} diff --git a/views/js/src/back/methodconfig/components/PaymentMethods.tsx b/views/js/src/back/methodconfig/components/PaymentMethods.tsx index 86593da64..46bc1c5b7 100644 --- a/views/js/src/back/methodconfig/components/PaymentMethods.tsx +++ b/views/js/src/back/methodconfig/components/PaymentMethods.tsx @@ -1,133 +1,133 @@ -/** - * Copyright (c) 2012-2020, Mollie B.V. - * All rights reserved. - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. - * - * @author Mollie B.V. - * @copyright Mollie B.V. - * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php - * @category Mollie - * @package Mollie - * @link https://www.mollie.nl - */ -import React, { ReactElement, useEffect, useState } from 'react'; -import { arrayMove, SortableContainer } from 'react-sortable-hoc'; -import styled from 'styled-components'; -import { cloneDeep, find } from 'lodash'; - -import PaymentMethod from '@methodconfig/components/PaymentMethod'; -import { - IMollieMethodConfig, - IMolliePaymentMethodConfigItem, - IMolliePaymentMethodItem, - ITranslations -} from '@shared/globals'; - -const Section = styled.section` -border: 2px solid #0c95fd!important; -` as any; - -const Ul = styled.ul` -margin: -1px!important; -padding: 0; -` as any; - -const SortableList = SortableContainer(({ items, translations, onArrowClicked, onToggle, config }: any): ReactElement<{}> => { - return ( -
      -
        - {items.map((item: IMolliePaymentMethodItem, index: number) => ( - - ))} -
      -
      - ); -}); - -interface IProps { - methods: Array; - translations: ITranslations; - target: string; - config: IMollieMethodConfig; -} - -export default function PaymentMethods({ translations, config, methods: propsMethods, target }: IProps): ReactElement<{}> { - const [methods, setMethods] = useState(propsMethods); - - function _onToggle(id: string, enabled: boolean): void { - const newMethods = cloneDeep(methods); - const method = find(newMethods, item => item.id === id); - method.enabled = enabled; - setMethods(newMethods); - } - - function _onArrowClicked({ oldIndex, newIndex}: any): void { - setMethods(arrayMove(cloneDeep(methods), oldIndex, newIndex)); - } - - function _onSortEnd({ oldIndex, newIndex }: any): void { - setMethods(arrayMove(cloneDeep(methods), oldIndex, newIndex)); - } - - function _shouldCancelStart({ target }: any): boolean { - return ['I', 'SVG', 'BUTTON', 'INPUT', 'SELECT', 'LABEL'].includes(target.tagName.toUpperCase()); - } - - useEffect(() => { - const input: HTMLInputElement = document.getElementById(target) as HTMLInputElement; - if (input != null) { - input.value = JSON.stringify(methods.map((method: IMolliePaymentMethodItem, index: number): IMolliePaymentMethodConfigItem => ({ - ...method, - position: index, - }))); - } - }); - - return ( - - ); -} +/** + * Copyright (c) 2012-2020, Mollie B.V. + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * @author Mollie B.V. + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + */ +import React, { ReactElement, useEffect, useState } from 'react'; +import { arrayMove, SortableContainer } from 'react-sortable-hoc'; +import styled from 'styled-components'; +import { cloneDeep, find } from 'lodash'; + +import PaymentMethod from '@methodconfig/components/PaymentMethod'; +import { + IMollieMethodConfig, + IMolliePaymentMethodConfigItem, + IMolliePaymentMethodItem, + ITranslations +} from '@shared/globals'; + +const Section = styled.section` +border: 2px solid #0c95fd!important; +` as any; + +const Ul = styled.ul` +margin: -1px!important; +padding: 0; +` as any; + +const SortableList = SortableContainer(({ items, translations, onArrowClicked, onToggle, config }: any): ReactElement<{}> => { + return ( +
      +
        + {items.map((item: IMolliePaymentMethodItem, index: number) => ( + + ))} +
      +
      + ); +}); + +interface IProps { + methods: Array; + translations: ITranslations; + target: string; + config: IMollieMethodConfig; +} + +export default function PaymentMethods({ translations, config, methods: propsMethods, target }: IProps): ReactElement<{}> { + const [methods, setMethods] = useState(propsMethods); + + function _onToggle(id: string, enabled: boolean): void { + const newMethods = cloneDeep(methods); + const method = find(newMethods, item => item.id === id); + method.enabled = enabled; + setMethods(newMethods); + } + + function _onArrowClicked({ oldIndex, newIndex}: any): void { + setMethods(arrayMove(cloneDeep(methods), oldIndex, newIndex)); + } + + function _onSortEnd({ oldIndex, newIndex }: any): void { + setMethods(arrayMove(cloneDeep(methods), oldIndex, newIndex)); + } + + function _shouldCancelStart({ target }: any): boolean { + return ['I', 'SVG', 'BUTTON', 'INPUT', 'SELECT', 'LABEL'].includes(target.tagName.toUpperCase()); + } + + useEffect(() => { + const input: HTMLInputElement = document.getElementById(target) as HTMLInputElement; + if (input != null) { + input.value = JSON.stringify(methods.map((method: IMolliePaymentMethodItem, index: number): IMolliePaymentMethodConfigItem => ({ + ...method, + position: index, + }))); + } + }); + + return ( + + ); +} diff --git a/views/js/src/back/methodconfig/components/PaymentMethodsError.tsx b/views/js/src/back/methodconfig/components/PaymentMethodsError.tsx index 9c63ffc09..293d4868c 100644 --- a/views/js/src/back/methodconfig/components/PaymentMethodsError.tsx +++ b/views/js/src/back/methodconfig/components/PaymentMethodsError.tsx @@ -1,78 +1,78 @@ -/** - * Copyright (c) 2012-2020, Mollie B.V. - * All rights reserved. - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. - * - * @author Mollie B.V. - * @copyright Mollie B.V. - * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php - * @category Mollie - * @package Mollie - * @link https://www.mollie.nl - */ -import React, { ReactElement } from 'react'; -import cx from 'classnames'; -import { faRedoAlt } from '@fortawesome/free-solid-svg-icons'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import styled from 'styled-components'; - -import { IMollieMethodConfig, ITranslations } from '@shared/globals'; - -interface IProps { - translations: ITranslations; - config: IMollieMethodConfig; - message: string; - retry: Function; -} - -const Code = styled.code` - font-size: 14px!important; -` as any; - -export default function PaymentMethodsError({ translations, config: { legacy }, retry, message }: IProps): ReactElement<{}> { - return ( -
      - {translations.unableToLoadMethods}  - {message && <>

      {translations.error}: {message}

      } - -
      - ); -} +/** + * Copyright (c) 2012-2020, Mollie B.V. + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * @author Mollie B.V. + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + */ +import React, { ReactElement } from 'react'; +import cx from 'classnames'; +import { faRedoAlt } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import styled from 'styled-components'; + +import { IMollieMethodConfig, ITranslations } from '@shared/globals'; + +interface IProps { + translations: ITranslations; + config: IMollieMethodConfig; + message: string; + retry: Function; +} + +const Code = styled.code` + font-size: 14px!important; +` as any; + +export default function PaymentMethodsError({ translations, config: { legacy }, retry, message }: IProps): ReactElement<{}> { + return ( +
      + {translations.unableToLoadMethods}  + {message && <>

      {translations.error}: {message}

      } + +
      + ); +} diff --git a/views/js/src/back/methodconfig/components/Switch.tsx b/views/js/src/back/methodconfig/components/Switch.tsx index 788706a10..549258216 100644 --- a/views/js/src/back/methodconfig/components/Switch.tsx +++ b/views/js/src/back/methodconfig/components/Switch.tsx @@ -1,174 +1,174 @@ -/** - * Copyright (c) 2012-2020, Mollie B.V. - * All rights reserved. - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. - * - * @author Mollie B.V. - * @copyright Mollie B.V. - * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php - * @category Mollie - * @package Mollie - * @link https://www.mollie.nl - */ -import React, { ReactElement } from 'react'; -import styled from 'styled-components'; -import { lighten, rgba } from 'polished'; - -import { ITranslations } from '@shared/globals'; - -interface IProps { - enabled: boolean; - onChange: any; - id: string; - translations: ITranslations; - legacy: boolean; -} - -const Span = styled.span` -display: block; -height: 26px; -float: right; -width: 100px; -right: 20px; - -a { - display: block; - transition: all 0.3s ease-out; -} -label, -> span { - line-height: 26px; - vertical-align: middle; -} - -* { - box-sizing: border-box; - outline: 0!important -} - -position: relative; -input { - position: absolute; - opacity: 0; -} - -label { - position: relative; - z-index: 2; - width: 50%; - height: 100%; - margin: ${({ legacy }: IProps) => legacy ? '-2px' : '0'} 0 0 0; - text-align: center; - float: left; -} - -a { - position: absolute; - top: 0; - padding: 0; - z-index: 1; - width: 50%; - height: 100%; - color: white; - border: solid 1px #279CBB!important; - background-color: #2EACCE!important; - left: 0; - border-radius: 3px!important; -} - -input:last-of-type:checked ~ a { - border: solid 1px #CA6F6F!important; - background-color: #E08F95!important; - left: 50% ; - border-radius: 3px!important; -} - -input:disabled ~ a { - border: solid 1px lighten(gray,20%) !important; - background-color: lighten(gray,30%) !important; - // box-shadow: ${lighten(0.2, 'gray')} 0 -1px 0 inset !important; -} - -margin-top: ${({ legacy }: IProps) => legacy ? '0' : '3px'}; -background-color: #eee; -border-radius: 3px!important; -color: #555; -text-align: center; -box-shadow: ${rgba('black', 0.15)} 0 1px 4px 1px inset; - -label { - text-transform: uppercase; - color: #bbb; - font-weight: 400; - cursor: pointer; - transition: color 0.2s ease-out; -} - -input:checked + label { - color: white -} - -> span { - color: #666; - text-transform: uppercase; - cursor: pointer; -} -` as any; - -export default function Switch(props: IProps): ReactElement<{}> { - const { enabled, onChange, id, translations } = props; - - return ( - - - - - { - // eslint-disable-next-line jsx-a11y/anchor-has-content - } - - ); -} +/** + * Copyright (c) 2012-2020, Mollie B.V. + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * @author Mollie B.V. + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + */ +import React, { ReactElement } from 'react'; +import styled from 'styled-components'; +import { lighten, rgba } from 'polished'; + +import { ITranslations } from '@shared/globals'; + +interface IProps { + enabled: boolean; + onChange: any; + id: string; + translations: ITranslations; + legacy: boolean; +} + +const Span = styled.span` +display: block; +height: 26px; +float: right; +width: 100px; +right: 20px; + +a { + display: block; + transition: all 0.3s ease-out; +} +label, +> span { + line-height: 26px; + vertical-align: middle; +} + +* { + box-sizing: border-box; + outline: 0!important +} + +position: relative; +input { + position: absolute; + opacity: 0; +} + +label { + position: relative; + z-index: 2; + width: 50%; + height: 100%; + margin: ${({ legacy }: IProps) => legacy ? '-2px' : '0'} 0 0 0; + text-align: center; + float: left; +} + +a { + position: absolute; + top: 0; + padding: 0; + z-index: 1; + width: 50%; + height: 100%; + color: white; + border: solid 1px #279CBB!important; + background-color: #2EACCE!important; + left: 0; + border-radius: 3px!important; +} + +input:last-of-type:checked ~ a { + border: solid 1px #CA6F6F!important; + background-color: #E08F95!important; + left: 50% ; + border-radius: 3px!important; +} + +input:disabled ~ a { + border: solid 1px lighten(gray,20%) !important; + background-color: lighten(gray,30%) !important; + // box-shadow: ${lighten(0.2, 'gray')} 0 -1px 0 inset !important; +} + +margin-top: ${({ legacy }: IProps) => legacy ? '0' : '3px'}; +background-color: #eee; +border-radius: 3px!important; +color: #555; +text-align: center; +box-shadow: ${rgba('black', 0.15)} 0 1px 4px 1px inset; + +label { + text-transform: uppercase; + color: #bbb; + font-weight: 400; + cursor: pointer; + transition: color 0.2s ease-out; +} + +input:checked + label { + color: white +} + +> span { + color: #666; + text-transform: uppercase; + cursor: pointer; +} +` as any; + +export default function Switch(props: IProps): ReactElement<{}> { + const { enabled, onChange, id, translations } = props; + + return ( + + + + + { + // eslint-disable-next-line jsx-a11y/anchor-has-content + } + + ); +} diff --git a/views/js/src/back/methodconfig/components/index.php b/views/js/src/back/methodconfig/components/index.php index a950d02f4..729abf520 100644 --- a/views/js/src/back/methodconfig/components/index.php +++ b/views/js/src/back/methodconfig/components/index.php @@ -1,11 +1,11 @@ - - * @copyright Mollie B.V. - * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php - * @category Mollie - * @package Mollie - * @link https://www.mollie.nl - */ -import React from 'react'; -import { render } from 'react-dom'; - -import { IMollieMethodConfig, ITranslations } from '@shared/globals'; - -export default (target: string, config: IMollieMethodConfig, translations: ITranslations): void => { - (async function () { - const [ - { default: PaymentMethodConfig }, - ] = await Promise.all([ - import(/* webpackPrefetch: true, webpackChunkName: "methodconfig" */ '@methodconfig/components/PaymentMethodConfig'), - ]); - - render(, document.getElementById(`${target}_container`)); - }()); -}; +/** + * Copyright (c) 2012-2020, Mollie B.V. + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * @author Mollie B.V. + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + */ +import React from 'react'; +import { render } from 'react-dom'; + +import { IMollieMethodConfig, ITranslations } from '@shared/globals'; + +export default (target: string, config: IMollieMethodConfig, translations: ITranslations): void => { + (async function () { + const [ + { default: PaymentMethodConfig }, + ] = await Promise.all([ + import(/* webpackPrefetch: true, webpackChunkName: "methodconfig" */ '@methodconfig/components/PaymentMethodConfig'), + ]); + + render(, document.getElementById(`${target}_container`)); + }()); +}; diff --git a/views/js/src/back/updater/index.php b/views/js/src/back/updater/index.php index a950d02f4..729abf520 100644 --- a/views/js/src/back/updater/index.php +++ b/views/js/src/back/updater/index.php @@ -1,11 +1,11 @@ - - * @copyright Mollie B.V. - * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php - * @category Mollie - * @package Mollie - * @link https://www.mollie.nl - */ -import xss from 'xss'; -import { get } from 'lodash'; - -import axios from '@shared/axios'; -import { ITranslations } from '@shared/globals'; - -const showError = async (message: string): Promise => { - const [ - { default: swal }, - ] = await Promise.all([ - import(/* webpackPrefetch: true, webpackChunkName: "sweetalert" */ 'sweetalert'), - ]); - swal({ - icon: 'error', - title: get(document, 'documentElement.lang', 'en') === 'nl' ? 'Fout' : 'Error', - text: xss(message), - }).then(); -}; - -const handleClick = async (config: any, translations: ITranslations): Promise => { - const steps = [ - { - action: 'downloadUpdate', - defaultError: translations.unableToConnect, - }, - { - action: 'downloadUpdate', - defaultError: translations.unableToUnzip, - }, - { - action: 'downloadUpdate', - defaultError: translations.unableToConnect, - }, - ]; - - for (let step of steps) { - try { - const { data } = await axios.get(`${config.endpoint}&action=${step.action}`); - if (!get(data, 'success')) { - showError(get(data, 'message', step.defaultError)).then(); - } - } catch (e) { - console.error(e); - showError(step.defaultError).then(); - } - } - - import(/* webpackPrefetch: true, webpackChunkName: "sweetalert" */ 'sweetalert').then(({ default: swal }) => { - swal({ - icon: 'success', - text: translations.updated - }).then(); - }); -}; - -export default (button: HTMLElement, config: any, translations: ITranslations) => { - button.onclick = () => handleClick(config, translations); -}; - +/** + * Copyright (c) 2012-2020, Mollie B.V. + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * @author Mollie B.V. + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + */ +import xss from 'xss'; +import { get } from 'lodash'; + +import axios from '@shared/axios'; +import { ITranslations } from '@shared/globals'; + +const showError = async (message: string): Promise => { + const [ + { default: swal }, + ] = await Promise.all([ + import(/* webpackPrefetch: true, webpackChunkName: "sweetalert" */ 'sweetalert'), + ]); + swal({ + icon: 'error', + title: get(document, 'documentElement.lang', 'en') === 'nl' ? 'Fout' : 'Error', + text: xss(message), + }).then(); +}; + +const handleClick = async (config: any, translations: ITranslations): Promise => { + const steps = [ + { + action: 'downloadUpdate', + defaultError: translations.unableToConnect, + }, + { + action: 'downloadUpdate', + defaultError: translations.unableToUnzip, + }, + { + action: 'downloadUpdate', + defaultError: translations.unableToConnect, + }, + ]; + + for (let step of steps) { + try { + const { data } = await axios.get(`${config.endpoint}&action=${step.action}`); + if (!get(data, 'success')) { + showError(get(data, 'message', step.defaultError)).then(); + } + } catch (e) { + console.error(e); + showError(step.defaultError).then(); + } + } + + import(/* webpackPrefetch: true, webpackChunkName: "sweetalert" */ 'sweetalert').then(({ default: swal }) => { + swal({ + icon: 'success', + text: translations.updated + }).then(); + }); +}; + +export default (button: HTMLElement, config: any, translations: ITranslations) => { + button.onclick = () => handleClick(config, translations); +}; + diff --git a/views/js/src/front/banks/components/Banks.tsx b/views/js/src/front/banks/components/Banks.tsx index 6b1fcb0eb..6921e213f 100644 --- a/views/js/src/front/banks/components/Banks.tsx +++ b/views/js/src/front/banks/components/Banks.tsx @@ -1,180 +1,180 @@ -/** - * Copyright (c) 2012-2020, Mollie B.V. - * All rights reserved. - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. - * - * @author Mollie B.V. - * @copyright Mollie B.V. - * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php - * @category Mollie - * @package Mollie - * @link https://www.mollie.nl - */ -import React, { ChangeEvent, ReactElement, Suspense, lazy } from 'react'; -import xss from 'xss'; -import styled from 'styled-components'; - -import { IBanks, ITranslations } from '@shared/globals'; -import LoadingDotsCentered from '@shared/components/LoadingDotsCentered'; - -const QrCode = lazy(() => import(/* webpackChunkName: "banks" */ '@qrcode/components/QrCode')); - -const Radio = styled.div` -&&&& { - padding-left: 80px; - cursor: pointer; - text-align: left; -} - -&&&& label { - display: inline-block; - position: relative; - padding-left: 5px; - cursor: pointer; -} - -&&&& label::before { - content: ""; - display: inline-block; - position: absolute; - width: 17px; - height: 17px; - left: 0; - top: 7px; - margin-left: -20px; - border: 1px solid #cccccc; - border-radius: 50%; - background-color: #fff; - -webkit-transition: border 0.15s ease-in-out; - -o-transition: border 0.15s ease-in-out; - transition: border 0.15s ease-in-out; -} - -&&&& label::after { - display: inline-block; - position: absolute; - content: " "; - width: 11px; - height: 11px; - left: 3px; - top: 10px; - margin-left: -20px; - border-radius: 50%; - background-color: #555555; - -webkit-transform: scale(0, 0); - -ms-transform: scale(0, 0); - -o-transform: scale(0, 0); - transform: scale(0, 0); - -webkit-transition: -webkit-transform 0.1s cubic-bezier(0.8, -0.33, 0.2, 1.33); - -moz-transition: -moz-transform 0.1s cubic-bezier(0.8, -0.33, 0.2, 1.33); - -o-transition: -o-transform 0.1s cubic-bezier(0.8, -0.33, 0.2, 1.33); - transition: transform 0.1s cubic-bezier(0.8, -0.33, 0.2, 1.33); -} - -&&&& input[type="radio"] { - opacity: 0; -} - -&&&& input[type="radio"]:focus + label::before { - outline: 5px auto -webkit-focus-ring-color; - outline-offset: -2px; -} - -&&&& input[type="radio"]:checked + label::after { - -webkit-transform: scale(1, 1); - -ms-transform: scale(1, 1); - -o-transform: scale(1, 1); - transform: scale(1, 1); -} - -&&&& input[type="radio"]:disabled + label { - opacity: 0.65; -} - -&&&& input[type="radio"]:disabled + label::before { - cursor: not-allowed; -} - -&&&&&&&&-inline { - margin-top: 0; -} - -&&&& input[type="radio"] + label::after { - background-color: #7cd1f9; -} - -&&&& input[type="radio"]:checked + label::before { - border-color: #7cd1f9; -} - -&&&& input[type="radio"]:checked + label::after { - background-color: #7cd1f9; -} -`; - -declare let window: any; - -interface IProps { - banks: IBanks; - translations: ITranslations; - setIssuer: any; -} - -export default function Banks({ banks, translations, setIssuer }: IProps): ReactElement<{}> { - function _handleChange({ target: { value } }: ChangeEvent): void { - setIssuer(value); - } - - const firstBankId = (Object.values(banks))[0].id; - - return ( -
      -
        - {Object.values(banks).map((bank) => ( - - - - - ))} -
      - {window.mollieQrEnabled && ( - }> - - - )} -
      - ); -} +/** + * Copyright (c) 2012-2020, Mollie B.V. + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * @author Mollie B.V. + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + */ +import React, { ChangeEvent, ReactElement, Suspense, lazy } from 'react'; +import xss from 'xss'; +import styled from 'styled-components'; + +import { IBanks, ITranslations } from '@shared/globals'; +import LoadingDotsCentered from '@shared/components/LoadingDotsCentered'; + +const QrCode = lazy(() => import(/* webpackChunkName: "banks" */ '@qrcode/components/QrCode')); + +const Radio = styled.div` +&&&& { + padding-left: 80px; + cursor: pointer; + text-align: left; +} + +&&&& label { + display: inline-block; + position: relative; + padding-left: 5px; + cursor: pointer; +} + +&&&& label::before { + content: ""; + display: inline-block; + position: absolute; + width: 17px; + height: 17px; + left: 0; + top: 7px; + margin-left: -20px; + border: 1px solid #cccccc; + border-radius: 50%; + background-color: #fff; + -webkit-transition: border 0.15s ease-in-out; + -o-transition: border 0.15s ease-in-out; + transition: border 0.15s ease-in-out; +} + +&&&& label::after { + display: inline-block; + position: absolute; + content: " "; + width: 11px; + height: 11px; + left: 3px; + top: 10px; + margin-left: -20px; + border-radius: 50%; + background-color: #555555; + -webkit-transform: scale(0, 0); + -ms-transform: scale(0, 0); + -o-transform: scale(0, 0); + transform: scale(0, 0); + -webkit-transition: -webkit-transform 0.1s cubic-bezier(0.8, -0.33, 0.2, 1.33); + -moz-transition: -moz-transform 0.1s cubic-bezier(0.8, -0.33, 0.2, 1.33); + -o-transition: -o-transform 0.1s cubic-bezier(0.8, -0.33, 0.2, 1.33); + transition: transform 0.1s cubic-bezier(0.8, -0.33, 0.2, 1.33); +} + +&&&& input[type="radio"] { + opacity: 0; +} + +&&&& input[type="radio"]:focus + label::before { + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} + +&&&& input[type="radio"]:checked + label::after { + -webkit-transform: scale(1, 1); + -ms-transform: scale(1, 1); + -o-transform: scale(1, 1); + transform: scale(1, 1); +} + +&&&& input[type="radio"]:disabled + label { + opacity: 0.65; +} + +&&&& input[type="radio"]:disabled + label::before { + cursor: not-allowed; +} + +&&&&&&&&-inline { + margin-top: 0; +} + +&&&& input[type="radio"] + label::after { + background-color: #7cd1f9; +} + +&&&& input[type="radio"]:checked + label::before { + border-color: #7cd1f9; +} + +&&&& input[type="radio"]:checked + label::after { + background-color: #7cd1f9; +} +`; + +declare let window: any; + +interface IProps { + banks: IBanks; + translations: ITranslations; + setIssuer: any; +} + +export default function Banks({ banks, translations, setIssuer }: IProps): ReactElement<{}> { + function _handleChange({ target: { value } }: ChangeEvent): void { + setIssuer(value); + } + + const firstBankId = (Object.values(banks))[0].id; + + return ( +
      +
        + {Object.values(banks).map((bank) => ( + + + + + ))} +
      + {window.mollieQrEnabled && ( + }> + + + )} +
      + ); +} diff --git a/views/js/src/front/banks/components/index.php b/views/js/src/front/banks/components/index.php index a950d02f4..729abf520 100644 --- a/views/js/src/front/banks/components/index.php +++ b/views/js/src/front/banks/components/index.php @@ -1,11 +1,11 @@ - - * @copyright Mollie B.V. - * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php - * @category Mollie - * @package Mollie - * @link https://www.mollie.nl - */ -import React, { lazy, Suspense } from 'react'; -import { render, unmountComponentAtNode } from 'react-dom'; -import swal from 'sweetalert'; -import xss from 'xss'; - -import { IBanks, ITranslations } from '@shared/globals'; -import LoadingDotsCentered from '@shared/components/LoadingDotsCentered'; - -const Banks = lazy(() => import(/* webpackPrefetch: true, webpackChunkName: "banks" */ '@banks/components/Banks')); - -declare let window: any; - -export default function bankList(banks: IBanks, translations: ITranslations): void { - let issuer = Object.values(banks)[0].id; - function _setIssuer(newIssuer: string): void { - issuer = newIssuer; - } - - (async function () { - const wrapper = document.createElement('DIV'); - render( - ( -
      - }> - - -
      - ), - wrapper - ); - const elem = wrapper.firstChild as Element; - - const value = await swal({ - title: xss(translations.chooseYourBank), - content: { - element: elem, - }, - buttons: { - cancel: { - text: xss(translations.cancel), - visible: true, - }, - confirm: { - text: xss(translations.choose), - }, - }, - }); - if (value) { - const win = window.open(banks[issuer].href, '_self'); - win.opener = null; - } else { - try { - setTimeout(() => unmountComponentAtNode(wrapper), 2000); - } catch (e) { - } - } - }()); -} - +/** + * Copyright (c) 2012-2020, Mollie B.V. + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * @author Mollie B.V. + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + */ +import React, { lazy, Suspense } from 'react'; +import { render, unmountComponentAtNode } from 'react-dom'; +import swal from 'sweetalert'; +import xss from 'xss'; + +import { IBanks, ITranslations } from '@shared/globals'; +import LoadingDotsCentered from '@shared/components/LoadingDotsCentered'; + +const Banks = lazy(() => import(/* webpackPrefetch: true, webpackChunkName: "banks" */ '@banks/components/Banks')); + +declare let window: any; + +export default function bankList(banks: IBanks, translations: ITranslations): void { + let issuer = Object.values(banks)[0].id; + function _setIssuer(newIssuer: string): void { + issuer = newIssuer; + } + + (async function () { + const wrapper = document.createElement('DIV'); + render( + ( +
      + }> + + +
      + ), + wrapper + ); + const elem = wrapper.firstChild as Element; + + const value = await swal({ + title: xss(translations.chooseYourBank), + content: { + element: elem, + }, + buttons: { + cancel: { + text: xss(translations.cancel), + visible: true, + }, + confirm: { + text: xss(translations.choose), + }, + }, + }); + if (value) { + const win = window.open(banks[issuer].href, '_self'); + win.opener = null; + } else { + try { + setTimeout(() => unmountComponentAtNode(wrapper), 2000); + } catch (e) { + } + } + }()); +} + diff --git a/views/js/src/front/index.php b/views/js/src/front/index.php index a950d02f4..729abf520 100644 --- a/views/js/src/front/index.php +++ b/views/js/src/front/index.php @@ -1,11 +1,11 @@ - - * @copyright Mollie B.V. - * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php - * @category Mollie - * @package Mollie - * @link https://www.mollie.nl - */ -import 'intersection-observer'; -import React, { ReactElement, useEffect, useRef, useState } from 'react'; -import styled from 'styled-components'; -import { throttle } from 'lodash'; - -import LoadingDotsCentered from '@shared/components/LoadingDotsCentered'; -import axios from '@shared/axios'; -import { QrStatus } from '@shared/globals'; - -declare let window: any; - -const TitleSpan = styled.span` -&&&& { - font-size: 20px; - display: block; -} -`; - -const QrImageContainer = styled.div` -&&&& { - position: relative; - display: block; - text-align: ${({ center }: any) => center ? 'center' : 'left'}; - margin: ${({ center }: any) => center ? '0 auto' : 'inherit'}; - height: 240px; - width: 240px; -} -` as any; - -const QrImage = styled.img` -&&&& { - height: 240px; - width: 240px; - position: absolute; - top: 0; - left: 0; -} -` as any; - -interface IProps { - title?: string; - center?: boolean; -} - -export default function QrCode({ title, center }: IProps): ReactElement<{}> { - const [enoughSpace, setEnoughSpace] = useState(false); - const [visible, setVisible] = useState(false); - const [error] = useState(false); - const [image, setImage] = useState(''); - const [initializing, setInitializing] = useState(false); - const [mounted, setMounted] = useState(true); - - function _clearCache(): void { - for (let key in window.localStorage) { - if (key.indexOf('mollieqrcache') > -1) { - window.localStorage.removeItem(key); - } - } - } - - function _checkWindowSize(): void { - setEnoughSpace(window.innerWidth > 800 && window.innerHeight > 860); - } - - async function _grabNewUrl(): Promise { - try { - const { data } = await axios.get(window.MollieModule.urls.qrCodeNew); - window.localStorage.setItem('mollieqrcache-' + data.expires + '-' + data.amount, JSON.stringify({ - url: data.href, - idTransaction: data.idTransaction, - })); - setImage(data.href); - return data.idTransaction; - } catch (e) { - console.error(e); - } - } - - function _pollStatus(idTransaction: string): void { - if (!mounted) { - return; - } - - setTimeout(async (): Promise => { - try { - const { data } = await axios.get(`${window.MollieModule.urls.qrCodeStatus}&transaction_id=${idTransaction}`); - if (data.status === QrStatus.success) { - _clearCache(); - - // Never redirect to a different domain - const a = document.createElement('A') as HTMLAnchorElement; - a.href = data.href; - if (a.hostname === window.location.hostname) { - window.location.href = data.href; - } - } else if (data.status === QrStatus.refresh) { - _clearCache(); - _grabNewUrl().then(); - } else if (data.status === QrStatus.pending) { - _pollStatus(idTransaction); - } else { - console.error('Invalid payment status'); - } - } catch (e) { - _pollStatus(idTransaction); - } - }, 5000); - } - - async function _grabAmount(): Promise { - try { - const { data: { amount } } = await axios.get(window.MollieModule.urls.cartAmount); - return amount; - } catch (e) { - console.error(e); - } - } - - function _initQrImage(amount: number): void { - let url: string = null; - let idTransaction: string = null; - if (typeof window.localStorage !== 'undefined') { - for (let key in window.localStorage) { - if (key.indexOf('mollieqrcache') > -1) { - const cacheInfo = key.split('-'); - if (parseInt(cacheInfo[1], 10) > (+new Date() + 60 * 1000) && parseInt(cacheInfo[2], 10) === amount) { - const item = JSON.parse(window.localStorage.getItem(key)); - const a = document.createElement('A') as HTMLAnchorElement; - a.href = item.url; - if (!/\.ideal\.nl$/i.test(a.hostname) || a.protocol !== 'https:') { - window.localStorage.removeItem(key); - continue; - } - // Valid - url = item.url; - idTransaction = item.idTransaction; - break; - } else { - window.localStorage.removeItem(key); - } - } - } - - if (url && idTransaction) { - setImage(url); - _pollStatus(idTransaction); - } else { - _grabNewUrl().then(_pollStatus); - } - } - } - - const ref = useRef<| null>(null); - - const resizeHandler = throttle(() => { - _checkWindowSize(); - }, 200); - - useEffect(() => { - setMounted(true); - let observer = new IntersectionObserver(entries => { - entries.forEach(entry => { - const { isIntersecting, intersectionRatio } = entry; - - if (isIntersecting === true || intersectionRatio > 0) { - setVisible(true); - observer.disconnect(); - observer = null; - } - }); - }, {}); - observer.observe(ref.current); - _checkWindowSize(); - window.addEventListener('resize', resizeHandler); - - return () => { - setMounted(false); - if (observer != null) { - observer.disconnect(); - observer = null; - } - - window.removeEventListener('resize', resizeHandler); - } - }, []); - - useEffect(() => { - if (enoughSpace && visible && !image && !initializing) { - setInitializing(true); - _grabAmount().then(_initQrImage); - } - }, [enoughSpace, visible, image, initializing]); - - if (!enoughSpace || !visible || error) { - return

       

      ; - } - - return ( - <> - {title} - - {!image && } - {image && } - - - ); -} +/** + * Copyright (c) 2012-2020, Mollie B.V. + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * @author Mollie B.V. + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + */ +import 'intersection-observer'; +import React, { ReactElement, useEffect, useRef, useState } from 'react'; +import styled from 'styled-components'; +import { throttle } from 'lodash'; + +import LoadingDotsCentered from '@shared/components/LoadingDotsCentered'; +import axios from '@shared/axios'; +import { QrStatus } from '@shared/globals'; + +declare let window: any; + +const TitleSpan = styled.span` +&&&& { + font-size: 20px; + display: block; +} +`; + +const QrImageContainer = styled.div` +&&&& { + position: relative; + display: block; + text-align: ${({ center }: any) => center ? 'center' : 'left'}; + margin: ${({ center }: any) => center ? '0 auto' : 'inherit'}; + height: 240px; + width: 240px; +} +` as any; + +const QrImage = styled.img` +&&&& { + height: 240px; + width: 240px; + position: absolute; + top: 0; + left: 0; +} +` as any; + +interface IProps { + title?: string; + center?: boolean; +} + +export default function QrCode({ title, center }: IProps): ReactElement<{}> { + const [enoughSpace, setEnoughSpace] = useState(false); + const [visible, setVisible] = useState(false); + const [error] = useState(false); + const [image, setImage] = useState(''); + const [initializing, setInitializing] = useState(false); + const [mounted, setMounted] = useState(true); + + function _clearCache(): void { + for (let key in window.localStorage) { + if (key.indexOf('mollieqrcache') > -1) { + window.localStorage.removeItem(key); + } + } + } + + function _checkWindowSize(): void { + setEnoughSpace(window.innerWidth > 800 && window.innerHeight > 860); + } + + async function _grabNewUrl(): Promise { + try { + const { data } = await axios.get(window.MollieModule.urls.qrCodeNew); + window.localStorage.setItem('mollieqrcache-' + data.expires + '-' + data.amount, JSON.stringify({ + url: data.href, + idTransaction: data.idTransaction, + })); + setImage(data.href); + return data.idTransaction; + } catch (e) { + console.error(e); + } + } + + function _pollStatus(idTransaction: string): void { + if (!mounted) { + return; + } + + setTimeout(async (): Promise => { + try { + const { data } = await axios.get(`${window.MollieModule.urls.qrCodeStatus}&transaction_id=${idTransaction}`); + if (data.status === QrStatus.success) { + _clearCache(); + + // Never redirect to a different domain + const a = document.createElement('A') as HTMLAnchorElement; + a.href = data.href; + if (a.hostname === window.location.hostname) { + window.location.href = data.href; + } + } else if (data.status === QrStatus.refresh) { + _clearCache(); + _grabNewUrl().then(); + } else if (data.status === QrStatus.pending) { + _pollStatus(idTransaction); + } else { + console.error('Invalid payment status'); + } + } catch (e) { + _pollStatus(idTransaction); + } + }, 5000); + } + + async function _grabAmount(): Promise { + try { + const { data: { amount } } = await axios.get(window.MollieModule.urls.cartAmount); + return amount; + } catch (e) { + console.error(e); + } + } + + function _initQrImage(amount: number): void { + let url: string = null; + let idTransaction: string = null; + if (typeof window.localStorage !== 'undefined') { + for (let key in window.localStorage) { + if (key.indexOf('mollieqrcache') > -1) { + const cacheInfo = key.split('-'); + if (parseInt(cacheInfo[1], 10) > (+new Date() + 60 * 1000) && parseInt(cacheInfo[2], 10) === amount) { + const item = JSON.parse(window.localStorage.getItem(key)); + const a = document.createElement('A') as HTMLAnchorElement; + a.href = item.url; + if (!/\.ideal\.nl$/i.test(a.hostname) || a.protocol !== 'https:') { + window.localStorage.removeItem(key); + continue; + } + // Valid + url = item.url; + idTransaction = item.idTransaction; + break; + } else { + window.localStorage.removeItem(key); + } + } + } + + if (url && idTransaction) { + setImage(url); + _pollStatus(idTransaction); + } else { + _grabNewUrl().then(_pollStatus); + } + } + } + + const ref = useRef<| null>(null); + + const resizeHandler = throttle(() => { + _checkWindowSize(); + }, 200); + + useEffect(() => { + setMounted(true); + let observer = new IntersectionObserver(entries => { + entries.forEach(entry => { + const { isIntersecting, intersectionRatio } = entry; + + if (isIntersecting === true || intersectionRatio > 0) { + setVisible(true); + observer.disconnect(); + observer = null; + } + }); + }, {}); + observer.observe(ref.current); + _checkWindowSize(); + window.addEventListener('resize', resizeHandler); + + return () => { + setMounted(false); + if (observer != null) { + observer.disconnect(); + observer = null; + } + + window.removeEventListener('resize', resizeHandler); + } + }, []); + + useEffect(() => { + if (enoughSpace && visible && !image && !initializing) { + setInitializing(true); + _grabAmount().then(_initQrImage); + } + }, [enoughSpace, visible, image, initializing]); + + if (!enoughSpace || !visible || error) { + return

       

      ; + } + + return ( + <> + {title} + + {!image && } + {image && } + + + ); +} diff --git a/views/js/src/front/qrcode/components/index.php b/views/js/src/front/qrcode/components/index.php index a950d02f4..729abf520 100644 --- a/views/js/src/front/qrcode/components/index.php +++ b/views/js/src/front/qrcode/components/index.php @@ -1,11 +1,11 @@ - - * @copyright Mollie B.V. - * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php - * @category Mollie - * @package Mollie - * @link https://www.mollie.nl - */ -import React from 'react'; -import { render } from 'react-dom'; - -export default function (target: string|HTMLElement, title: string, center: boolean): void { - const elem = (typeof target === 'string' ? document.getElementById(target) : target); - (async function () { - const [ - { default: QrCode }, - ] = await Promise.all([ - import(/* webpackChunkName: "banks" */ '@qrcode/components/QrCode'), - ]); - render( - , - elem - ); - }()); - -} +/** + * Copyright (c) 2012-2020, Mollie B.V. + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * @author Mollie B.V. + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + */ +import React from 'react'; +import { render } from 'react-dom'; + +export default function (target: string|HTMLElement, title: string, center: boolean): void { + const elem = (typeof target === 'string' ? document.getElementById(target) : target); + (async function () { + const [ + { default: QrCode }, + ] = await Promise.all([ + import(/* webpackChunkName: "banks" */ '@qrcode/components/QrCode'), + ]); + render( + , + elem + ); + }()); + +} diff --git a/views/js/src/index.ts b/views/js/src/index.ts index 3eb4571f3..c1aec8a75 100644 --- a/views/js/src/index.ts +++ b/views/js/src/index.ts @@ -1,52 +1,52 @@ -/** - * Copyright (c) 2012-2020, Mollie B.V. - * All rights reserved. - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. - * - * @author Mollie B.V. - * @copyright Mollie B.V. - * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php - * @category Mollie - * @package Mollie - * @link https://www.mollie.nl - */ -export default { - async bankList() { - return await import(/* webpackChunkName: "banks" */ '@banks/index'); - }, - async qrCode() { - return await import(/* webpackChunkName: "qrcode" */ '@qrcode/index'); - }, - async carrierConfig() { - return await import(/* webpackChunkName: "carrierconfig" */ '@carrierconfig/index'); - }, - async methodConfig() { - return await import(/* webpackChunkName: "methodconfig" */ '@methodconfig/index'); - }, - async transactionInfo() { - return await import(/* webpackChunkName: "transaction" */ '@transaction/index'); - }, - async updater() { - return await import(/* webpackChunkName: "updater" */ '@updater/index'); - }, -} +/** + * Copyright (c) 2012-2020, Mollie B.V. + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * @author Mollie B.V. + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl + */ +export default { + async bankList() { + return await import(/* webpackChunkName: "banks" */ '@banks/index'); + }, + async qrCode() { + return await import(/* webpackChunkName: "qrcode" */ '@qrcode/index'); + }, + async carrierConfig() { + return await import(/* webpackChunkName: "carrierconfig" */ '@carrierconfig/index'); + }, + async methodConfig() { + return await import(/* webpackChunkName: "methodconfig" */ '@methodconfig/index'); + }, + async transactionInfo() { + return await import(/* webpackChunkName: "transaction" */ '@transaction/index'); + }, + async updater() { + return await import(/* webpackChunkName: "updater" */ '@updater/index'); + }, +} diff --git a/views/templates/admin/_configure/helpers/form/form.tpl b/views/templates/admin/_configure/helpers/form/form.tpl index a86cbead0..2f32f72af 100644 --- a/views/templates/admin/_configure/helpers/form/form.tpl +++ b/views/templates/admin/_configure/helpers/form/form.tpl @@ -1,585 +1,587 @@ -{** - * Copyright (c) 2012-2020, Mollie B.V. - * All rights reserved. - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. - * - * @author Mollie B.V. - * @copyright Mollie B.V. - * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php - * @category Mollie - * @package Mollie - * @link https://www.mollie.nl -*} -{extends file="helpers/form/form.tpl"} - -{block name="input"} - {if $input.type === 'mollie-br'} -
      - {elseif $input.type === 'mollie-warning'} - {if version_compare($smarty.const._PS_VERSION_, '1.6.0.0', '<')} -
      {$input.message|escape:'htmlall':'UTF-8'}
      - {else} -
      {$input.message|escape:'htmlall':'UTF-8'}
      - {/if} - {elseif $input.type === 'mollie-methods'} - - {foreach $input.paymentMethods as $paymentMethod} - {assign var = 'methodObj' value=$paymentMethod.obj} -
      - -
      -
      - -
      - -
      -
      -
      - -
      - -
      -
      -
      - -
      - -
      -
      -
      - -
      - -
      -
      -
      - -
      - -
      -
      -
      - -
      - -
      -
      - {*
      *} - {* *} - {*
      *} - {* *} - {*
      *} - {*
      *} - {*
      *} - {* *} - {*
      *} - {* *} - {*
      *} - {*
      *} -
      - -
      - -

      - {l s='You can display payment fee in your email template by adding "{payment_fee}" in email translations. For more information visit: ' mod='mollie'} - {l s='Translations' mod='mollie'} -

      -
      -
      -
      - -
      - -
      -
      -
      - -
      - -
      -
      -
      - -
      - -
      -
      -
      -
      - {/foreach} - {foreach $webpack_urls as $webpack_url} - - {/foreach} - {elseif $input.type === 'mollie-h1'} -
      -

      {$input.title|escape:'html':'UTF-8'}

      - {elseif $input.type === 'mollie-h2'} -
      -

      {$input.title|escape:'html':'UTF-8'}

      - {elseif $input.type === 'mollie-h3'} -
      -

      {$input.title|escape:'html':'UTF-8'}

      - {elseif $input.type == 'mollie-carriers'} -
      -
      - {l s='Here you can configure what information about the shipment is sent to - Mollie' mod='mollie' js=1} -
      {l s='You can use the following variables for the Carrier URLs' mod='mollie' js=1} -
        -
      • @ : Shipping number
      • -
      • %%shipping_number%% : {l s='Shipping number' mod='mollie' js=1}
      • -
      • %%invoice.country_iso%%: {l s='Billing country code' mod='mollie' js=1}
      • -
      • %%invoice.postcode%% : {l s='Billing postcode' mod='mollie' js=1}
      • -
      • %%delivery.country_iso%%: {l s='Shipping country code' mod='mollie' js=1}
      • -
      • %%delivery.postcode%% : {l s='Shipping postcode' mod='mollie' js=1}
      • -
      • %%lang_iso%% : {l s='2-letter language code' mod='mollie' js=1}
      • -
      -
      - - - - - - - - - - {foreach $input.carriers as $carrier} - - - - - - {/foreach} - -
      NameURL SourceCustom URL
      {$carrier.name} - - - -
      -
      - {elseif $input.type == 'mollie-carrier-switch'} - -
      - {if version_compare($smarty.const._PS_VERSION_, '1.6.0.0', '<')} - {foreach $input.values as $value} - - - {if isset($input.br) && $input.br}
      {/if} - {if isset($value.p) && $value.p}

      {$value.p|escape:'htmlall':'UTF-8'}

      {/if} - {/foreach} - {else} - - {foreach $input.values as $value} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -{strip} - - {/strip} - {/foreach} - - - {/if} -
      - - {elseif $input.type == 'switch' && version_compare($smarty.const._PS_VERSION_, '1.6.0.0', '<')} - {foreach $input.values as $value} - - - {if isset($input.br) && $input.br}
      {/if} - {if isset($value.p) && $value.p}

      {$value.p|escape:'htmlall':'UTF-8'}

      {/if} - {/foreach} - {elseif $input.type === 'checkbox'} - -
      - {$smarty.block.parent} -
      - - {elseif $input.type === 'mollie-description'} - -
      - {$input.type = 'text'} - {$smarty.block.parent} -
      - - {elseif $input.type === 'mollie-switch'} - -
      - {if version_compare($smarty.const._PS_VERSION_, '1.6.0.0', '<')} - {foreach $input.values as $value} - - - {if isset($input.br) && $input.br}
      {/if} - {if isset($value.p) && $value.p}

      {$value.p|escape:'htmlall':'UTF-8'}

      {/if} - {/foreach} - {else} - - {foreach $input.values as $value} - - {strip} - - {/strip} - {/foreach} - - - {/if} -
      - - {else} - {$smarty.block.parent} - {/if} +{** + * Copyright (c) 2012-2020, Mollie B.V. + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * @author Mollie B.V. + * @copyright Mollie B.V. + * @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php + * @category Mollie + * @package Mollie + * @link https://www.mollie.nl +*} +{extends file="helpers/form/form.tpl"} + +{block name="input"} + {if $input.type === 'mollie-br'} +
      + {elseif $input.type === 'mollie-warning'} + {if version_compare($smarty.const._PS_VERSION_, '1.6.0.0', '<')} +
      {$input.message|escape:'htmlall':'UTF-8'}
      + {else} +
      {$input.message|escape:'htmlall':'UTF-8'}
      + {/if} + {elseif $input.type === 'mollie-methods'} + + {foreach $input.paymentMethods as $paymentMethod} + {assign var = 'methodObj' value=$paymentMethod.obj} +
      + +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      + {*
      *} + {* *} + {*
      *} + {* *} + {*
      *} + {*
      *} + {*
      *} + {* *} + {*
      *} + {* *} + {*
      *} + {*
      *} +
      + +
      + +

      + {l s='You can display payment fee in your email template by adding "{payment_fee}" in email translations. For more information visit: ' mod='mollie'} + {l s='Translations' mod='mollie'} +

      +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      +
      + {/foreach} + {foreach $webpack_urls as $webpack_url} + + {/foreach} + {elseif $input.type === 'mollie-h1'} +
      +

      {$input.title|escape:'html':'UTF-8'}

      + {elseif $input.type === 'mollie-h2'} +
      +

      {$input.title|escape:'html':'UTF-8'}

      + {elseif $input.type === 'mollie-h3'} +
      +

      {$input.title|escape:'html':'UTF-8'}

      + {elseif $input.type == 'mollie-carriers'} +
      +
      + {l s='Here you can configure what information about the shipment is sent to + Mollie' mod='mollie' js=1} +
      {l s='You can use the following variables for the Carrier URLs' mod='mollie' js=1} +
        +
      • @ : Shipping number
      • +
      • %%shipping_number%% : {l s='Shipping number' mod='mollie' js=1}
      • +
      • %%invoice.country_iso%%: {l s='Billing country code' mod='mollie' js=1}
      • +
      • %%invoice.postcode%% : {l s='Billing postcode' mod='mollie' js=1}
      • +
      • %%delivery.country_iso%%: {l s='Shipping country code' mod='mollie' js=1}
      • +
      • %%delivery.postcode%% : {l s='Shipping postcode' mod='mollie' js=1}
      • +
      • %%lang_iso%% : {l s='2-letter language code' mod='mollie' js=1}
      • +
      +
      + + + + + + + + + + {foreach $input.carriers as $carrier} + + + + + + {/foreach} + +
      NameURL SourceCustom URL
      {$carrier.name} + + + +
      +
      + {elseif $input.type == 'mollie-carrier-switch'} + +
      + {if version_compare($smarty.const._PS_VERSION_, '1.6.0.0', '<')} + {foreach $input.values as $value} + + + {if isset($input.br) && $input.br}
      {/if} + {if isset($value.p) && $value.p}

      {$value.p|escape:'htmlall':'UTF-8'}

      {/if} + {/foreach} + {else} + + {foreach $input.values as $value} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{strip} + + {/strip} + {/foreach} + + + {/if} +
      + + {elseif $input.type == 'switch' && version_compare($smarty.const._PS_VERSION_, '1.6.0.0', '<')} + {foreach $input.values as $value} + + + {if isset($input.br) && $input.br}
      {/if} + {if isset($value.p) && $value.p}

      {$value.p|escape:'htmlall':'UTF-8'}

      {/if} + {/foreach} + {elseif $input.type === 'checkbox'} + +
      + {$smarty.block.parent} +
      + + {elseif $input.type === 'mollie-description'} + +
      + {$input.type = 'text'} + {$smarty.block.parent} +
      + + {elseif $input.type === 'mollie-switch'} + +
      + {if version_compare($smarty.const._PS_VERSION_, '1.6.0.0', '<')} + {foreach $input.values as $value} + + + {if isset($input.br) && $input.br}
      {/if} + {if isset($value.p) && $value.p}

      {$value.p|escape:'htmlall':'UTF-8'}

      {/if} + {/foreach} + {else} + + {foreach $input.values as $value} + + {strip} + + {/strip} + {/foreach} + + + {/if} +
      + + {else} + {$smarty.block.parent} + {/if} {/block} \ No newline at end of file diff --git a/views/templates/front/order-confirmation-table.tpl b/views/templates/front/order-confirmation-table.tpl index 0b46bcb95..e58a60beb 100644 --- a/views/templates/front/order-confirmation-table.tpl +++ b/views/templates/front/order-confirmation-table.tpl @@ -1,27 +1,35 @@ {** - * 2007-2019 PrestaShop and Contributors - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License 3.0 (AFL-3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * https://opensource.org/licenses/AFL-3.0 - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@prestashop.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade PrestaShop to newer - * versions in the future. If you wish to customize PrestaShop for your - * needs please refer to https://www.prestashop.com for more information. - * - * @author PrestaShop SA - * @copyright 2007-2019 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) - * International Registered Trademark & Property of PrestaShop SA - *} +* Copyright (c) 2012-2020, Mollie B.V. +* All rights reserved. +* +* 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. +* +* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. +* +* @author Mollie B.V. +* @copyright Mollie B.V. +* @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php +* @category Mollie +* @package Mollie +* @link https://www.mollie.nl +*} {extends file='checkout/_partials/order-confirmation-table.tpl'} {block name='order_confirmation_table'} {foreach from=$products item=product} @@ -60,7 +68,7 @@
      {if $field.type == 'text'} - {if (int)$field.id_module} + {if $field.id_module} {$field.text nofilter} {else} {$field.text} diff --git a/views/templates/hook/payment.tpl b/views/templates/hook/payment.tpl index 46ac83eeb..6c04adddd 100644 --- a/views/templates/hook/payment.tpl +++ b/views/templates/hook/payment.tpl @@ -1,114 +1,114 @@ -{** -* Copyright (c) 2012-2020, Mollie B.V. -* All rights reserved. -* -* 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. -* -* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. -* -* @author Mollie B.V. -* @copyright Mollie B.V. -* @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php -* @category Mollie -* @package Mollie -* @link https://www.mollie.nl -*} -{if $warning != ''} -

      {$warning|escape:'htmlall':'UTF-8'}

      -{/if} - - - -{include file="./init_urls.tpl"} - -{if !empty($issuers['ideal']) && $issuer_setting === $ISSUERS_ON_CLICK} - -{/if} +{** +* Copyright (c) 2012-2020, Mollie B.V. +* All rights reserved. +* +* 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. +* +* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. +* +* @author Mollie B.V. +* @copyright Mollie B.V. +* @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php +* @category Mollie +* @package Mollie +* @link https://www.mollie.nl +*} +{if $warning != ''} +

      {$warning|escape:'htmlall':'UTF-8'}

      +{/if} + + + +{include file="./init_urls.tpl"} + +{if !empty($issuers['ideal']) && $issuer_setting === $ISSUERS_ON_CLICK} + +{/if}